-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayer.h
More file actions
39 lines (33 loc) · 772 Bytes
/
Copy pathplayer.h
File metadata and controls
39 lines (33 loc) · 772 Bytes
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
#ifndef PLAYER_H
#define PLAYER_H
#include <QGraphicsPixmapItem>
#include <QObject>
#include <QTimer>
class Player:public QObject, public QGraphicsPixmapItem{
Q_OBJECT
public:
//constructor
Player(QGraphicsItem *parent=0);
//public member function
//walk and jump
void moveright();
void moveleft();
void setwalkstate(int w){walkstate=w;}
void moveautomatically();
void jump();
void keyPressEvent(QKeyEvent *event);
//public attributes
QImage walkpix[12];
public slots:
void walkauto();
void walkright();
void walkleft();
void jumpup();
private:
int direction;
int walkstate;
float yspeed;
int isjumping;
QTimer *jumptimer;
};
#endif // PLAYER_H