Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package
- {
- import net.flashpunk.Entity;
- import net.flashpunk.graphics.Image;
- import net.flashpunk.FP
- public class Vihu1 extends Entity
- {
- [Embed(source = '/../lib/Art/alus1.png')] private const ALUS:Class;
- public var health:Number = 3;
- public var Sine:Number = 180;
- public var oldX:int;
- public var time:Boolean;
- public var freq:int = Math.random()*2 + 5;
- public var speed:int = 40;
- public var timer_shoot:Number = 0;
- public function Vihu1(x:int, y:int, time:Boolean)
- {
- this.time = time;
- super(x, y);
- graphic = new Image(ALUS);
- oldX = this.x;
- setHitbox(11, 6, 0, 0);
- type = "Vihu";
- timer_shoot = Math.random() * 70;
- }
- override public function update(): void
- {
- if (Kentta.time == false)
- {
- timer_shoot += 1;
- }
- if (timer_shoot >= 80 && Kentta.time == false)
- {
- timer_shoot = 0;
- world.add(new e_Panos(x + 5, y + 3, Math.atan2(y - Kentta.player.y, Kentta.player.x - x), time));
- trace(Math.atan2(y - Kentta.player.y, x - Kentta.player.x));
- }
- var coll:p_Laser = collide("omabullet", x, y) as p_Laser;
- if (coll)
- {
- coll.destroy();
- health -= 1;
- }
- if (health <= 0 || y > 126)
- {
- FP.world.remove(this);
- }
- }
- public function destroy():void
- {
- graphic = null;
- FP.world.remove(this);
- }
- }
- }
Add Comment
Please, Sign In to add comment