daily pastebin goal
13%
SHARE
TWEET

Untitled

a guest Apr 19th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package
  2. {
  3.     import net.flashpunk.Entity;   
  4.     import net.flashpunk.graphics.Spritemap;
  5.     import net.flashpunk.utils.Input;
  6.     import net.flashpunk.utils.Key;
  7.     import net.flashpunk.FP;
  8.    
  9.     public class EnemyEntity extends Entity
  10.     {
  11.         //[Embed(source = 'assets/soldier spear.png')] private const SOLDIER:Class;
  12.        
  13.         public var sprSoldier:Spritemap = new Spritemap(GC.SOLDIER, 256, 256); 
  14.         public var attacking:Boolean = true;
  15.         public static var dead:Boolean = false;
  16.        
  17.         public function EnemyEntity()
  18.         {          
  19.             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);
  20.             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);
  21.             graphic = sprSoldier;
  22.             sprSoldier.play("attack");
  23.             setHitbox(80, 100, -80, -100);     
  24.             type = GC.TYPE_ENEMY;
  25.            
  26.         }
  27.            
  28.         override public function update():void
  29.         {
  30.             if (!dead)
  31.             {
  32.                 x -= GC.ENEMY_SPEED;
  33.             }
  34.             if (this.x <= GameWorld.player.x - 200)
  35.             {
  36.                 this.world.remove(this);
  37.             }
  38.            
  39.             if (this.collideWith(GameWorld.player, x, y))
  40.             {
  41.                 if (MyEntity.attacking == true)
  42.                 {
  43.                         //dead = true;
  44.                         this.sprSoldier.play("die");
  45.                 }
  46.                
  47.             }
  48.            
  49.             /*if (dead == true)
  50.             {
  51.                 this.sprSoldier.play("die");
  52.             }else
  53.             {
  54.                 this.sprSoldier.play("attack");
  55.             }*/
  56.            
  57.             super.update();
  58.            
  59.         }  
  60.        
  61.     }
  62.    
  63. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top