-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.h
41 lines (31 loc) · 995 Bytes
/
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
33
34
35
36
37
38
39
40
41
#pragma once
#include "BulletType.h"
#include "Sprite.h"
class Bullet;
class Item;
class Player : public Sprite {
inline static const float DefaultPlayerSpeed = 350;
inline static const Vector2f DefaultPlayerSizePercent = Vector2f( .05 );
inline static const float DefaultPlayerBulletSpeed = 500;
int lives = 3;
inline static const int DefaultMaxBullets = 1;
int maxBullets = DefaultMaxBullets;
BulletType weapon = BulletType::PlayerNormal;
bool shielded = 0;
public:
Player();
void update( float t ) override;
void die() override;
inline int getMaxBullets() const { return maxBullets; }
bool canPlayerRespawn();
inline int getNumLivesRemaining() const { return lives; }
inline bool isOutOfLives() const { return lives <= 0; }
void respawn();
void addShield();
void loseShield();
void onHit( ICollideable *o ) override;
void giveItem( shared_ptr<Item> item );
void tryShoot();
void setMovingLeft();
void setMovingRight();
};