Workey! :3 (also added a suprise tool that wil help us later)
parent
67d5830da5
commit
59560ced66
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
|
@ -13,4 +13,9 @@ class Game
|
||||||
private:
|
private:
|
||||||
sf::RenderWindow mWindow;
|
sf::RenderWindow mWindow;
|
||||||
sf::CircleShape mPlayer;
|
sf::CircleShape mPlayer;
|
||||||
|
|
||||||
|
bool mIsMovingUp{false};
|
||||||
|
bool mIsMovingDown{false};
|
||||||
|
bool mIsMovingLeft{false};
|
||||||
|
bool mIsMovingRight{false};
|
||||||
};
|
};
|
||||||
|
|
|
@ -67,13 +67,13 @@ void Game::update(sf::Time deltaTime)
|
||||||
{
|
{
|
||||||
sf::Vector2f movement(0.f, 0.f);
|
sf::Vector2f movement(0.f, 0.f);
|
||||||
if (mIsMovingUp)
|
if (mIsMovingUp)
|
||||||
movement.y -= 1.f;
|
movement.y -= 100.f;
|
||||||
if (mIsMovingDown)
|
if (mIsMovingDown)
|
||||||
movement.y += 1.f;
|
movement.y += 100.f;
|
||||||
if (mIsMovingLeft)
|
if (mIsMovingLeft)
|
||||||
movement.x -= 1.f;
|
movement.x -= 100.f;
|
||||||
if (mIsMovingRight)
|
if (mIsMovingRight)
|
||||||
movement.x += 1.f;
|
movement.x += 100.f;
|
||||||
|
|
||||||
mPlayer.move(movement * deltaTime.asSeconds());
|
mPlayer.move(movement * deltaTime.asSeconds());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue