23class GameLayer final :
public Layer {
25 GameLayer() : Layer(49), m_camera(CameraType::Orthographic), m_cameraController(m_camera) {}
27 void onAttach()
override;
28 void onUpdate(
DeltaTime deltaTime)
override;
29 bool onEvent(
const ZenEvent &event)
override;
30 void onGUIRender()
override;
36 void emitCollisionEffect();
40 void updateGamePaused(
DeltaTime deltaTime);
43 void checkCollisions();
48 std::unique_ptr<ParticleSystem> m_particleSystem;
51 std::vector<Obstacle> m_obstacles;
53 std::shared_ptr<Shader> m_shader;
56 bool m_playerEmitTrail =
true;
57 bool m_obstacleEmitTrail =
true;
58 bool m_emitJumpBurst =
true;
60 glm::vec2 m_groundSize = {30.0f, (5.625f * 2)};
61 glm::vec2 m_groundPos = {0, -5.625f};
62 glm::vec4 m_groundColour = {0.2f, 0.2f, 0.18f, 1.0f};
64 GameState m_gameState = GameState::Playing;
66 float m_highScore = 0.0f;
67 float m_gameSpeed = 1.0f;
69 float m_spawnTimer = 0.0f;
70 float m_spawnInterval = 2.0f;
71 float m_minSpawnInterval = 0.8f;
72 float m_speedIncreaseRate = 0.05f;
74 int m_nextObstacleIndex = 0;
76 ObstacleType getRandomObstacleType();