home *** CD-ROM | disk | FTP | other *** search
- package com.lofiminds.xwung
- {
- import com.lofiminds.gm.CollisionContext;
- 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 Hitbox extends GameObject
- {
-
- private static var gameImage:GameImage = new GameImage(Bitmap(new GxClass()).bitmapData,24,24,10,6).setOrigin(12,13);
-
- private static var GxClass:Class = Hitbox_GxClass;
-
-
- public function Hitbox()
- {
- super();
- setImage(gameImage);
- image_speed = 0.2;
- depth = 3;
- }
-
- override public function destroy() : void
- {
- var _loc1_:Number = NaN;
- var _loc3_:int = 0;
- var _loc4_:GameObject = null;
- _loc1_ = image_angle + Math.PI / 4;
- _loc3_ = 0;
- while(_loc3_ < 4)
- {
- (_loc4_ = Instances.create(Debris,x + GameUtil.lengthdir_x(11,_loc1_),y + GameUtil.lengthdir_y(11,_loc1_))).setSpeedAndDirection(4,_loc1_);
- _loc4_.image_angle = image_angle;
- _loc1_ += Math.PI * 0.5;
- _loc3_++;
- }
- var _loc2_:int = int(GameUtil.randomRange(6,3));
- _loc1_ = Math.random() * Math.PI * 2;
- _loc3_ = 0;
- while(_loc3_ < _loc2_)
- {
- (_loc4_ = Instances.create(Explosion,x,y)).setSpeedAndDirection(4 + Math.random() * 12,_loc1_);
- _loc1_ += Math.PI * 2 / _loc2_;
- _loc3_++;
- }
- _loc3_ = 0;
- while(_loc3_ < 15 + int(Math.random() * 10))
- {
- (_loc4_ = Instances.create(Blip,x + GameUtil.randomRange(0,20),y + GameUtil.randomRange(0,20))).setSpeedAndDirection(Math.random() * 3,GameUtil.point_direction(x,y,_loc4_.x,_loc4_.y));
- _loc4_.image_speed = 0.3 + Math.random() * 0.7;
- _loc3_++;
- }
- }
-
- override public function getClass() : Class
- {
- return Hitbox;
- }
-
- override public function onCollision(param1:CollisionContext) : void
- {
- Instances.destroy(this);
- Instances.destroy(Instances.getFirst(Player));
- }
- }
- }
-