home *** CD-ROM | disk | FTP | other *** search
- package com.lofiminds.xwung
- {
- import com.lofiminds.gm.CollisionContext;
- import com.lofiminds.gm.Collisions;
- import com.lofiminds.gm.GameImage;
- import com.lofiminds.gm.GameObject;
- import com.lofiminds.gm.GameUtil;
- import com.lofiminds.gm.Instances;
- import flash.display.Bitmap;
-
- public class Sledge extends GameObject
- {
-
- private static var gameImage:GameImage = new GameImage(Bitmap(new GxClass()).bitmapData);
-
- private static var GxClass:Class = Sledge_GxClass;
-
-
- private var gp:Gameplay;
-
- public function Sledge()
- {
- super();
- setImage(gameImage);
- friction = 0.05;
- depth = 2;
- gp = Instances.getFirst(Gameplay) as Gameplay;
- }
-
- override public function update() : void
- {
- var _loc3_:Number = NaN;
- var _loc4_:Bosspiece = null;
- var _loc5_:int = 0;
- var _loc6_:GameObject = null;
- super.update();
- var _loc1_:Player = Instances.getFirst(Player) as Player;
- var _loc2_:Number = GameUtil.point_distance(x,y,_loc1_.x,_loc1_.y);
- if(_loc2_ > 12)
- {
- _loc3_ = (_loc2_ - 12) * 0.0075;
- if(_loc3_ > 0)
- {
- this.motionAdd(GameUtil.point_direction(x,y,_loc1_.x,_loc1_.y),_loc3_);
- }
- }
- if(this.getSpeed() > 24)
- {
- this.setSpeedAndDirection(24,this.getDirection());
- }
- if(Instances.exists(Boss))
- {
- if((_loc4_ = Collisions.line_collision(_loc1_.x,_loc1_.y,x,y,Rocket) as Bosspiece) == null)
- {
- _loc4_ = Collisions.line_collision(_loc1_.x,_loc1_.y,x,y,Bosspart) as Bosspiece;
- }
- if(_loc4_ == null)
- {
- _loc4_ = Collisions.line_collision(_loc1_.x,_loc1_.y,x,y,Bossturret) as Bosspiece;
- }
- if(_loc4_ != null)
- {
- _loc5_ = gp.hasPowerup ? 100 : 1;
- _loc4_.hurt = 1;
- if((_loc4_.energy = _loc4_.energy - _loc5_) < 0)
- {
- Instances.destroy(_loc4_);
- }
- }
- }
- else
- {
- if((_loc6_ = Collisions.line_collision(_loc1_.x,_loc1_.y,x,y,Enemy1)) == null)
- {
- _loc6_ = Collisions.line_collision(_loc1_.x,_loc1_.y,x,y,Enemy2);
- }
- if(_loc6_ == null)
- {
- _loc6_ = Collisions.line_collision(_loc1_.x,_loc1_.y,x,y,Enemy3);
- }
- if(_loc6_ != null)
- {
- Instances.destroy(_loc6_);
- }
- }
- if(gp.hasPowerup)
- {
- if(Instances.exists(Boss))
- {
- _loc6_ = Collisions.line_collision(_loc1_.x,_loc1_.y,x,y,Enemybullet);
- }
- else
- {
- _loc6_ = Collisions.line_collision(_loc1_.x,_loc1_.y,x,y,Debris);
- }
- if(_loc6_ != null)
- {
- Instances.destroy(_loc6_);
- }
- }
- }
-
- override public function getClass() : Class
- {
- return Sledge;
- }
-
- override public function onCollision(param1:CollisionContext) : void
- {
- var _loc2_:Number = NaN;
- if(param1.other is Bosspart || param1.other is Bossturret)
- {
- _loc2_ = getSpeed();
- if(_loc2_ > 4)
- {
- setSpeedAndDirection(_loc2_ - 3,getDirection());
- Instances.destroy(param1.other);
- }
- }
- }
- }
- }
-