-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheye.cpp
More file actions
92 lines (72 loc) · 1.78 KB
/
Copy patheye.cpp
File metadata and controls
92 lines (72 loc) · 1.78 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
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
#include "eye.h"
Eye::Eye(int x,int y):Ninja(x,y,0)
{
Ninja::Block::image.load("eye.png");
image1.load("eye1.png");
Ninja::image2.load("eye2.png");
Ninja::image3.load("eye3.png");
Ninja::image4.load("eye4.png");
image5.load("eye5.png");
image6.load("eye6.png");
image7.load("eye7.png");
image8.load("eye8.png");
image9.load("eye9.png");
trumpet.load("trumpet.png");
life.load("life.png");
key.load("key.png");
Block::rect = image.rect();
Block::resetState(x,y);
}
void Eye::flow(int y){
if(y<Block::rect.top()){Ninja::ydir=-1; }
else if(y>Block::rect.bottom()){Ninja::ydir=1; }
else Ninja::ydir=0;
}
void Eye::lr(int x){
if(x<Block::rect.left()){Block::setXDir(-1); }
else if(x>Block::rect.right()){Block::setXDir(1); }
else Block::setXDir(0);
}
int Eye::getQUAD(int x,int y){//find what picture to use and return pic number
lr(x);
flow(y);
x=Ninja::Block::getXDir();
y=Ninja::ydir;
if(x==1&&y==-1)return 2;//top right view
if(x==-1&&y==-1)return 4;//left top view
if(x==-1&&y==1)return 6;//bottomw left view
if(x==1&&y==1)return 8;//bottom right view
if(x==-1&&y==0)return 5;//left
if(x==0&&y==-1)return 3;//up
if(x==1&&y==0)return 1;//right
if(x==0&&y==1)return 7;//down
else return 0;
}
QImage & Eye::getImage2(int step){
if(step==0)
return Block::image;
if(step==1)
return image1;
if(step==2)
return Ninja::image2;
if(step==3)
return Ninja::image3;
if(step==4)
return Ninja::image4;
if(step==5)
return image5;
if(step==6)
return image6;
if(step==7)
return image7;
if(step==8)
return image8;
if(step==9)
return image9;
if(step==64)
return trumpet;
if(step==100)
return life;
if(step==12)
return key;
}