-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBoxGoal.java
40 lines (34 loc) · 844 Bytes
/
BoxGoal.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
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class BoxGoal here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class BoxGoal extends GameObj
{
public void created() {
getWorld().openGoal();
}
public boolean solidAgainst(GameObj obj) {
return false;
}
public boolean solidAgainstPost(GameObj obj) {
if (obj instanceof Box) {
getWorld().closeGoal();
Sound.drop.play();
}
return false;
}
public void onLeave(GameObj obj) {
if (obj instanceof Box) {
getWorld().openGoal();
}
}
public int getRenderOrder() {
return GameObj.R_Bck;
}
public int getId() {
return 18;
}
}