-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.h
63 lines (46 loc) · 1.3 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
#pragma once
#include <vector>
#include "Model_3DS.h"
#include "util.h"
class Player
{
public:
std::vector<GroundInfo>* groundArray;
float angle = 180.0f;
double curX = 0, curY = 0.02, curZ = -0.55;
Direction curDirection = NEGATIVE_Z;
double STEP_SIZE = 0.005;
double LEAN_STEP_SIZE = 0.05;
bool keys[256] = {};
bool specialKeys[256] = {};
int curGround = 0;
bool goingUp = false;
bool isFalling = false;
double curHeight = 0;
double maxHeight = 0.07;
double curJumpStep = 0.0001;
int coins = 0;
int shieldRemainingTime = 0;
bool gotShield = false;
Model_3DS playerModel = Model_3DS(curX, curY, curZ, 0.0005, 0.0005, 0.0005, 0, 0, 0);
Player(std::vector<GroundInfo> *grounds) {
playerModel.Load("models/player/Male1.3ds");
groundArray = grounds;
}
Direction getRightDirection();
Direction getLeftDirection();
bool canTurn(Direction targetDirection);
void leanRight();
void leanLeft();
void rotatePlayer();
void gotoNextGround();
void fall();
void keyDown(char c);
void keyUp(char c);
void specialKeyDown(int c);
void specialKeyUp(int c);
void mouseFunc(int button, int state, int x, int y);
void motionFunc(int x, int y);
void tick();
void draw();
};