-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlayer.h
More file actions
52 lines (47 loc) · 1.78 KB
/
Copy pathPlayer.h
File metadata and controls
52 lines (47 loc) · 1.78 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
#include "raylib.h"
#include "Bullet.h"
#include "Enemy.h"
#include <vector>
class Effects;
enum class WeaponType { Vulcan, Plasma, Missile };
class Player {
public:
Vector2 pos{240, 560};
float spriteRadius = 16.0f;
float hitRadius = 4.0f;
int lives = 3;
int bombs = 3;
int score = 0;
int weaponLevel = 1;
WeaponType weapon = WeaponType::Vulcan;
bool invulnerable = false;
float invulnTimer = 0.0f;
bool isDemo = false;
bool triggerBomb_ = false;
float animationTime = 0.0f;
int controlLayout = 0;
float tilt_ = 0.0f; // Horizontal banking/tilt animation state
float muzzleFlashTimer_ = 0.0f; // Screen duration timer for weapon fire sparks
float recoilOffset_ = 0.0f; // Recoil shift offset
float recoilVel_ = 0.0f; // Recoil speed velocity for spring physics
float scaleY_ = 1.0f; // Squash/stretch recoil scaling factor
float scaleYVel_ = 0.0f; // Scale elasticity speed velocity for spring physics
float heat_ = 0.0f; // Wing vent heat level for ember particles
Vector2 pastPositions_[8]{}; // Ring buffer of past positions for ghost trails
int positionCount_ = 0; // Count of elements in the past positions buffer
void ResetForNewGame();
void ResetAfterHit();
void Update(float dt, Effects& effects, const std::vector<Enemy>& enemies = {}, const std::vector<Bullet>& enemyBullets = {});
void Draw(bool debug) const;
void TryShoot(std::vector<Bullet>& playerBullets);
bool BombPressed() const;
bool TryBomb();
void NextWeapon();
void UpgradeWeapon();
const char* WeaponName() const;
private:
float shootTimer_ = 0.0f;
bool pointerControlActive_ = false;
float pointerIdleTimer_ = 0.0f;
};