Implement moving the player
Player: Add rotation and linear speeds, as well as their current state. Player: Allow to move in the local coordinates and compute world-speed equivalent. Player: Update movement axis while rotating. World: Add a function to advance a step. Main: Handle key events, add world step in the main loop.
This commit is contained in:
parent
b359ff171f
commit
804f0272f8
5 changed files with 80 additions and 3 deletions
8
World.h
8
World.h
|
@ -30,11 +30,17 @@ public:
|
|||
int getW() const;
|
||||
int getH() const;
|
||||
|
||||
BlockType getBlock(float x, float y) const;
|
||||
inline BlockType getBlock(float x, float y) const;
|
||||
void setBlock(BlockType block, int x, int y, int width = 1, int height = 1);
|
||||
|
||||
void render(sf::RenderWindow&) const;
|
||||
|
||||
/**
|
||||
* Move the world one step forward.
|
||||
* @param stepTime delta time since last step, in seconds
|
||||
*/
|
||||
void step(const float& stepTime);
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& ostream, World const & world);
|
||||
private:
|
||||
int w;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue