-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathplayer.h
54 lines (48 loc) · 1.14 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
/*
* Author: equati0n
* Date: December 2016
*/
#ifndef PLAYER_H
#define PLAYER_H
#include <QGraphicsItem>
#include <QPixmap>
class Player : public QGraphicsItem
{
public:
Player(QGraphicsItem *parent = 0);
~Player();
int direction() const;
int standingDirection() const;
void addStandingDirection(int standingDirection);
void addDirection(int direction);
void nextFrame();
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
bool isTouchingFoot(QGraphicsItem *item);
bool isTouchingHead(QGraphicsItem *item);
bool isTouchingPlatform(QGraphicsItem *item);
void stand();
void jump();
void standShoot();
void walk();
void fall();
bool isFalling();
private:
enum State {
Standing = 0,
StandShoot,
Walking,
Jumping,
Falling
};
int m_direction;
int mCurrentFrame;
int m_StandingDirection;
State mState;
QPixmap mPixmap;
QPixmap mWalkPixmap;
QPixmap mStandingPixmap;
QPixmap mJumpPixmap;
QPixmap standShootPixmap;
};
#endif // PLAYER_H