-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.h
33 lines (28 loc) · 1.01 KB
/
Player.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once
#include "Renderables.h"
#include "Decorations.h"
class Player : public Renderable
{ using base = Renderable;
static inline float ShootEnergyMax = 100.0f;
static inline float ShotCost = 25.0f;
bool reloaded = true;
bool active = true;
float shoot_energy = ShootEnergyMax;
float thrust_orientation = {}; // Last orientation before using thrusters, makes strafing less confusing
float thrust_fx_timer = 0;
static constexpr float thrust_fx_tick = 2.0f;
Decoration crosshair{ GetSprites().Glyphs['o'], {}, Size{20, 15} };
public:
Player() : Renderable(GetSprites().Player, {}, {}) { active = false; }
Player(const Sprite& sprite, const Position& base, const Size& size)
: Renderable(sprite, base, size)
{ }
EntityType GetType() const override { return EntityType::Player; }
bool IsActive() const { return active; }
void Advance(float delta) override;
void Render() override;
void Collide(const Entity& other) override;
private:
void HandleShoot(float delta);
void HandleMovement(float delta);
};