0 Members and 2 Guests are viewing this topic.
What's the best way to find and move the X and Y position of a sprite?
And i can i use a vector for Velocity of this sprite.
sprite.Move(velocity * elapsedTime);
Code: [Select]sprite.Move(velocity * elapsedTime);
player.Move(subVelocity * elapsedTime);
Increase/decrease the velocity? Use an if statement? :idea:If you don't know how to react to keyboard input, you should read the tutorials.
if (App.GetInput().IsKeyDown(sf::Key::D)){if(player.getEnergy()>100){if(player.getPositionX()!= (game.getWidth()- 100)) { player.Move(subVelocity * elapsedTime); player.setEnergy(player.getEnergy()-1); }}}