Still waiting for answer + I have a problem(I guess, nothing new right?).
When I want to move my character I can do it in normal way I mean if I press D button I want to character to move in right position and to play right move animation.
In my game You will move only if You HOLD Key so I did something like that:
Wejscie = sfRenderWindow_GetInput(App);
sfBool Prawo = sfInput_IsKeyDown(Wejscie, sfKeyD);
sfBool Lewo = sfInput_IsKeyDown(Wejscie, sfKeyA);
sfBool Gora = sfInput_IsKeyDown(Wejscie, sfKeyW);
sfBool Dol = sfInput_IsKeyDown(Wejscie, sfKeyS);
float Offset = sfRenderWindow_GetFrameTime(App) * 50.f;
float OffsetX = 0.f;
float OffsetY = 0.f;
/* Process events */
while (sfRenderWindow_GetEvent(App, &Event))
{
/* Close window : exit */
if (Event.Type == sfEvtClosed)
sfRenderWindow_Close(App);
//if (Event.Type == sfEvtKeyPressed && Event.Key.Code == sfKeyD)
if (Prawo == sfTrue)
{
OffsetX += Offset;
sfSprite_Move(wsk->duszek, OffsetX, 0);
PlayUstalone(4,8,wsk);
sfClock_Reset(zegar);
}
if (Lewo == sfTrue)
{
OffsetX = -Offset;
sfSprite_Move(wsk->duszek, OffsetX, 0);
PlayUstalone(12,16,wsk);
sfClock_Reset(zegar);
}
if (Gora == sfTrue)
{
OffsetY = -Offset;
sfSprite_Move(wsk->duszek, 0, OffsetY);
PlayUstalone(0,4,wsk);
sfClock_Reset(zegar);
}
if (Dol == sfTrue)
{
OffsetY += Offset;
sfSprite_Move(wsk->duszek, 0, OffsetY);
PlayUstalone(8,12,wsk);
sfClock_Reset(zegar);
}
}
czas = sfClock_GetTime(zegar);
if (czas > 2.1f)
{
Stop(wsk);
}
But when I hold key it doesn't animat itself but it animate itself when I realease key. I want to animate all the time when i HOLD key, Can someone tell me how to do this?
Could someone tell me how do You manage moving?