-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPlayer.h
52 lines (44 loc) · 1.15 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
#ifndef _PLAYER_H_
#define _PLAYER_H_
#include <cmath>
#include <string>
#include <vector>
using namespace std;
class Player
{
private:
double x;
double y;
string image;
int width{60 / 2};
int height{96 / 2};
int screenWidth;
int screenHeight;
int tileSize;
double vx;
double vy;
int canjump;
double frame;
double animationSpeed;
double gravity;
double jumpHeight;
double xSpeed;
string dir;
bool checkIntersection(vector<double> platformX, vector<double> platformY);
void MovePlayer(double sx, double sy, vector<double> platformX, vector<double> platformY);
void SetCostume();
void PositionPlayer();
public:
Player(int width, int height, int tileSize);
void RespawnPlayer();
void tick(bool left, bool right, bool jump, vector<double> platformX, vector<double> platformY, double time);
double getX() const { return x; }
void setX(int newX) { x = newX; }
double getY() const { return y; }
void setY(int newY) { y = newY; }
string getImage() const { return image; }
void setImage(string newImage) { image = newImage; }
int getWidth() const { return width; }
int getHeight() const { return height; }
};
#endif