/
SheGoat.as
43 lines (39 loc) · 1.09 KB
/
SheGoat.as
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
package{
import flash.utils.*;
public class SheGoat extends Item{
public static var isAnimal:Boolean = true
public function SheGoat(related_node:Node) {
super(related_node, true)
tile = 218;
sheetClass = charSheetClass
emptyTile = 461
scaleX = 4
scaleY = 4
bits = 8
useable = true
takeable = false
deadAnimalClass = DeadSheGoat
health = 3
}
override public function useItem(stage:Object, used:Item):Boolean{
if(animal != null){
animal.attacked = true
}
stage.updateEnergy(-10);
var random:int = Math.floor(Math.random() * 3);
if(random < 1){
removeAnimal(stage)
node.addItem(new DeadGoat(node), stage);
}
return false
}
override public function move(stage:Object):void{
var random:int = Math.floor(Math.random() * 1000);
if(random < 1){
stage.world.animals.push(new Animal(SheKid, animal.x, animal.y, node))
} else if(random < 2){
stage.world.animals.push(new Animal(Kid, animal.x, animal.y, node))
}
}
}
}