Guest User

Untitled

a guest
May 12th, 2012
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package  
  2. {
  3.     import flash.display.Sprite;
  4.     import net.flashpunk.Entity;
  5.     import net.flashpunk.graphics.Image;
  6.     import net.flashpunk.utils.Input;
  7.     import net.flashpunk.graphics.Spritemap
  8.     import net.flashpunk.utils.Key;
  9.     import net.flashpunk.FP
  10.    
  11.     public class e_Panos extends Entity
  12.     {
  13.         [Embed(source = '/../lib/Art/panose_1.png')]
  14.         private const EPANOS1:Class;
  15.         public var speed:int;
  16.         public var time:Boolean = false;
  17.         public var angle:int;
  18.         public var sprepanos1:Spritemap = new Spritemap(EPANOS1, 3, 3);
  19.        
  20.         public function e_Panos(x:int, y:int, suunta:int, time:Boolean)
  21.         {
  22.             super(x, y);
  23.             this.time = time;
  24.             this.angle = suunta;
  25.             setHitbox(3, 3);
  26.             speed = 40;
  27.             type = "vihubullet";
  28.             graphic = sprepanos1;
  29.             sprepanos1.add("perus", [0, 1], 20, true);
  30.             sprepanos1.play("perus");
  31.         }
  32.        
  33.         override public function update():void
  34.         {
  35.             if (Kentta.time == false)
  36.             {
  37.             x += Math.cos(angle) * speed * FP.elapsed;
  38.             y -= Math.sin(angle) * speed * FP.elapsed;
  39.             }
  40.            
  41.             if (x < 0 || y < 0 || x > 120 || y > 120)
  42.             {
  43.                 FP.world.remove(this);
  44.             }
  45.            
  46.             if (Kentta.time == true)
  47.             {
  48.                 sprepanos1.rate = 0;
  49.             }
  50.             else
  51.             {
  52.                 sprepanos1.rate = 20;
  53.             }
  54.         }
  55.        
  56.         public function destroy():void
  57.         {
  58.             graphic = null;
  59.             FP.world.remove(this);
  60.         }
  61.     }
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment