Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package
- {
- import net.flashpunk.Entity;
- import net.flashpunk.graphics.Spritemap;
- import net.flashpunk.utils.Input;
- import net.flashpunk.utils.Key;
- import net.flashpunk.FP;
- public class EnemyEntity extends Entity
- {
- //[Embed(source = 'assets/soldier spear.png')] private const SOLDIER:Class;
- public var sprSoldier:Spritemap = new Spritemap(GC.SOLDIER, 256, 256);
- public var attacking:Boolean = true;
- public static var dead:Boolean = false;
- public function EnemyEntity()
- {
- sprSoldier.add("attack", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 42], 30, true);
- sprSoldier.add("die", [19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41], 30, false);
- graphic = sprSoldier;
- sprSoldier.play("attack");
- setHitbox(80, 100, -80, -100);
- type = GC.TYPE_ENEMY;
- }
- override public function update():void
- {
- if (!dead)
- {
- x -= GC.ENEMY_SPEED;
- }
- if (this.x <= GameWorld.player.x - 200)
- {
- this.world.remove(this);
- }
- if (this.collideWith(GameWorld.player, x, y))
- {
- if (MyEntity.attacking == true)
- {
- //dead = true;
- this.sprSoldier.play("die");
- }
- }
- /*if (dead == true)
- {
- this.sprSoldier.play("die");
- }else
- {
- this.sprSoldier.play("attack");
- }*/
- super.update();
- }
- }
- }
Add Comment
Please, Sign In to add comment