-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.h
77 lines (62 loc) · 1.72 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#pragma once
#include <iostream>
#include <vector>
#include <unistd.h>
#include "Entity.h"
#include "Global.h"
#include "Utilities.h"
/*
PLAYER CLASS
Constructor's parameters:
- Global* global
About this class:
- The player suffers by drag;
- The player accelerates due to the external inputs;
- The player has a combo mode;
- The player makes sounds when jumping;
- The player bounces off walls and platforms;
- The player changes sprites so it looks like it's running;
- The player interacts with the players camera.
*/
class Player
{
private:
//Variables
//Global variables
Global* global;
//Custom constants (maxEntities, maxSize...)
float accelValue, deaccelFactor;
float minJumpVelValue;
float minSpriteScreenSpeed;
float grav;
//Game logic (counters, nEntities...)
float animationCounter, comboCounter, comboCounterAux;
float jumpVelValue;
float spriteScreenSpeed;
int prevFloor, curFloor, maxFloor;
bool playerIsOnPlatform;
bool justJumped, didJumped, justLanded;
bool comboOn, comboSide;
//Game objects
Entity* entity;
//Private functions
void initVariables();
void initEntityObjects();
public:
//Constructors / Destructors
Player(Global* global);
virtual ~Player();
//Accessors
Utilities utilities;
Entity* getEntity();
void setPlayerStatus(bool playerIsOnPlatform, int newCurFloor);
//Functions
void gravity(float dt);
void movementComboAndSounds(float dt);
void interactions();
void animationEffects(float dt);
void playersCameraSetting(float dt);
//Main functions
void update(float dt);
void render(sf::RenderTarget* target);
};