-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.h
67 lines (57 loc) · 780 Bytes
/
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
#include "DarkGDK.h"
void drawJimmies(int jimmies,int size) //draws the jimmy spectrum on screen
{
dbBox(0,0,jimmies,size);
}
//This is the player class
class gorillaMunch
{
public:
int gx;
int gy;
gorillaMunch(char *image)
{
gx = dbScreenWidth()/2;
gy = dbScreenHeight()/2;
dbLoadImage(image,1);
dbSprite(1,gx,gy,1);
dbScaleSprite(1,20);
}
void move()
{
if(dbUpKey())
{
gy--;
}
if(dbDownKey())
{
gy++;
}
if(dbLeftKey())
{
gx--;
}
if(dbRightKey())
{
gx++;
}
//make sure we don't go off of the screen
if(gx >= dbScreenWidth()-50)
{
gx = gx-1;
}
if(gx <= 0)
{
gx = gx+1;
}
if(gy <=0)
{
gy = gy+1;
}
if(gy >= dbScreenHeight()-70)
{
gy = gy-1;
}
dbSprite(1,gx,gy,1);
}
};