-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.h
127 lines (109 loc) · 1.53 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#ifndef PLAYER_H
#define PLAYER_H
#include <QImage>
#include <iostream>
#include <QRect>
class player
{
private:
QImage image;
QImage image2;
QRect hunt;
//QRect hunt2;
bool destroyed;
bool giant;
bool shoes;
public:
player()
{
//destroyed =FALSE;
//giant=FALSE;
image.load("image/hunter.png");
image2.load("image/superman.png");
hunt =image.rect();
//hunt2=image.rect();
initialposition();
//giant=FALSE;
//destroyed =FALSE;
}
void initialposition()
{
hunt.moveTo(0,0);
}
void moveup(int x, int y)
{
if(hunt.top() <0)
{
y=499;
hunt.moveTop(y);
}
else
hunt.moveTo(x,y);
}
void movedown(int x, int y)
{
if(hunt.bottom()>499)
{ y=0;
hunt.moveBottom(y);
}
else
hunt.moveTo(x,y);
}
void moveleft(int x,int y)
{
if(hunt.left()<0)
{
x =499;
hunt.moveLeft(x);
}
else
hunt.moveTo(x,y);
}
void moveright(int x,int y)
{
if(hunt.right()>499)
{
x=0;
hunt.moveRight(x);
}
else
hunt.moveTo(x,y);
}
bool destoryplayer()
{
return destroyed;
}
void setdestoryed(bool dest)
{
destroyed =dest;
}
void setgiant(bool big)
{
giant =big;
}
bool giantplayer()
{
return giant;
}
void setshoes(bool fast)
{
shoes =fast;
}
bool fastplayer()
{
return shoes;
}
QImage & getImage()
{
return image;
}
QImage & getImage2()
{
return image2;
}
QRect gethunt()
{
return hunt;
}
};
#endif