Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private var goblin1:Goblin = new Goblin();
- private var goblin2:Goblin = new Goblin();
- private var goblin3:Goblin = new Goblin();
- private var aGoblinArray = new Array(container.goblin1, container.goblin2, container.goblin3);
- for (var i:int = 0; i < aGoblinArray.length; i++)
- {
- var goblin:Goblin = aGoblinArray[i];
- }
- if (goblin.hitTestPoint(_character.x + 100, _character.y - 45, true))
- {
- goblinCanMove = false;
- trace("lance hits");
- //hitOnce
- if (!hitOnce)
- {
- hitOnce = true;
- trace("take on damage");
- }
- goblin.moveBack();
- goblin.minusHealth();
- }
- public static var goblinLife; int;
- goblinLife = 2;//put in main constructor
- public function minusHealth():void
- {
- goblinLife --;
- checkDeath();
- }
- private function checkDeath():void
- {
- if (goblinLife == 0)
- {
- parent.removeChild(this);
- }
- }
- public static var goblinLife; int;
- private var goblinLife; int;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement