Zen 0.3.0
Loading...
Searching...
No Matches
Player.h
1#pragma once
2#include <glm/glm.hpp>
3#include <particles/ZEN_ParticleSystem.h>
4#include <zen/time/ZEN_DeltaTime.h>
5
6class Player {
7public:
8 glm::vec2 pos{0.0f, 0.0f};
9 float vy = 0.0f;
10
11 float gravity = -50.0f; // units/s^2
12 float jumpPower = 18.0f; // units/s
13 float width = 1.0f;
14 float height = 1.0f;
15 glm::vec4 colour = {1.0f, 0.0f, 0.0f, 1.0f};
16
18 {0, 0},
19 {1, 1},
20 {1, 1, 1, 1}
21 };
22
23 bool onGround() const;
24 void update(Zen::DeltaTime deltaTime, bool jumpPressed);
25
26 bool wasOnGround() const { return m_wasOnGround; }
27 bool justJumped() const { return m_justJumped; }
28 glm::vec2 getSize() const { return {width, height}; }
29
30private:
31 bool m_wasOnGround = true;
32 bool m_justJumped = false;
33};
Definition Player.h:6