-
Notifications
You must be signed in to change notification settings - Fork 2
/
player.h
57 lines (48 loc) · 1 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once
#include <SDL.h>
#include <SDL_image.h>
#include "Input.h"
#include "Texture.h"
#include "Vector2.h"
#include "Weapons.h"
#include "Audio.h"
class Player
{
public:
Player(SDL_Renderer *renderer, Audio *Audio);
~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();
void checkBoundaries();
Uint32 lastShotTime;
Uint32 currentTime;
double shotInterval;
int getMoveSpeed();
void movePlayer();
double playerHealth;
Texture playerTexture;
SDL_Texture *playerTextureRenderable;
SDL_Rect SpriteClips[1];
Texture RenderTexture;
Mix_Chunk* shootSound;
//vector2 to hold position.
Vector2 position;
Vector2 playerCenter;
//Vector2 bulletPos;
Vector2* mousePosition;
float width;
float height;
float moveSpeed;
float maxMoveSpeed;
Vector2 velocity;
Weapons *blaster;
//Player rotation in degrees
double angle;
};