forked from lehmanad1/Comp441Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Slime.h
84 lines (66 loc) · 1.98 KB
/
Slime.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
78
79
80
81
82
83
84
#define WIN32_LEAN_AND_MEAN
#ifndef _SLIME_H // Prevent multiple definitions if this
#define _SLIME_H
class Slime;
#include "entity.h"
#include "enemy.h"
#include "constants.h"
namespace slimeNS
{
const int WIDTH = 62; // image width
const int HEIGHT = 62; // image height
const int X = GAME_WIDTH/2 - WIDTH/2; // location on screen
const int Y = GAME_HEIGHT/2 - HEIGHT/2;
const float SPEED = 100;
const int frameCompensation = 40;
}
class Slime: public Enemy
{
protected:
bool collision;
bool target;
//gamestate checkers
bool jumpLeft;
bool jumpRight;
bool jumpStatLeft;
bool jumpStatRight;
bool landing;
bool canJump;
float secondsPassed;
float secondsJumped;
public:
Slime();
// inherited member functions
void update(float frameTime);
// Set collision Boolean
void setCollision(bool c)
{collision = c;}
// Set collision type (NONE, CIRCLE, BOX, ROTATED_BOX)
void setCollisionType(entityNS::COLLISION_TYPE ctype)
{collisionType = ctype;}
// Set RECT structure used for BOX and ROTATED_BOX collision detection.
void setEdge(RECT e) {edge = e;}
/*********HOMEGROWN FUNCTIONS*********/
//less typing
int getScaledWidth(){return (int)(getWidth()*getScale());}
int getRightEdge(){return (int)(getX()+getScaledWidth());}
int getScaledHeight(){return (int)(getHeight()*getScale());}
//Character State Checks
bool isJumpingLeft(){return jumpLeft;}
bool isJumpingRight(){return jumpRight;}
bool isLanding(){return landing;}
void ai(float frameTime, Entity &ent);
// Get collision
bool getCollision() {return collision;}
int getHealth() {return health;}
void jump(int direction);
void fall(){landing=true;}
void land(){
landing=false;
}
void updateFall(float frameTime);
void updateJump(float frameTime);
// Get collision type
entityNS::COLLISION_TYPE getCollisionType() {return collisionType;}
};
#endif