-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.h
56 lines (47 loc) · 939 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include <SDL.h>
#include <SDL_image.h>
#include "Input.h"
#include "Texture.h"
#include "vector2.h"
#include "Weapon.h"
enum Axis {
X,
Y
};
class Player
{
public:
Player(SDL_Renderer *renderer);
~Player();
void Update();
SDL_Texture* GetPlayerTexture();
void Render(SDL_Renderer *renderer);
void HandleInput(Input *input);
Vector2 GetPosition() const;
bool IsDead = false;
double SpriteAngle;
private:
void shoot();
Uint32 lastShotTime;
Uint32 currentTime;
double shotInterval = 250;
int getMoveSpeed();
void movePlayer(Axis axis, int moveAmount);
double playerHealth;
Texture playerTexture;
SDL_Texture *SDLTexture;
SDL_Rect SpriteClips[1];
Texture RenderTexture;
//vector2 to hold position.
Vector2 position;
Vector2 playerCenter;
//Vector2 bulletPos;
Vector2* mousePosition;
float width;
float height;
int moveSpeed;
Weapon *blaster;
//Player rotation in degrees
double angle;
};