mirror of
https://github.com/theoleuthardt/DinoGame.git
synced 2026-06-13 09:27:57 +00:00
feat: dino class for drawing, updating and managing the player object
This commit is contained in:
parent
da4c292fbd
commit
10194544f3
2 changed files with 53 additions and 0 deletions
22
src/Dino.hpp
Normal file
22
src/Dino.hpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#ifndef DINO_HPP
|
||||
#define DINO_HPP
|
||||
#include "raylib.h"
|
||||
|
||||
class Dino {
|
||||
public:
|
||||
explicit Dino(Texture2D texture);
|
||||
void Jump();
|
||||
void Update();
|
||||
void Draw();
|
||||
Rectangle GetRect();
|
||||
|
||||
private:
|
||||
Texture2D texture;
|
||||
Rectangle rect;
|
||||
float velocityY;
|
||||
bool isJumping;
|
||||
static constexpr float GRAVITY = 0.4;
|
||||
static constexpr float JUMP_STRENGTH = -10;
|
||||
};
|
||||
|
||||
#endif //DINO_HPP
|
||||
Loading…
Add table
Add a link
Reference in a new issue