-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSkeleton.java
More file actions
42 lines (38 loc) · 984 Bytes
/
Copy pathSkeleton.java
File metadata and controls
42 lines (38 loc) · 984 Bytes
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
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Skeleton is Move in straight line, cannot be healed by ambulance,can be revived by halloween effect.
*
* @author Yixin Cai
* @version 2022-10-24
*/
public class Skeleton extends Pedestrian
{
/**
* Constructor of Skeleton
* @param direction The int that represents the direction
*/
public Skeleton(int direction) {
super();
// choose a random speed
maxSpeed = Math.random() * 2 + 1;
speed = maxSpeed;
// start as awake
awake = true;
this.direction = direction;
gifImage = new GifImage("skeleton.gif");
}
/**
* Skeleton cannot be healed. Override healMe() in supercalss.
*/
@Override
public void healMe () {
}
/**
* Revive skeleton
*/
public void revive() {
awake = true;
speed = maxSpeed;
setRotation(0);
}
}