Zen 0.3.0
Loading...
Searching...
No Matches
Obstacle.h
1#pragma once
2#include "particles/ZEN_ParticleSystem.h"
3#include <glm/glm.hpp>
4#include <zen/time/ZEN_DeltaTime.h>
5
6enum class ObstacleType {
7 SmallBox,
8 TallBox,
9 FlyingBox
10};
11
12class Obstacle {
13public:
14 glm::vec2 pos{12.0f, 0.0f};
15 glm::vec2 size{1.0f, 1.0f};
16 glm::vec4 colour{1.0f, 0.5f, 0.0f, 1.0f};
17
18 ObstacleType type = ObstacleType::SmallBox;
19 float speed = 5.0f; // units/s
20 bool active = true;
21
23 {0, 0},
24 {1, 1},
25 {1, 1, 1, 1}
26 };
27
28 Obstacle(ObstacleType t, float x = 12.0f);
29
30 void update(Zen::DeltaTime dt);
31 void reset(float x = 12.0f);
32
33 // Simple AABB collision
34 bool collidesWith(const glm::vec2 &otherPos, const glm::vec2 &otherSize) const;
35
36 // Get bottom Y position (for ground vs flying)
37 float getBottomY() const { return pos.y - size.y * 0.5f; }
38};