-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonster.cpp
More file actions
executable file
·55 lines (42 loc) · 1.02 KB
/
monster.cpp
File metadata and controls
executable file
·55 lines (42 loc) · 1.02 KB
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
#include "monster.h"
Monster::Monster(int initHealth, QPoint p,
QPair<qreal,qreal> initVelocity, QPair<qreal,qreal> jump_on_Velocity){
boundingRect().setRect(-5,-5,60,60);
health = initHealth;
velocity = initVelocity;
jumpOnVelocity = jump_on_Velocity;
moveBy(p.x(),p.y());
}
void Monster::bounce(qreal vel){
velocity.second = vel;
}
void Monster::push(qreal vel){
velocity.first = vel;
}
void Monster::addDirection(int dir){
direction += dir;
direction = qBound(-1,direction,1);
setTransformOriginPoint(25, 50);
if (direction == 1){
setTransform(QTransform());
spriteReversed = false;
}else if (direction == -1){
QTransform trans;
trans.scale(-1,1);
trans.translate(-50,0);
setTransform(trans);
spriteReversed = true;
}
}
void Monster::minusHealth(){
health--;
}
void Monster::update(){
}
void Monster::nextFrame(){
}
void Monster::remove(){
}
void Monster::setupRemove(){
m_bRemove = true;
}