Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - kaB00M

Pages: 1 2 [3] 4 5 ... 7
31
General discussions / Re: Survey for SFML Book
« on: November 27, 2012, 05:42:28 am »
 :)

32
SFML projects / Re: Fractal - Mandelbrot Set
« on: November 15, 2012, 05:06:04 am »
If you go deep enough you can see god.  :)

You say this is pure mathematics?

33
SFML projects / Re: didii's simple classes
« on: November 13, 2012, 09:41:38 pm »
A VertexArray has to only once call the OpenGL draw function (SFML is built on top of OpenGL), thus it's way more efficient than having to call it as many times as tiles exist. Also since then everything is nicely composed of vertices the GPU will be extremely fast. (GPUs are built to handle millions of vertices per second).

What black magic is this? I guess this won't work in old computers thought, right?

34
SFML projects / Re: My new game released!! HUNGRY SNAKE 1.0
« on: November 13, 2012, 02:39:15 am »
Very nice. :) I played a little bit today; will play more tomorrow.

Two things I noticed:
    1. There is no music during the main segment. Maybe you can add some 'tense' music when one is about to die.
    2. The close window button is not working (don't know if you intended it this way).

This game gives me a warm feeling inside.  :)

35
General / Re: SF::Rotation returning a value above 360 or below 0
« on: November 10, 2012, 12:52:00 am »
It's true. But it shouldn't be an issue.
So:

-1 == 360
-2 == 359

361 == 0
362 == 1

36
General / Re: Grid-based sprite movement
« on: November 09, 2012, 01:22:22 am »
I'm a newbie like you, but I think using a thread is something of an 'overkill'.
I believe most games don't use threads, specially older games.

The thing is computers are so fast that there is an illusion of things happening simultaneously, when in reality they happen in an order. You should use this fact to your advantage.

Anyway, here's another version of a tile-based movement system.
const int TILE_WIDTH = 16; //we assume tile width and height are the same

struct Dir {enum Type {Up, Right, Down, Left};};

struct Actor
{
    float x, y;
    int gridX, gridY;
    float speed;

    Actor() : speed(1.0f) {} //change speed!

    bool isMoving() const
    {
        return !(x == gridX * TILE_WIDTH && y == gridY * TILE_WIDTH);
    }

    void warp(int newGridX, int newGridY)
    {
        gridX = newGridX;
        gridY = newGridY;

        x = newGridX * TILE_WIDTH;
        y = newGridY * TILE_WIDTH;
    }

    void move(const Dir::Type dir)
    {
        /* if actor is already moving from one tile to the other,
        don't make new move */

        if (isMoving())
            return;

        if (dir == Dir::Up)
            gridY -= 1;
        else if (dir == Dir::Down)
            gridY += 1;
        if (dir == Dir::Left)
            gridX -= 1;
        else if (dir == Dir::Right)
            gridX += 1;

    }

    void update()
    {
        if (x < gridX * TILE_WIDTH) //moving right
            x = std::min(x + speed, float(gridX * TILE_WIDTH));
        else if (x > gridX * TILE_WIDTH) //moving left
            x = std::max(x - speed, float(gridX * TILE_WIDTH));

        if (y < gridY * TILE_WIDTH) //moving down
            y = std::min(y + speed, float(gridY * TILE_WIDTH));
        else if (y > gridY * TILE_WIDTH) //moving up
            y = std::max(y - speed, float(gridY * TILE_WIDTH));
    }

    sf::Vector2f getCoors() const {return sf::Vector2f(x,y); }
};
 

You can use it like so:

Actor actor;
actor.warp(4, 4); //initial tile
 

In the loop:
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)){
    actor.move(Dir::Right);
}
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)){
    actor.move(Dir::Left);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)){
    actor.move(Dir::Up);
}
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down)){
    actor.move(Dir::Down);
}

actor.update();
sprite.setPosition(actor.getCoors()); //your sf::Sprite
//do draw, etc...
 

37
SFML projects / Re: SFML-Sidescroller: Version 0.07 released!
« on: November 09, 2012, 01:11:56 am »
I don't laugh because I have no idea about any of those things.   :(

The 'break' was quiet simple: I positioned the ship in the top-right corner of the screen, while continuously shooting. The score goes up slowly but steadily.

38
SFML projects / Re: SFML-Sidescroller: Version 0.07 released!
« on: November 08, 2012, 03:33:05 am »
I didn't cheat, but I 'broke' the game.  ;)

By the way how do you store your top-score data; with SQL in a website?

39
SFML projects / Re: Survive and Thrive
« on: November 06, 2012, 06:16:09 am »
It's not working for me.  :-\

I get to the main menu, but when I try to access either "Play", or "Help", only a black screen appears.

 :(

40
SFML projects / Re: SFML-Sidescroller: Version 0.07 released!
« on: November 06, 2012, 12:29:49 am »
#1  :D

41
SFML projects / Re: SFML-Sidescroller: Version 0.07 released!
« on: November 05, 2012, 06:54:53 pm »
Very much fun!  :)

Number #24 so far; I'm going for #1.

My only suggestion is to include something like a 'health-bar' since sometimes I'm not sure how good my ship is doing.

Keep the good work! 

42
Window / Re: How do you make the keyboard just click one time? (SFML 2.0)
« on: November 04, 2012, 11:23:40 pm »
You can use something like:

bool key_triggered[sf::Keyboard::KeyCount]; //array containing all possible keys

void resetTriggered()
{
    for (int i = 0; i < sf::Keyboard::KeyCount; ++i)
        key_triggered[i] = false;
}

//initialize!
ResetTriggered();

bool isKeyTrigger(sf::Keyboard::Key key)
{
    if ( sf::Keyboard::isKeyPressed(key) && !key_triggered[key] )
    {
        return (key_triggered[sf::Keyboard::Right] = true);
    }
}
 

Now, you can use it like this.

if (isKeyTrigger(sf::Keyboard::Right)) //your choice of key
{
    //example: move character right!
}

//must update after end of key-check loop!
resetTriggered();
 

This is a simplified version; you can insert the variables and fuction inside a class to make it more uniform.
Also, note that you can check for the same key ONLY ONCE per frame/tick.

44
SFML projects / Re: Seiken Densetsu/Mana Fan Game [DEMO]
« on: October 31, 2012, 10:23:24 pm »

I also use Tiled. I think it´s the best mapeditor for a RPG.  :D

I store my maps with Base64Code, so it´s smaller. If you want, i can send u a decode class for Base64.
For parsing i use ifstream.

Please do!

@masskiller: I updated the game to make shaders optional. To disable, change the 'shaders' value in the config file from 1 to 0.

Please, tell me what you think.

Also,  now a gamepad can be used.

45
SFML projects / Re: Seiken Densetsu/Mana Fan Game [DEMO]
« on: October 31, 2012, 04:15:40 am »
I will make an update soon with an option to disable the shaders. I know your a gamer, so I want you, masskiller, to try the game.

Pages: 1 2 [3] 4 5 ... 7
anything