Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package
- {
- import flash.display.Sprite;
- import net.flashpunk.Entity;
- import net.flashpunk.graphics.Image;
- import net.flashpunk.utils.Input;
- import net.flashpunk.graphics.Spritemap
- import net.flashpunk.utils.Key;
- import net.flashpunk.FP
- public class e_Panos extends Entity
- {
- [Embed(source = '/../lib/Art/panose_1.png')]
- private const EPANOS1:Class;
- public var speed:int;
- public var time:Boolean = false;
- public var angle:int;
- public var sprepanos1:Spritemap = new Spritemap(EPANOS1, 3, 3);
- public function e_Panos(x:int, y:int, suunta:int, time:Boolean)
- {
- super(x, y);
- this.time = time;
- this.angle = suunta;
- setHitbox(3, 3);
- speed = 40;
- type = "vihubullet";
- graphic = sprepanos1;
- sprepanos1.add("perus", [0, 1], 20, true);
- sprepanos1.play("perus");
- }
- override public function update():void
- {
- if (Kentta.time == false)
- {
- x += Math.cos(angle) * speed * FP.elapsed;
- y -= Math.sin(angle) * speed * FP.elapsed;
- }
- if (x < 0 || y < 0 || x > 120 || y > 120)
- {
- FP.world.remove(this);
- }
- if (Kentta.time == true)
- {
- sprepanos1.rate = 0;
- }
- else
- {
- sprepanos1.rate = 20;
- }
- }
- public function destroy():void
- {
- graphic = null;
- FP.world.remove(this);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment