-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpolyp.cpp
More file actions
61 lines (45 loc) · 1.07 KB
/
Copy pathpolyp.cpp
File metadata and controls
61 lines (45 loc) · 1.07 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
#include "polyp.h"
polyp::polyp(int16_t xStart, int16_t yStart, uint8_t direct){
x = xStart;
y = yStart;
spriteDirection = direct;
growCounter = 0;
if(spriteDirection == 1){
tentX = x- 2;
tentY = y- 4;
}
else if (spriteDirection == 0){
tentX = x+10;
tentY = y -4;
}
}
void polyp::setDirection(){
if (playerDirection == left){
spriteDirection = 1;
tentX = x- 2;
tentY = y- 4;
}
else if (playerDirection == right){
spriteDirection = 0;
tentX = x+10;
tentY = y -4;
}
}
void polyp::drawPolyp(){
sprite.drawExternalMask(x, y, polypBMP, polupMask, spriteDirection, spriteDirection);
if(spriteDirection == 1){
sprite.drawSelfMasked(tentX, tentY, polupTentacles, spriteDirection);}
else if (spriteDirection == 0){
sprite.drawSelfMasked(tentX, tentY, polupTentacles, spriteDirection);}
}
void polyp::updatePolyp(){
setDirection();
if(frameCounter % 15 == 0 ){
growCounter++;
}
if (growCounter > 30){
frameCounter = 0;
enteringStage = true;
GameStage = Strobilate;
}
}