-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathKey.java
35 lines (30 loc) · 845 Bytes
/
Key.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
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Key here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Key extends GameObj
{
public boolean solidAgainst(GameObj obj) {
return !(obj instanceof Pushy || obj instanceof LaserRay);
}
public boolean solidAgainstPost(GameObj obj) {
if (obj instanceof Pushy) {
remove();
obj.extraData.putInt("Key", obj.extraData.getInt("Key")+1);
Sound.drop.play();
}
return false;
}
public boolean pushable(GameObj obj) {
return (obj instanceof PowerPistonHead);
}
public int getId() {
return 33;
}
public int getRenderOrder() {
return GameObj.R_Bck;
}
}