-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathWetTurtle.java
53 lines (48 loc) · 1.25 KB
/
WetTurtle.java
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
package p4_group_8_repo;
import javafx.scene.image.Image;
public class WetTurtle extends Actor{
Image turtle1;
Image turtle2;
Image turtle3;
Image turtle4;
private int speed;
int i = 1;
boolean bool = true;
boolean sunk = false;
@Override
public void act(long now) {
if (now/900000000 % 4 ==0) {
setImage(turtle2);
sunk = false;
}
else if (now/900000000 % 4 == 1) {
setImage(turtle1);
sunk = false;
}
else if (now/900000000 %4 == 2) {
setImage(turtle3);
sunk = false;
} else if (now/900000000 %4 == 3) {
setImage(turtle4);
sunk = true;
}
move(speed , 0);
if (getX() > 600 && speed>0)
setX(-200);
if (getX() < -75 && speed<0)
setX(600);
}
public WetTurtle(int xpos, int ypos, int s, int w, int h) {
turtle1 = new Image("file:src/p4_group_8_repo/TurtleAnimation1.png", w, h, true, true);
turtle2 = new Image("file:src/p4_group_8_repo/TurtleAnimation2Wet.png", w, h, true, true);
turtle3 = new Image("file:src/p4_group_8_repo/TurtleAnimation3Wet.png", w, h, true, true);
turtle4 = new Image("file:src/p4_group_8_repo/TurtleAnimation4Wet.png", w, h, true, true);
setX(xpos);
setY(ypos);
speed = s;
setImage(turtle2);
}
public boolean isSunk() {
return sunk;
}
}