Guest User

Untitled

a guest
May 21st, 2018
91
0
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.FP;
  5.     import net.flashpunk.graphics.Image;
  6.    
  7.     public class Bullet extends Entity
  8.     {
  9.         [Embed(source='assets/bullet.png')]
  10.         private const BULLET:Class;
  11.        
  12.         public function Bullet()
  13.         {
  14.             graphic = new Image(BULLET);
  15.             setHitbox(10, 10);
  16.             type = "bullet";
  17.             x = (Math.random() * 800);
  18.        
  19.         }
  20.         public var speed:Number = 5;
  21.        
  22.         override public function update():void
  23.         {
  24.             y += 5;
  25.         }
  26.        
  27.         public function destroy():void
  28.         {
  29.             FP.world.remove(this);
  30.         }
  31.     }
  32. }
Add Comment
Please, Sign In to add comment