-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathReadySetPlant.java
48 lines (47 loc) · 1.25 KB
/
ReadySetPlant.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
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class ReadySetPlant here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class ReadySetPlant extends animatedObject
{
public GreenfootImage[] ready;
public GreenfootImage[] set;
public GreenfootImage plant;
public boolean r = true;
public boolean s = true;
public boolean p = true;
public int counter;
public ReadySetPlant() {
ready = importSprites("Ready__",11);
set = importSprites("Set__",12);
plant = new GreenfootImage("PLANT!.png");
}
public void act()
{
if (frame <= 11 && counter < 60) {
if (r) {
animate(ready, 40, false);
} else if (s) {
animate(set, 40, false);
} else if (p) {
setImage(plant);
counter++;
}
} else {
if (r) {
r = false;
frame = 0;
} else if (s) {
s = false;
frame = 0;
} else if (p) {
p = false;
getWorld().removeObject(this);
return;
}
}
}
}