initial commit, kind of working.
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import com.arc.dh.Color;
|
||||
import com.arc.dh.entities.Entity;
|
||||
import com.arc.dh.entities.Player;
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
|
||||
public class BossDoor extends Entity
|
||||
{
|
||||
|
||||
private static const sprite:Class = BossDoor_sprite;
|
||||
|
||||
private var _c:int;
|
||||
|
||||
private var _r:int;
|
||||
|
||||
private var _locked:Boolean = false;
|
||||
|
||||
public function BossDoor(param1:Number, param2:Number, param3:int)
|
||||
{
|
||||
var _loc4_:Number = param1 * Config.BLOCK_SIZE;
|
||||
var _loc5_:Number = param2 * Config.BLOCK_SIZE;
|
||||
super(_loc4_,_loc5_);
|
||||
this._c = param1;
|
||||
this._r = param2;
|
||||
if(Data.state.player.y > y && Data.state.tilemap.getTile(this._c,this._r) != 0)
|
||||
{
|
||||
Data.state.tilemap.setTile(this._c,this._r,0,true);
|
||||
}
|
||||
loadGraphic(sprite,true,false,12,12);
|
||||
immovable = true;
|
||||
solid = false;
|
||||
visible = true;
|
||||
alpha = 0.35;
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(outside)
|
||||
{
|
||||
}
|
||||
var _loc1_:Player = Data.state.player;
|
||||
if(!this._locked && _loc1_.y <= y && (Boolean(_loc1_.touching & DOWN) || Boolean(_loc1_.wasTouching & DOWN)))
|
||||
{
|
||||
this._locked = true;
|
||||
visible = false;
|
||||
Data.state.tilemap.setTile(this._c,this._r,56,true);
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.RED,getMidpoint().x,getMidpoint().y,2,1,1,0,-50,50,-50,50);
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.GREEN,getMidpoint().x,getMidpoint().y,2,1,1,0,-50,50,-50,50);
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.BLUE,getMidpoint().x,getMidpoint().y,2,1,1,0,-50,50,-50,50);
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.YELLOW,getMidpoint().x,getMidpoint().y,2,1,1,0,-50,50,-50,50);
|
||||
Data.state.setBoss(y);
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/102_com.arc.dh.objects.BossDoor_sprite.png")]
|
||||
public class BossDoor_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function BossDoor_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import com.arc.dh.state.HorizontalMode;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcSprite;
|
||||
import org.flixel.FlxG;
|
||||
import org.flixel.FlxObject;
|
||||
import org.flixel.FlxPoint;
|
||||
|
||||
public class Bullet extends ArcSprite
|
||||
{
|
||||
|
||||
protected var _collider:FlxObject;
|
||||
|
||||
private var _dir:Number;
|
||||
|
||||
private var _speed:Number;
|
||||
|
||||
public var damage:int;
|
||||
|
||||
public function Bullet(param1:Number, param2:Number, param3:Number, param4:Number)
|
||||
{
|
||||
super(param1,param2);
|
||||
velocity.x = param3 * Math.cos(param4);
|
||||
velocity.y = param3 * Math.sin(param4);
|
||||
this._dir = param4;
|
||||
this._speed = param3;
|
||||
if(Data.state is HorizontalMode)
|
||||
{
|
||||
velocity.x += (Data.state as HorizontalMode).camera.velocity.x;
|
||||
}
|
||||
x += velocity.x * 0.005;
|
||||
y += velocity.y * 0.005;
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(this.offScreen())
|
||||
{
|
||||
alive = false;
|
||||
exists = false;
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
|
||||
override public function offScreen() : Boolean
|
||||
{
|
||||
var _loc1_:FlxPoint = getScreenXY();
|
||||
return _loc1_.x < -width || _loc1_.x > FlxG.width || _loc1_.y < -height - 60 || _loc1_.y > FlxG.height + 60;
|
||||
}
|
||||
|
||||
public function setCollider(param1:FlxObject) : void
|
||||
{
|
||||
this._collider = param1;
|
||||
}
|
||||
|
||||
public function shift(param1:Number, param2:int = 1) : Bullet
|
||||
{
|
||||
var _loc3_:Number = this._dir + Math.PI / 2 * param2;
|
||||
x += this._speed * param1 * Math.cos(_loc3_);
|
||||
y += this._speed * param1 * Math.sin(_loc3_);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import com.arc.dh.Gun;
|
||||
import com.arc.dh.util.AchievementSystem;
|
||||
import com.arc.dh.util.Data;
|
||||
|
||||
public class BulletFactory
|
||||
{
|
||||
|
||||
public static var nonMissile:Boolean = false;
|
||||
|
||||
public function BulletFactory()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function create(param1:Number, param2:Number, param3:Number, param4:Number, param5:Class) : Bullet
|
||||
{
|
||||
var _loc6_:Bullet = new param5(param1,param2,param3,param4);
|
||||
_loc6_.damage = damage(param5);
|
||||
++Data.bullets;
|
||||
AchievementSystem.bullets();
|
||||
if(param5 != Missile && param5 != BulletFragment)
|
||||
{
|
||||
nonMissile = true;
|
||||
}
|
||||
return _loc6_;
|
||||
}
|
||||
|
||||
public static function damage(param1:Class) : int
|
||||
{
|
||||
switch(param1)
|
||||
{
|
||||
case BulletPrime:
|
||||
return Gun.PRIME_DAMAGE[Data.primegun[0]];
|
||||
case BulletSpreader:
|
||||
return Gun.SPREADER_DAMAGE[Data.spreadergun[0]];
|
||||
case Missile:
|
||||
return Gun.MISSILE_DAMAGE[Data.missilegun[0]];
|
||||
case BulletRebound:
|
||||
return Gun.REBOUND_DAMAGE[Data.reboundgun[0]];
|
||||
case BulletFragment:
|
||||
return Gun.MISSILE_DAMAGE[Data.missilegun[0]] / 8;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
|
||||
public class BulletFragment extends Bullet
|
||||
{
|
||||
|
||||
public static const sprite:Class = BulletFragment_sprite;
|
||||
|
||||
public function BulletFragment(param1:Number, param2:Number, param3:Number, param4:Number)
|
||||
{
|
||||
super(param1,param2,param3,param4);
|
||||
loadGraphic(sprite,false,false,4,4);
|
||||
width = height = 2;
|
||||
offset.x = offset.y = 1;
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
if(touching & UP)
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,"prime",x + width / 2,y,3,1,3,400,-60,60,0,20);
|
||||
}
|
||||
else if(touching & DOWN)
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,"prime",x + width / 2,y + height,3,1,3,400,-60,60,-100,0);
|
||||
}
|
||||
else if(touching & LEFT)
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,"prime",x,y + height / 2,3,1,3,400,0,60,-100,0);
|
||||
}
|
||||
else if(touching & RIGHT)
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,"prime",x + width,y + height / 2,3,1,3,400,-60,0,-100,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,"prime",x + width / 2,y,3,1,3,400,-60,60,-100,0);
|
||||
}
|
||||
alive = false;
|
||||
exists = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/253_com.arc.dh.objects.BulletFragment_sprite.png")]
|
||||
public class BulletFragment_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function BulletFragment_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
|
||||
public class BulletPrime extends Bullet
|
||||
{
|
||||
|
||||
public static const sprite:Class = BulletPrime_sprite;
|
||||
|
||||
public function BulletPrime(param1:Number, param2:Number, param3:Number, param4:Number)
|
||||
{
|
||||
super(param1,param2,param3,param4);
|
||||
loadGraphic(sprite,false,false,4,4);
|
||||
width = height = 2;
|
||||
offset.x = offset.y = 1;
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
if(touching & UP)
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,"prime",x + width / 2,y,3,1,3,400,-60,60,0,20);
|
||||
}
|
||||
else if(touching & DOWN)
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,"prime",x + width / 2,y + height,3,1,3,400,-60,60,-100,0);
|
||||
}
|
||||
else if(touching & LEFT)
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,"prime",x,y + height / 2,3,1,3,400,0,60,-100,0);
|
||||
}
|
||||
else if(touching & RIGHT)
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,"prime",x + width,y + height / 2,3,1,3,400,-60,0,-100,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,"prime",x + width / 2,y,3,1,3,400,-60,60,-100,0);
|
||||
}
|
||||
alive = false;
|
||||
exists = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/233_com.arc.dh.objects.BulletPrime_sprite.png")]
|
||||
public class BulletPrime_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function BulletPrime_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import com.arc.dh.Gun;
|
||||
import com.arc.dh.objects.enemies.Enemy;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
import com.arc.flixel.ArcU;
|
||||
import org.flixel.FlxG;
|
||||
import org.flixel.FlxPoint;
|
||||
|
||||
public class BulletRebound extends Bullet
|
||||
{
|
||||
|
||||
public static const sprite:Class = BulletRebound_sprite;
|
||||
|
||||
private static const SOLID_TIME:Number = 0.15;
|
||||
|
||||
private var bounces:int = 2;
|
||||
|
||||
public var solidTimer:Number = 0.15;
|
||||
|
||||
private var side:String = "";
|
||||
|
||||
private var _vx:Number;
|
||||
|
||||
private var _vy:Number;
|
||||
|
||||
public var lastEnemy:Enemy;
|
||||
|
||||
public function BulletRebound(param1:Number, param2:Number, param3:Number, param4:Number)
|
||||
{
|
||||
super(param1,param2,param3,param4);
|
||||
loadGraphic(sprite,false,false,4,4);
|
||||
this._vx = velocity.x;
|
||||
this._vy = velocity.y;
|
||||
this.bounces = Data.reboundgun[Gun.SPECIAL_ONE] == 1 ? 3 : 2;
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(this.solidTimer > 0)
|
||||
{
|
||||
this.solidTimer -= FlxG.elapsed;
|
||||
if(this.solidTimer <= 0)
|
||||
{
|
||||
solid = true;
|
||||
}
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
var _loc1_:Number = NaN;
|
||||
var _loc2_:Number = NaN;
|
||||
var _loc3_:FlxPoint = null;
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc5_:Number = NaN;
|
||||
var _loc6_:FlxPoint = null;
|
||||
var _loc7_:Number = NaN;
|
||||
var _loc8_:Number = NaN;
|
||||
var _loc9_:Number = NaN;
|
||||
var _loc10_:Number = NaN;
|
||||
var _loc11_:Number = NaN;
|
||||
var _loc12_:Number = NaN;
|
||||
if(this.bounces > 0 && _collider != null)
|
||||
{
|
||||
this.solidTimer = SOLID_TIME;
|
||||
--this.bounces;
|
||||
_loc1_ = velocity.x * FlxG.elapsed;
|
||||
_loc2_ = velocity.y * FlxG.elapsed;
|
||||
if(touching & (UP | DOWN))
|
||||
{
|
||||
this._vy = 0 - this._vy;
|
||||
velocity.y = this._vy;
|
||||
velocity.x = this._vx;
|
||||
}
|
||||
else if(touching & (LEFT | RIGHT))
|
||||
{
|
||||
this._vx = 0 - this._vx;
|
||||
velocity.y = this._vy;
|
||||
velocity.x = this._vx;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = _collider.getMidpoint();
|
||||
_loc4_ = _loc3_.x;
|
||||
_loc5_ = _loc3_.y;
|
||||
_loc6_ = getMidpoint();
|
||||
_loc7_ = _loc6_.x;
|
||||
_loc8_ = _loc6_.y;
|
||||
_loc9_ = _loc7_ - _loc4_;
|
||||
_loc10_ = _loc8_ - _loc5_;
|
||||
_loc11_ = ArcU.abs(_loc9_);
|
||||
_loc12_ = ArcU.abs(_loc10_);
|
||||
if((_loc11_ > _loc12_ || _loc8_ <= _loc5_ && velocity.y <= 0 || _loc8_ >= _loc5_ && velocity.y >= 0) && (_loc7_ <= _loc4_ && velocity.x >= 0 || _loc7_ >= _loc4_ && velocity.x <= 0))
|
||||
{
|
||||
this._vx = 0 - this._vx;
|
||||
velocity.y = this._vy;
|
||||
velocity.x = this._vx;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._vy = 0 - this._vy;
|
||||
velocity.y = this._vy;
|
||||
velocity.x = this._vx;
|
||||
}
|
||||
}
|
||||
ArcParticleSystem.emit(Data.state.particles,"rebound",x + width / 2,y + width / 2,1,1,3,400,-60,60,-100,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,"rebound",x + width / 2,y + width / 2,1,3,3,400,-60,60,-100,0);
|
||||
alive = false;
|
||||
exists = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/158_com.arc.dh.objects.BulletRebound_sprite.png")]
|
||||
public class BulletRebound_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function BulletRebound_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
|
||||
public class BulletSpreader extends Bullet
|
||||
{
|
||||
|
||||
public static const sprite:Class = BulletSpreader_sprite;
|
||||
|
||||
public static const spriteGreen:Class = BulletSpreader_spriteGreen;
|
||||
|
||||
public function BulletSpreader(param1:Number, param2:Number, param3:Number, param4:Number)
|
||||
{
|
||||
super(param1,param2,param3,param4);
|
||||
loadGraphic(sprite,false,false,4,4);
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,"prime",x + width / 2,y + width / 2,1,1,3,400,-60,60,-100,0);
|
||||
alive = false;
|
||||
exists = false;
|
||||
}
|
||||
|
||||
public function green() : void
|
||||
{
|
||||
loadGraphic(spriteGreen,false,false,4,4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/295_com.arc.dh.objects.BulletSpreader_sprite.png")]
|
||||
public class BulletSpreader_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function BulletSpreader_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/212_com.arc.dh.objects.BulletSpreader_spriteGreen.png")]
|
||||
public class BulletSpreader_spriteGreen extends BitmapAsset
|
||||
{
|
||||
|
||||
public function BulletSpreader_spriteGreen()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import org.flixel.FlxSprite;
|
||||
|
||||
public class Camera extends FlxSprite
|
||||
{
|
||||
|
||||
public function Camera(param1:Number, param2:Number)
|
||||
{
|
||||
super(param1,param2);
|
||||
width = height = 1;
|
||||
visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import com.arc.dh.Color;
|
||||
import com.arc.dh.objects.powerups.Powerup;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.dh.util.Sound;
|
||||
import com.arc.dh.util.SoundSystem;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class Checkpoint extends Powerup
|
||||
{
|
||||
|
||||
private static const sprite:Class = Checkpoint_sprite;
|
||||
|
||||
private static const spriteRed:Class = Checkpoint_spriteRed;
|
||||
|
||||
private var _activated:Boolean = false;
|
||||
|
||||
public function Checkpoint(param1:Number, param2:Number)
|
||||
{
|
||||
var _loc6_:Array = null;
|
||||
super(param1,param2);
|
||||
Data.state.spawner[_c + "," + _r] = true;
|
||||
var _loc3_:Boolean = false;
|
||||
var _loc4_:Array = Data.state.checkpoints;
|
||||
var _loc5_:int = 0;
|
||||
while(_loc5_ < _loc4_.length)
|
||||
{
|
||||
_loc6_ = _loc4_[_loc5_];
|
||||
if(_loc6_[0] == param1 && _loc6_[1] == param2)
|
||||
{
|
||||
loadRotatedGraphic(spriteRed,32,-1,true,true);
|
||||
this._activated = true;
|
||||
_loc3_ = true;
|
||||
break;
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
if(!_loc3_)
|
||||
{
|
||||
loadRotatedGraphic(sprite,32,-1,true,true);
|
||||
}
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
angle += FlxG.elapsed * 300;
|
||||
super.update();
|
||||
}
|
||||
|
||||
override public function activate() : void
|
||||
{
|
||||
if(this._activated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
loadRotatedGraphic(spriteRed,32,-1,true,true);
|
||||
ArcParticleSystem.emit(Data.state.emitters,Color.RED,x,y,25,1,2,0,-200,200,-200,200,width,height);
|
||||
ArcParticleSystem.emit(Data.state.emitters,Color.BLACK,x,y,25,1,2,0,-200,200,-200,200,width,height);
|
||||
this._activated = true;
|
||||
Data.state.checkpoints.push([_c,_r]);
|
||||
Data.state.checkpoint();
|
||||
Data.hp = Data.hpm;
|
||||
SoundSystem.play(Sound.CHECKPOINT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/92_com.arc.dh.objects.Checkpoint_sprite.png")]
|
||||
public class Checkpoint_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Checkpoint_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/140_com.arc.dh.objects.Checkpoint_spriteRed.png")]
|
||||
public class Checkpoint_spriteRed extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Checkpoint_spriteRed()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import com.arc.dh.Color;
|
||||
import com.arc.dh.state.HorizontalMode;
|
||||
import com.arc.dh.state.TadpoleMode;
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcSprite;
|
||||
import com.arc.flixel.ArcU;
|
||||
import org.flixel.FlxG;
|
||||
import org.flixel.FlxPoint;
|
||||
import org.flixel.FlxU;
|
||||
|
||||
public class Diamond extends ArcSprite
|
||||
{
|
||||
|
||||
private static const sprite:Class = Diamond_sprite;
|
||||
|
||||
private static const PULL_DISTANCE:int = 25;
|
||||
|
||||
private static const PULL_SPEED:int = 240;
|
||||
|
||||
public var value:int = 1;
|
||||
|
||||
public var pullDelay:Number = 0;
|
||||
|
||||
public var diamondColor:int = 0;
|
||||
|
||||
private var _pulled:Boolean = false;
|
||||
|
||||
private var _magnet:Boolean = false;
|
||||
|
||||
private var _hidden:Boolean = false;
|
||||
|
||||
private var _thisPoint:FlxPoint = new FlxPoint();
|
||||
|
||||
private var _otherPoint:FlxPoint = new FlxPoint();
|
||||
|
||||
private var outsideFunction:Function;
|
||||
|
||||
private var _c:int = -1;
|
||||
|
||||
private var _r:int = -1;
|
||||
|
||||
public function Diamond(param1:Number, param2:Number, param3:int = 1, param4:Boolean = false, param5:int = -1, param6:int = -1)
|
||||
{
|
||||
var _loc7_:int = 0;
|
||||
super(param1,param2);
|
||||
loadGraphic(sprite,true,false,10,10);
|
||||
this._hidden = param4;
|
||||
this._c = param5;
|
||||
this._r = param6;
|
||||
solid = false;
|
||||
this.value = param3;
|
||||
switch(param3)
|
||||
{
|
||||
case 1:
|
||||
_loc7_ = 0;
|
||||
this.diamondColor = Color.YELLOW;
|
||||
break;
|
||||
case 2:
|
||||
_loc7_ = 1;
|
||||
this.diamondColor = Color.GREEN;
|
||||
break;
|
||||
case 3:
|
||||
_loc7_ = 2;
|
||||
this.diamondColor = Color.CYAN;
|
||||
break;
|
||||
case 4:
|
||||
_loc7_ = 3;
|
||||
this.diamondColor = Color.BLUE;
|
||||
break;
|
||||
case 5:
|
||||
_loc7_ = 4;
|
||||
this.diamondColor = Color.PURPLE;
|
||||
break;
|
||||
case 6:
|
||||
_loc7_ = 5;
|
||||
this.diamondColor = Color.WHITE;
|
||||
break;
|
||||
case 10:
|
||||
_loc7_ = 6;
|
||||
this.diamondColor = Color.BLACK;
|
||||
break;
|
||||
default:
|
||||
_loc7_ = 0;
|
||||
this.diamondColor = Color.GREEN;
|
||||
}
|
||||
var _loc8_:int = _loc7_ * 6;
|
||||
addAnimation("glow",[_loc8_ + 0,_loc8_ + 1,_loc8_ + 2,_loc8_ + 3,_loc8_ + 4,_loc8_ + 5,_loc8_ + 4,_loc8_ + 3,_loc8_ + 2,_loc8_ + 1],ArcU.rand(5,12),true);
|
||||
play("glow");
|
||||
if(Data.state is HorizontalMode)
|
||||
{
|
||||
this.outsideFunction = this.runmodeOutside;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.outsideFunction = this.playmodeOutside;
|
||||
}
|
||||
}
|
||||
|
||||
public static function valueFromLevel(param1:int) : int
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
if(param1 < 9)
|
||||
{
|
||||
_loc2_ = 1;
|
||||
}
|
||||
else if(param1 < 20)
|
||||
{
|
||||
_loc2_ = 2;
|
||||
}
|
||||
else if(param1 < 31)
|
||||
{
|
||||
_loc2_ = 3;
|
||||
}
|
||||
else if(param1 < 42)
|
||||
{
|
||||
_loc2_ = 4;
|
||||
}
|
||||
else if(param1 < 53)
|
||||
{
|
||||
_loc2_ = 5;
|
||||
}
|
||||
else if(param1 < 61)
|
||||
{
|
||||
_loc2_ = 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = 10;
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
private function runmodeOutside() : Boolean
|
||||
{
|
||||
var _loc1_:int = x / Config.BLOCK_SIZE;
|
||||
if(_loc1_ <= Data.state.despawnTop - 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function playmodeOutside() : Boolean
|
||||
{
|
||||
var _loc1_:int = y / Config.BLOCK_SIZE;
|
||||
if(_loc1_ >= Data.state.despawnBottom + 2 || _loc1_ <= Data.state.despawnTop - 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get pullDistance() : int
|
||||
{
|
||||
if(Data.state is TadpoleMode)
|
||||
{
|
||||
return 50;
|
||||
}
|
||||
return PULL_DISTANCE + Data.attract * 7;
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
var _loc2_:Number = NaN;
|
||||
var _loc3_:Number = NaN;
|
||||
var _loc4_:Number = NaN;
|
||||
if(this.outsideFunction())
|
||||
{
|
||||
kill();
|
||||
}
|
||||
this.pullDelay -= FlxG.elapsed;
|
||||
var _loc1_:Boolean = !this._hidden || Data.state.player.inHidden > 0;
|
||||
if(_loc1_ && (this.pullDelay <= 0 || this._magnet))
|
||||
{
|
||||
this._thisPoint.x = x + 2;
|
||||
this._thisPoint.y = y + 2;
|
||||
this._otherPoint.x = Data.state.player.x + Data.state.player.width / 2;
|
||||
this._otherPoint.y = Data.state.player.y + Data.state.player.height / 2;
|
||||
_loc2_ = FlxU.getDistance(this._thisPoint,this._otherPoint);
|
||||
if(_loc2_ < this.pullDistance && Data.state.tilemap.ray(this._thisPoint,this._otherPoint) || this._magnet)
|
||||
{
|
||||
_loc3_ = FlxU.getAngle(this._thisPoint,this._otherPoint) - 90;
|
||||
_loc4_ = Math.PI / 180 * _loc3_;
|
||||
this._pulled = true;
|
||||
velocity.x = (PULL_SPEED + (this._magnet ? 150 : 0)) * Math.cos(_loc4_) + (Data.state is HorizontalMode ? (Data.state as HorizontalMode).camera.velocity.x : 0);
|
||||
velocity.y = (PULL_SPEED + (this._magnet ? 150 : 0)) * Math.sin(_loc4_);
|
||||
if(!this._magnet)
|
||||
{
|
||||
solid = true;
|
||||
}
|
||||
}
|
||||
else if(this._pulled)
|
||||
{
|
||||
velocity.x = velocity.y = 0;
|
||||
}
|
||||
if(_loc2_ < 4)
|
||||
{
|
||||
solid = true;
|
||||
}
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
|
||||
public function set magnet(param1:Boolean) : void
|
||||
{
|
||||
var _loc2_:int = getScreenXY().x;
|
||||
var _loc3_:int = getScreenXY().y;
|
||||
var _loc4_:Boolean = !this._hidden || Data.state.player.inHidden > 0;
|
||||
if(_loc2_ >= -width && _loc2_ < FlxG.width && _loc3_ >= -height && _loc3_ < FlxG.height && _loc4_)
|
||||
{
|
||||
this._magnet = true;
|
||||
solid = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function despawn() : void
|
||||
{
|
||||
if(this._c != -1 && this._r != -1)
|
||||
{
|
||||
Data.state.despawn(this._c,this._r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/262_com.arc.dh.objects.Diamond_sprite.png")]
|
||||
public class Diamond_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Diamond_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import com.arc.flixel.ArcGroup;
|
||||
import com.arc.flixel.ArcSprite;
|
||||
|
||||
public class Healthbar extends ArcGroup
|
||||
{
|
||||
|
||||
public static const WIDTH:int = 15;
|
||||
|
||||
public static const HEIGHT:int = 6;
|
||||
|
||||
private static const BORDER_WIDTH:int = 2;
|
||||
|
||||
private var backgroundSprite:Class = Healthbar_backgroundSprite;
|
||||
|
||||
private var barSprite:Class = Healthbar_barSprite;
|
||||
|
||||
private var background:ArcSprite;
|
||||
|
||||
public var bar:ArcSprite;
|
||||
|
||||
public function Healthbar()
|
||||
{
|
||||
super();
|
||||
this.background = new ArcSprite(0,0);
|
||||
this.background.loadGraphic(this.backgroundSprite,false,false,WIDTH,HEIGHT);
|
||||
add(this.background);
|
||||
this.bar = new ArcSprite(BORDER_WIDTH,BORDER_WIDTH);
|
||||
this.bar.loadGraphic(this.barSprite,false,false,11,2);
|
||||
this.bar.origin.x = this.bar.origin.y = 0;
|
||||
this.bar.addAnimation("red",[0]);
|
||||
this.bar.addAnimation("gold",[1]);
|
||||
this.bar.play("red");
|
||||
add(this.bar);
|
||||
alive = true;
|
||||
exists = true;
|
||||
}
|
||||
|
||||
public function move(param1:int, param2:int, param3:Number) : void
|
||||
{
|
||||
this.background.alpha = param3;
|
||||
this.background.x = param1;
|
||||
this.background.y = param2;
|
||||
this.bar.alpha = param3;
|
||||
this.bar.x = param1 + BORDER_WIDTH;
|
||||
this.bar.y = param2 + BORDER_WIDTH;
|
||||
}
|
||||
|
||||
public function scale(param1:Number) : void
|
||||
{
|
||||
this.bar.scale.x = param1;
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/230_com.arc.dh.objects.Healthbar_backgroundSprite.png")]
|
||||
public class Healthbar_backgroundSprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Healthbar_backgroundSprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/207_com.arc.dh.objects.Healthbar_barSprite.png")]
|
||||
public class Healthbar_barSprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Healthbar_barSprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import com.arc.dh.Color;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class Missile extends Bullet
|
||||
{
|
||||
|
||||
public static const sprite:Class = Missile_sprite;
|
||||
|
||||
private var _particleTime:Number = 0;
|
||||
|
||||
public function Missile(param1:Number, param2:Number, param3:Number, param4:Number)
|
||||
{
|
||||
super(param1,param2,param3,param4);
|
||||
loadRotatedGraphic(sprite,60,-1,true,false);
|
||||
width = 3;
|
||||
height = 3;
|
||||
offset.x = 6;
|
||||
offset.y = 6;
|
||||
angle = param4 * 57.2957795;
|
||||
}
|
||||
|
||||
override public function draw() : void
|
||||
{
|
||||
this._particleTime -= FlxG.elapsed;
|
||||
if(this._particleTime <= 0)
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.BLACK,getMidpoint().x,getMidpoint().y,1,1,0,0,0,0,0,0);
|
||||
this._particleTime = 0.02;
|
||||
}
|
||||
super.draw();
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.BLACK,x + width / 2,y + width / 2,5,2,0.2,0,-30,30,-30,30);
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.WHITE,x + width / 2,y + width / 2,5,2,0.2,0,-30,30,-30,30);
|
||||
alive = false;
|
||||
exists = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/91_com.arc.dh.objects.Missile_sprite.png")]
|
||||
public class Missile_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Missile_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import com.arc.dh.entities.Entity;
|
||||
import com.arc.dh.util.AchievementSystem;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.dh.util.Sound;
|
||||
import com.arc.dh.util.SoundSystem;
|
||||
import com.arc.flixel.ArcU;
|
||||
|
||||
public class Pot extends Entity
|
||||
{
|
||||
|
||||
private static const largeSprite:Class = Pot_largeSprite;
|
||||
|
||||
public function Pot(param1:Number, param2:Number, param3:int)
|
||||
{
|
||||
super(param1,param2);
|
||||
loadGraphic(largeSprite,true,false,12,12);
|
||||
addAnimation("pot",[ArcU.rand(0,3)]);
|
||||
play("pot");
|
||||
immovable = true;
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
var _loc1_:int = ArcU.rand(0,100);
|
||||
if(_loc1_ >= 50)
|
||||
{
|
||||
if(_loc1_ < 95)
|
||||
{
|
||||
Data.state.addDiamonds(x,y,ArcU.rand(1,3));
|
||||
}
|
||||
else
|
||||
{
|
||||
Data.state.createHeart(x,y);
|
||||
}
|
||||
}
|
||||
++Data.pots;
|
||||
SoundSystem.play(Sound.POT);
|
||||
AchievementSystem.pots();
|
||||
super.kill();
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(outside)
|
||||
{
|
||||
exists = false;
|
||||
alive = false;
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/278_com.arc.dh.objects.Pot_largeSprite.png")]
|
||||
public class Pot_largeSprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Pot_largeSprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import com.arc.dh.entities.Entity;
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcU;
|
||||
|
||||
public class SteelCrate extends Entity
|
||||
{
|
||||
|
||||
private static const sprite:Class = SteelCrate_sprite;
|
||||
|
||||
public function SteelCrate(param1:Number, param2:Number, param3:int)
|
||||
{
|
||||
var _loc4_:Number = param1 * Config.BLOCK_SIZE;
|
||||
var _loc5_:Number = param2 * Config.BLOCK_SIZE;
|
||||
super(_loc4_,_loc5_);
|
||||
loadGraphic(sprite,true,false,12,12);
|
||||
immovable = true;
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
var _loc1_:int = ArcU.rand(0,100);
|
||||
if(_loc1_ >= 50)
|
||||
{
|
||||
if(_loc1_ < 95)
|
||||
{
|
||||
Data.state.addDiamonds(x,y,ArcU.rand(1,3));
|
||||
}
|
||||
else
|
||||
{
|
||||
Data.state.createHeart(x,y);
|
||||
}
|
||||
}
|
||||
super.kill();
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(outside)
|
||||
{
|
||||
exists = false;
|
||||
alive = false;
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/201_com.arc.dh.objects.SteelCrate_sprite.png")]
|
||||
public class SteelCrate_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function SteelCrate_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import com.arc.flixel.ArcSprite;
|
||||
|
||||
public class Tile extends ArcSprite
|
||||
{
|
||||
|
||||
public function Tile(param1:int = 0, param2:int = 0, param3:Class = null)
|
||||
{
|
||||
super(param1,param2,param3);
|
||||
immovable = true;
|
||||
width = 12;
|
||||
height = 12;
|
||||
offset.x = offset.y = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcU;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class Wall extends Tile
|
||||
{
|
||||
|
||||
public static const HIDDEN_DISTANCE:int = 80;
|
||||
|
||||
public static const HIDDEN_DISTANCE_OFFSET:int = 30;
|
||||
|
||||
public static const IN_HIDDEN_DISTANCE_X:int = 8;
|
||||
|
||||
public static const IN_HIDDEN_DISTANCE_Y:int = 10;
|
||||
|
||||
private var _cx:int;
|
||||
|
||||
private var _cy:int;
|
||||
|
||||
private var _row:int;
|
||||
|
||||
private var _hidden:Boolean;
|
||||
|
||||
public function Wall(param1:Number, param2:Number, param3:uint, param4:Class, param5:Boolean = false)
|
||||
{
|
||||
super(param1,param2);
|
||||
loadGraphic(param4,true,false,Config.BLOCK_SIZE,Config.BLOCK_SIZE);
|
||||
this._cx = x + width / 2;
|
||||
this._cy = y + width / 2;
|
||||
this._row = y / Config.BLOCK_SIZE;
|
||||
this._hidden = param5;
|
||||
solid = false;
|
||||
frame = param3;
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
var _loc8_:Number = NaN;
|
||||
var _loc9_:Number = NaN;
|
||||
var _loc10_:Number = NaN;
|
||||
var _loc11_:Number = NaN;
|
||||
if(this._row >= Data.state.despawnBottom || this._row <= Data.state.despawnTop)
|
||||
{
|
||||
exists = false;
|
||||
alive = false;
|
||||
}
|
||||
if(!this._hidden)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc1_:int = Data.state.player.x + Data.state.player.width / 2;
|
||||
var _loc2_:int = Data.state.player.y + Data.state.player.height / 2;
|
||||
var _loc3_:int = ArcU.abs(this._cx - _loc1_);
|
||||
var _loc4_:int = ArcU.abs(this._cy - _loc2_);
|
||||
var _loc5_:int = _loc3_ > _loc4_ ? _loc3_ : _loc4_;
|
||||
var _loc6_:Boolean = _loc3_ < HIDDEN_DISTANCE && _loc4_ < HIDDEN_DISTANCE;
|
||||
var _loc7_:Boolean = ArcU.abs(this._cx - _loc1_) < IN_HIDDEN_DISTANCE_X && ArcU.abs(this._cy - _loc2_) < IN_HIDDEN_DISTANCE_Y;
|
||||
if(_loc7_)
|
||||
{
|
||||
Data.state.player.inHidden = 2;
|
||||
}
|
||||
if(_loc6_ && Data.state.player.inHidden > 0)
|
||||
{
|
||||
if(_loc5_ > HIDDEN_DISTANCE_OFFSET)
|
||||
{
|
||||
_loc8_ = (_loc5_ - HIDDEN_DISTANCE_OFFSET) / (HIDDEN_DISTANCE - HIDDEN_DISTANCE_OFFSET);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc8_ = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc8_ = 1;
|
||||
}
|
||||
if(alpha < _loc8_)
|
||||
{
|
||||
alpha += FlxG.elapsed * 2;
|
||||
if(alpha > _loc8_)
|
||||
{
|
||||
alpha = _loc8_;
|
||||
}
|
||||
}
|
||||
else if(alpha > _loc8_)
|
||||
{
|
||||
alpha -= FlxG.elapsed * 2;
|
||||
if(alpha < _loc8_)
|
||||
{
|
||||
alpha = _loc8_;
|
||||
}
|
||||
}
|
||||
if(Data.state.xraying)
|
||||
{
|
||||
_loc9_ = Math.atan2(this._cy - _loc2_,this._cx - _loc1_);
|
||||
_loc10_ = ArcU.abs(_loc9_ - Data.state.player.radians);
|
||||
if(_loc10_ < 0.5)
|
||||
{
|
||||
_loc11_ = int(_loc10_ * 20) / 8 - 0.25;
|
||||
if(_loc11_ < alpha)
|
||||
{
|
||||
alpha = _loc11_;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import com.arc.dh.entities.Entity;
|
||||
import com.arc.dh.util.AchievementSystem;
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcU;
|
||||
|
||||
public class WoodenCrate extends Entity
|
||||
{
|
||||
|
||||
private static const sprite:Class = WoodenCrate_sprite;
|
||||
|
||||
public function WoodenCrate(param1:Number, param2:Number, param3:int)
|
||||
{
|
||||
var _loc4_:Number = param1 * Config.BLOCK_SIZE;
|
||||
var _loc5_:Number = param2 * Config.BLOCK_SIZE;
|
||||
super(_loc4_,_loc5_);
|
||||
loadGraphic(sprite,true,false,12,12);
|
||||
immovable = true;
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
var _loc1_:int = ArcU.rand(0,100);
|
||||
if(_loc1_ >= 50)
|
||||
{
|
||||
if(_loc1_ < 95)
|
||||
{
|
||||
Data.state.addDiamonds(x,y,ArcU.rand(1,3));
|
||||
}
|
||||
else
|
||||
{
|
||||
Data.state.createHeart(x,y);
|
||||
}
|
||||
}
|
||||
++Data.boxes;
|
||||
AchievementSystem.boxes();
|
||||
super.kill();
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(outside)
|
||||
{
|
||||
exists = false;
|
||||
alive = false;
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/236_com.arc.dh.objects.WoodenCrate_sprite.png")]
|
||||
public class WoodenCrate_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function WoodenCrate_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.flixel.ArcU;
|
||||
|
||||
public class Bird extends Enemy
|
||||
{
|
||||
|
||||
private static const sprite:Class = Bird_sprite;
|
||||
|
||||
private static const FLY_SPEED:Number = 60;
|
||||
|
||||
public function Bird(param1:Number, param2:Number, param3:int)
|
||||
{
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc5_:Number = NaN;
|
||||
_loc4_ = param1 * Config.BLOCK_SIZE;
|
||||
_loc5_ = param2 * Config.BLOCK_SIZE;
|
||||
_c = param1;
|
||||
_r = param2;
|
||||
super(_loc4_,_loc5_,param3);
|
||||
loadGraphic(sprite,true,true,33,18);
|
||||
width = 28;
|
||||
height = 11;
|
||||
offset.x = 2;
|
||||
offset.y = 6;
|
||||
facing = ArcU.rand(0,1) == 0 ? LEFT : RIGHT;
|
||||
velocity.x = facing == LEFT ? -FLY_SPEED : FLY_SPEED;
|
||||
addAnimation("fly",[0,1,2,1],5,true);
|
||||
play("fly");
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(velocity.x == 0)
|
||||
{
|
||||
_moveSpeed = FLY_SPEED;
|
||||
go(facing == LEFT ? RIGHT : LEFT);
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/123_com.arc.dh.objects.enemies.Bird_sprite.png")]
|
||||
public class Bird_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Bird_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcSprite;
|
||||
import org.flixel.FlxG;
|
||||
import org.flixel.FlxPoint;
|
||||
|
||||
public class Blade extends Enemy
|
||||
{
|
||||
|
||||
private static const sprite:Class = Blade_sprite;
|
||||
|
||||
private static var BLADE_SPEED:int = 100;
|
||||
|
||||
private var _dir:int = 16;
|
||||
|
||||
private var _turnRightPoint:FlxPoint = new FlxPoint();
|
||||
|
||||
private var _turnLeftPoint:FlxPoint = new FlxPoint();
|
||||
|
||||
private var _spr:ArcSprite = new ArcSprite();
|
||||
|
||||
public function Blade(param1:Number, param2:Number, param3:int)
|
||||
{
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc5_:Number = NaN;
|
||||
_loc4_ = param1 * Config.BLOCK_SIZE;
|
||||
_loc5_ = param2 * Config.BLOCK_SIZE;
|
||||
_c = param1;
|
||||
_r = param2;
|
||||
super(_loc4_,_loc5_,param3);
|
||||
loadRotatedGraphic(sprite,32,-1,true,false);
|
||||
killable = false;
|
||||
width = 19;
|
||||
height = 19;
|
||||
offset.x = 4;
|
||||
offset.y = 4;
|
||||
x += 4;
|
||||
y += 4;
|
||||
this._spr.makeGraphic(12,12,4294901760);
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
angle += FlxG.elapsed * 200;
|
||||
switch(this._dir)
|
||||
{
|
||||
case RIGHT:
|
||||
velocity.x = BLADE_SPEED;
|
||||
velocity.y = 0;
|
||||
this._turnRightPoint.x = 0;
|
||||
this._turnRightPoint.y = 1;
|
||||
this._turnLeftPoint.x = 1;
|
||||
this._turnLeftPoint.y = 0;
|
||||
break;
|
||||
case DOWN:
|
||||
velocity.x = 0;
|
||||
velocity.y = BLADE_SPEED;
|
||||
this._turnRightPoint.x = -1;
|
||||
this._turnRightPoint.y = 1;
|
||||
this._turnLeftPoint.x = 0;
|
||||
this._turnLeftPoint.y = 1;
|
||||
break;
|
||||
case LEFT:
|
||||
velocity.x = -BLADE_SPEED;
|
||||
velocity.y = 0;
|
||||
this._turnRightPoint.x = 0;
|
||||
this._turnRightPoint.y = 0;
|
||||
this._turnLeftPoint.x = -1;
|
||||
this._turnLeftPoint.y = 0;
|
||||
break;
|
||||
case UP:
|
||||
velocity.x = 0;
|
||||
velocity.y = -BLADE_SPEED;
|
||||
this._turnRightPoint.x = 1;
|
||||
this._turnRightPoint.y = 0;
|
||||
this._turnLeftPoint.x = 0;
|
||||
this._turnLeftPoint.y = -1;
|
||||
}
|
||||
var _loc1_:int = (x - 4) / Config.BLOCK_SIZE + 1;
|
||||
var _loc2_:int = (y - 4) / Config.BLOCK_SIZE + 1;
|
||||
var _loc3_:uint = Data.state.tilemap.getTile(_loc1_ + this._turnRightPoint.x,_loc2_ + this._turnRightPoint.y);
|
||||
if(_loc3_ == 0)
|
||||
{
|
||||
switch(this._dir)
|
||||
{
|
||||
case RIGHT:
|
||||
this._dir = DOWN;
|
||||
break;
|
||||
case DOWN:
|
||||
this._dir = LEFT;
|
||||
x -= 4;
|
||||
break;
|
||||
case LEFT:
|
||||
this._dir = UP;
|
||||
break;
|
||||
case UP:
|
||||
this._dir = RIGHT;
|
||||
x += 4;
|
||||
}
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
|
||||
override public function draw() : void
|
||||
{
|
||||
super.draw();
|
||||
var _loc1_:int = x / Config.BLOCK_SIZE + 1;
|
||||
var _loc2_:int = y / Config.BLOCK_SIZE + 1;
|
||||
this._spr.x = _loc1_ * Config.BLOCK_SIZE;
|
||||
this._spr.y = _loc2_ * Config.BLOCK_SIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/107_com.arc.dh.objects.enemies.Blade_sprite.png")]
|
||||
public class Blade_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Blade_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.Color;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.dh.util.text.Avatar;
|
||||
import com.arc.dh.util.text.TextSystem;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
import com.arc.flixel.ArcU;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class Blob extends Boss
|
||||
{
|
||||
|
||||
private static const sprite:Class = Blob_sprite;
|
||||
|
||||
private static const SLIME_SPAWN_DELAY:Number = 5;
|
||||
|
||||
private static const EXPLODE_DELAY:Number = 4;
|
||||
|
||||
private static const EXPLODE_SEED_SPEED:Number = 100;
|
||||
|
||||
private var slimeTimer:Number = 1;
|
||||
|
||||
private var explodeTimer:Number = 4;
|
||||
|
||||
public function Blob(param1:Number, param2:Number)
|
||||
{
|
||||
super(param1,param2);
|
||||
loadRotatedGraphic(sprite,60,0,true,true);
|
||||
_moveSpeed = 30;
|
||||
hp = hpm = mode(5000,50000,80000);
|
||||
setPhases([75,50,25]);
|
||||
}
|
||||
|
||||
override public function intro() : Boolean
|
||||
{
|
||||
var _loc1_:Plant = null;
|
||||
go(RIGHT);
|
||||
this.spawnDots();
|
||||
if(heroic)
|
||||
{
|
||||
_loc1_ = new Plant(1,14,1,RIGHT);
|
||||
_loc1_.goldenize();
|
||||
Data.state.enemies.add(_loc1_);
|
||||
spawnBurst(_loc1_.getMidpoint().x,_loc1_.getMidpoint().y);
|
||||
_loc1_ = new Plant(28,14,1,LEFT);
|
||||
_loc1_.goldenize();
|
||||
Data.state.enemies.add(_loc1_);
|
||||
spawnBurst(_loc1_.getMidpoint().x,_loc1_.getMidpoint().y);
|
||||
}
|
||||
super.intro();
|
||||
return true;
|
||||
}
|
||||
|
||||
override public function outro() : Boolean
|
||||
{
|
||||
var _loc1_:Enemy = null;
|
||||
for each(_loc1_ in Data.state.enemies.members)
|
||||
{
|
||||
if(!(_loc1_ is Boss))
|
||||
{
|
||||
_loc1_.silentKill();
|
||||
}
|
||||
}
|
||||
super.outro();
|
||||
return true;
|
||||
}
|
||||
|
||||
override public function engaged() : Boolean
|
||||
{
|
||||
var _loc1_:Tadpole = null;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
this.slimeTimer -= FlxG.elapsed;
|
||||
if(this.slimeTimer <= 0)
|
||||
{
|
||||
this.slimeTimer = SLIME_SPAWN_DELAY;
|
||||
_loc1_ = new Tadpole(15,3,mode(50,20,30));
|
||||
_loc1_.goldenize();
|
||||
Data.state.enemies.add(_loc1_);
|
||||
}
|
||||
angle += FlxG.elapsed * 100;
|
||||
if(phase >= mode(3,3,2))
|
||||
{
|
||||
this.explodeTimer -= FlxG.elapsed;
|
||||
if(this.explodeTimer <= 0)
|
||||
{
|
||||
this.explodeTimer = EXPLODE_DELAY - mode(0,0,2);
|
||||
_loc2_ = getMidpoint().x;
|
||||
_loc3_ = getMidpoint().y;
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < 360)
|
||||
{
|
||||
this.shootSeed(_loc2_,_loc3_,_loc4_);
|
||||
_loc4_ += mode(30,30,20);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(x > 290)
|
||||
{
|
||||
this.burst();
|
||||
if(facing == RIGHT)
|
||||
{
|
||||
x = 325;
|
||||
y = 46;
|
||||
go(LEFT);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 26;
|
||||
y = 46;
|
||||
go(RIGHT);
|
||||
}
|
||||
this.burst();
|
||||
}
|
||||
super.engaged();
|
||||
return false;
|
||||
}
|
||||
|
||||
private function shootSeed(param1:int, param2:int, param3:int) : void
|
||||
{
|
||||
var _loc4_:Number = param3 * Math.PI / 180;
|
||||
var _loc5_:Seed = new Seed(param1,param2,1);
|
||||
_loc5_.velocity.x = EXPLODE_SEED_SPEED * Math.cos(_loc4_);
|
||||
_loc5_.velocity.y = EXPLODE_SEED_SPEED * Math.sin(_loc4_);
|
||||
Data.state.enemies.add(_loc5_);
|
||||
}
|
||||
|
||||
private function burst() : void
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.BLUE,getMidpoint().x,getMidpoint().y,20,1,1,0,-50,50,-50,50);
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.YELLOW,getMidpoint().x,getMidpoint().y,20,1,1,0,-50,50,-50,50);
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
super.kill();
|
||||
}
|
||||
|
||||
private function spawnDots() : void
|
||||
{
|
||||
var _loc1_:Enemy = null;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:BlobDot = null;
|
||||
for each(_loc1_ in Data.state.enemies.members)
|
||||
{
|
||||
if(_loc1_ is BlobDot)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < 4)
|
||||
{
|
||||
this.shootSeed(_loc1_.x + 7,_loc1_.y + 7,ArcU.rand(_loc3_ * 90,(_loc3_ + 1) * 90));
|
||||
_loc3_++;
|
||||
}
|
||||
_loc1_.kill();
|
||||
}
|
||||
}
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < 360)
|
||||
{
|
||||
_loc4_ = new BlobDot(0,0,_loc2_,this,phase == 0 ? 0 : int(phase - 1),mode(1,20,50));
|
||||
if(phase >= 3)
|
||||
{
|
||||
_loc4_.missileonly = true;
|
||||
_loc4_.hpm = _loc4_.hp = 1;
|
||||
}
|
||||
Data.state.enemies.add(_loc4_);
|
||||
_loc2_ += 30;
|
||||
}
|
||||
}
|
||||
|
||||
override public function changePhase(param1:int) : void
|
||||
{
|
||||
var _loc5_:CeilingPlant = null;
|
||||
var _loc6_:Plant = null;
|
||||
var _loc7_:Tadpole = null;
|
||||
switch(param1)
|
||||
{
|
||||
case 2:
|
||||
_loc5_ = new CeilingPlant(5,2,1);
|
||||
_loc5_.goldenize();
|
||||
Data.state.enemies.add(_loc5_);
|
||||
spawnBurst(_loc5_.getMidpoint().x,_loc5_.getMidpoint().y);
|
||||
_loc5_ = new CeilingPlant(24,2,1);
|
||||
_loc5_.goldenize();
|
||||
Data.state.enemies.add(_loc5_);
|
||||
spawnBurst(_loc5_.getMidpoint().x,_loc5_.getMidpoint().y);
|
||||
break;
|
||||
case 3:
|
||||
if(heroic)
|
||||
{
|
||||
_loc6_ = new Plant(1,12,1,RIGHT);
|
||||
_loc6_.goldenize();
|
||||
Data.state.enemies.add(_loc6_);
|
||||
spawnBurst(_loc6_.getMidpoint().x,_loc6_.getMidpoint().y);
|
||||
_loc6_ = new Plant(28,12,1,LEFT);
|
||||
_loc6_.goldenize();
|
||||
Data.state.enemies.add(_loc6_);
|
||||
spawnBurst(_loc6_.getMidpoint().x,_loc6_.getMidpoint().y);
|
||||
}
|
||||
TextSystem.display(Avatar.SAGA,"His barrier appears to be thickening. You may need to use missiles to break through it!");
|
||||
break;
|
||||
case 4:
|
||||
_loc6_ = new Plant(1,16,1,RIGHT);
|
||||
_loc6_.goldenize();
|
||||
Data.state.enemies.add(_loc6_);
|
||||
spawnBurst(_loc6_.getMidpoint().x,_loc6_.getMidpoint().y);
|
||||
_loc6_ = new Plant(28,16,1,LEFT);
|
||||
_loc6_.goldenize();
|
||||
Data.state.enemies.add(_loc6_);
|
||||
spawnBurst(_loc6_.getMidpoint().x,_loc6_.getMidpoint().y);
|
||||
}
|
||||
this.spawnDots();
|
||||
loadRotatedGraphic(sprite,60,phase - 1,true,true);
|
||||
var _loc2_:int = getMidpoint().x;
|
||||
var _loc3_:int = getMidpoint().y;
|
||||
var _loc4_:int = 0;
|
||||
while(_loc4_ < 360)
|
||||
{
|
||||
_loc7_ = new Tadpole(_loc2_,_loc3_,mode(20,20,30));
|
||||
_loc7_.x = _loc2_ - _loc7_.width / 2;
|
||||
_loc7_.y = _loc3_ - _loc7_.height / 2;
|
||||
_loc7_.move(_loc4_);
|
||||
Data.state.enemies.add(_loc7_);
|
||||
_loc4_ += 60;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import org.flixel.FlxG;
|
||||
import org.flixel.FlxPoint;
|
||||
|
||||
public class BlobDot extends Enemy
|
||||
{
|
||||
|
||||
private static const sprite:Class = BlobDot_sprite;
|
||||
|
||||
private static const SPEED:int = 100;
|
||||
|
||||
private static const ROTATION_SPEED:Number = 150;
|
||||
|
||||
private var degrees:int = 0;
|
||||
|
||||
private var blob:Blob;
|
||||
|
||||
private var _distance:Number = 0;
|
||||
|
||||
public function BlobDot(param1:int, param2:int, param3:int, param4:Blob, param5:int, param6:int)
|
||||
{
|
||||
super(param1,param2,param6);
|
||||
this.blob = param4;
|
||||
this.degrees = param3;
|
||||
loadGraphic(sprite,true,false,14,14);
|
||||
frame = param5;
|
||||
healthbar.kill();
|
||||
healthbar = null;
|
||||
}
|
||||
|
||||
public function move(param1:int) : void
|
||||
{
|
||||
var _loc2_:Number = NaN;
|
||||
var _loc3_:FlxPoint = null;
|
||||
_loc2_ = Math.PI / 180 * param1;
|
||||
_loc3_ = this.blob.getMidpoint();
|
||||
x = _loc3_.x + this._distance * Math.cos(_loc2_) - 7;
|
||||
y = _loc3_.y + this._distance * Math.sin(_loc2_) - 7;
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(this._distance < 30)
|
||||
{
|
||||
this._distance += FlxG.elapsed * 50;
|
||||
}
|
||||
this.degrees += ROTATION_SPEED * FlxG.elapsed;
|
||||
this.move(this.degrees);
|
||||
super.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/51_com.arc.dh.objects.enemies.BlobDot_sprite.png")]
|
||||
public class BlobDot_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function BlobDot_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/213_com.arc.dh.objects.enemies.Blob_sprite.png")]
|
||||
public class Blob_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Blob_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.Color;
|
||||
import com.arc.dh.objects.Healthbar;
|
||||
import com.arc.dh.state.BossMode;
|
||||
import com.arc.dh.state.StoryMode;
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.dh.util.text.TextSystem;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
import com.arc.flixel.ArcU;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class Boss extends Enemy
|
||||
{
|
||||
|
||||
protected static const STATE_UNENGAGED:int = 0;
|
||||
|
||||
protected static const STATE_INTRO:int = 1;
|
||||
|
||||
protected static const STATE_ENGAGED:int = 2;
|
||||
|
||||
protected static const STATE_OUTRO:int = 3;
|
||||
|
||||
protected static const STATE_PENDING:int = 4;
|
||||
|
||||
protected static const STATE_COMPLETE:int = 5;
|
||||
|
||||
protected static const PENDING_DELAY:Number = 4;
|
||||
|
||||
private static const SEED_SPEED:int = 100;
|
||||
|
||||
protected var state:int = 0;
|
||||
|
||||
protected var phases:Array = new Array();
|
||||
|
||||
protected var previousPhase:int = 100;
|
||||
|
||||
protected var phase:int = 0;
|
||||
|
||||
public var bosshealthbar:Healthbar;
|
||||
|
||||
protected var pendingTimer:Number = 4;
|
||||
|
||||
public function Boss(param1:Number, param2:Number)
|
||||
{
|
||||
var _loc3_:Number = param1 * Config.BLOCK_SIZE;
|
||||
var _loc4_:Number = param2 * Config.BLOCK_SIZE;
|
||||
_c = param1;
|
||||
_r = param2;
|
||||
super(_loc3_,_loc4_,1);
|
||||
killable = false;
|
||||
healthbar.kill();
|
||||
healthbar = null;
|
||||
this.bosshealthbar = new Healthbar();
|
||||
this.bosshealthbar.alpha = 0;
|
||||
Data.state.healthbars.add(this.bosshealthbar);
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
var _loc1_:Function = null;
|
||||
switch(this.state)
|
||||
{
|
||||
case STATE_UNENGAGED:
|
||||
_loc1_ = this.unengaged;
|
||||
break;
|
||||
case STATE_INTRO:
|
||||
_loc1_ = this.intro;
|
||||
break;
|
||||
case STATE_ENGAGED:
|
||||
_loc1_ = this.engaged;
|
||||
break;
|
||||
case STATE_OUTRO:
|
||||
_loc1_ = this.outro;
|
||||
break;
|
||||
case STATE_PENDING:
|
||||
_loc1_ = this.pending;
|
||||
break;
|
||||
case STATE_COMPLETE:
|
||||
_loc1_ = null;
|
||||
}
|
||||
if(_loc1_ != null && Boolean(_loc1_()))
|
||||
{
|
||||
++this.state;
|
||||
if(this.state == STATE_ENGAGED)
|
||||
{
|
||||
killable = true;
|
||||
this.phase = 1;
|
||||
}
|
||||
else if(this.state == STATE_COMPLETE)
|
||||
{
|
||||
Data.state.complete();
|
||||
}
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
|
||||
protected function get hpp() : int
|
||||
{
|
||||
return hp / hpm * 100;
|
||||
}
|
||||
|
||||
public function unengaged() : Boolean
|
||||
{
|
||||
return Data.state.boss == 2;
|
||||
}
|
||||
|
||||
public function intro() : Boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function engaged() : Boolean
|
||||
{
|
||||
if(this.phases.length > 0 && this.hpp < this.phases[0])
|
||||
{
|
||||
this.previousPhase = this.phases.shift();
|
||||
++this.phase;
|
||||
this.changePhase(this.phase);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function outro() : Boolean
|
||||
{
|
||||
this.state = STATE_PENDING;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function pending() : Boolean
|
||||
{
|
||||
this.pendingTimer -= FlxG.elapsed;
|
||||
if(TextSystem.active() || this.pendingTimer > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setPhases(param1:Array) : void
|
||||
{
|
||||
this.phases = param1;
|
||||
}
|
||||
|
||||
public function changePhase(param1:int) : void
|
||||
{
|
||||
}
|
||||
|
||||
override public function draw() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
var _loc2_:Number = NaN;
|
||||
super.draw();
|
||||
if(this.bosshealthbar != null)
|
||||
{
|
||||
_loc1_ = this.phases.length > 0 ? int(this.phases[0]) : 0;
|
||||
if(this.phases.length > 0)
|
||||
{
|
||||
this.bosshealthbar.bar.play("gold");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.bosshealthbar.bar.play("red");
|
||||
}
|
||||
_loc2_ = (100 * hp / hpm - _loc1_) / (this.previousPhase - _loc1_);
|
||||
if(healthbarOffset == 0)
|
||||
{
|
||||
healthbarOffset = Math.round(width / 2 - Healthbar.WIDTH / 2);
|
||||
}
|
||||
this.bosshealthbar.scale(_loc2_);
|
||||
this.bosshealthbar.move(x + healthbarOffset,y - 7,1);
|
||||
}
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
if(this.bosshealthbar != null)
|
||||
{
|
||||
this.bosshealthbar.kill();
|
||||
}
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.RED,x,y,20,2,1,0,-50,50,-50,50);
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.BLACK,x,y,20,2,1,0,-50,50,-50,50);
|
||||
var _loc1_:int = ArcU.rand(7,13);
|
||||
var _loc2_:int = 2 * Data.state.chapter;
|
||||
if(Data.state is BossMode && (Data.state as BossMode).isHeroic())
|
||||
{
|
||||
_loc2_ *= 3;
|
||||
}
|
||||
if(!(Data.state is BossMode && (Data.state as BossMode).isPractice()))
|
||||
{
|
||||
Data.state.addDiamonds(x,y,_loc1_ + _loc2_,0);
|
||||
if(Data.state is BossMode)
|
||||
{
|
||||
Data.state.createHeart(x - 5,y);
|
||||
Data.state.createHeart(x,y - 10);
|
||||
Data.state.createHeart(x + 5,y);
|
||||
}
|
||||
}
|
||||
visible = false;
|
||||
solid = false;
|
||||
velocity.x = velocity.y = 0;
|
||||
acceleration.x = acceleration.y = 0;
|
||||
this.outro();
|
||||
}
|
||||
|
||||
protected function spawnBurst(param1:int, param2:int) : void
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.RED,param1,param2,20,1,1,0,-50,50,-50,50);
|
||||
}
|
||||
|
||||
protected function mode(param1:Number, param2:Number, param3:Number) : Number
|
||||
{
|
||||
if(Data.state is StoryMode)
|
||||
{
|
||||
return param1;
|
||||
}
|
||||
if(this.heroic)
|
||||
{
|
||||
return param3;
|
||||
}
|
||||
return param2;
|
||||
}
|
||||
|
||||
protected function get heroic() : Boolean
|
||||
{
|
||||
return Data.state is BossMode && (Data.state as BossMode).isHeroic();
|
||||
}
|
||||
|
||||
protected function shoot(param1:int, param2:int, param3:int, param4:int = 1) : Seed
|
||||
{
|
||||
var _loc5_:Number = param3 * Math.PI / 180;
|
||||
var _loc6_:Seed = new Seed(param1,param2,param4);
|
||||
_loc6_.velocity.x = SEED_SPEED * Math.cos(_loc5_);
|
||||
_loc6_.velocity.y = SEED_SPEED * Math.sin(_loc5_);
|
||||
Data.state.enemies.add(_loc6_);
|
||||
return _loc6_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.state.HorizontalMode;
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcU;
|
||||
|
||||
public class BouncingSlime extends Enemy
|
||||
{
|
||||
|
||||
private static const sprite:Class = BouncingSlime_sprite;
|
||||
|
||||
public var _jumping:Boolean = false;
|
||||
|
||||
public function BouncingSlime(param1:Number, param2:Number, param3:int)
|
||||
{
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc5_:Number = NaN;
|
||||
_loc4_ = param1 * Config.BLOCK_SIZE;
|
||||
_loc5_ = param2 * Config.BLOCK_SIZE;
|
||||
_c = param1;
|
||||
_r = param2;
|
||||
super(_loc4_,_loc5_,param3);
|
||||
loadGraphic(sprite,true,true,14,11);
|
||||
facing = ArcU.rand(0,1) == 0 ? LEFT : RIGHT;
|
||||
if(Data.state is HorizontalMode)
|
||||
{
|
||||
facing = RIGHT;
|
||||
}
|
||||
velocity.x = facing == LEFT ? -MOVE_SPEED : MOVE_SPEED;
|
||||
width = 10;
|
||||
offset.x = 2;
|
||||
y += 1;
|
||||
hittable = true;
|
||||
acceleration.y = 400;
|
||||
var _loc6_:int = ArcU.rand(0,11);
|
||||
addAnimation("walk",[_loc6_ * 2,_loc6_ * 2 + 1],5,true);
|
||||
play("walk");
|
||||
}
|
||||
|
||||
override public function unhit() : void
|
||||
{
|
||||
go(_hitDirection);
|
||||
super.unhit();
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:uint = 0;
|
||||
if(!_hit)
|
||||
{
|
||||
_loc1_ = x / Config.BLOCK_SIZE + (velocity.x > 0 ? 1 : 0);
|
||||
_loc2_ = y / Config.BLOCK_SIZE + 1;
|
||||
_loc3_ = Data.state.tilemap.getTile(_loc1_,_loc2_);
|
||||
if(_loc3_ == 0 && !this._jumping)
|
||||
{
|
||||
velocity.y = -250;
|
||||
this._jumping = true;
|
||||
}
|
||||
else if(velocity.x == 0)
|
||||
{
|
||||
go(facing == LEFT ? RIGHT : LEFT);
|
||||
}
|
||||
if(touching & DOWN)
|
||||
{
|
||||
this._jumping = false;
|
||||
}
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/73_com.arc.dh.objects.enemies.BouncingSlime_sprite.png")]
|
||||
public class BouncingSlime_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function BouncingSlime_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.state.HorizontalMode;
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcU;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class CeilingPlant extends Enemy
|
||||
{
|
||||
|
||||
private static const sprite:Class = CeilingPlant_sprite;
|
||||
|
||||
private static const spriteGold:Class = CeilingPlant_spriteGold;
|
||||
|
||||
private static const SHOOT_TIME:Number = 3;
|
||||
|
||||
private var _shootTimer:Number = ArcU.rand(10,SHOOT_TIME * 10) / 10;
|
||||
|
||||
public function CeilingPlant(param1:Number, param2:Number, param3:int)
|
||||
{
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc5_:Number = NaN;
|
||||
_loc4_ = param1 * Config.BLOCK_SIZE;
|
||||
_loc5_ = param2 * Config.BLOCK_SIZE - 13;
|
||||
_c = param1;
|
||||
_r = param2;
|
||||
super(_loc4_,_loc5_,param3);
|
||||
loadGraphic(sprite,true,true,19,14);
|
||||
addAnimation("idle",[0]);
|
||||
addAnimation("shoot",[1,2,3],6,false);
|
||||
addAnimation("unshoot",[3,2,1,0],6,false);
|
||||
play("idle");
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
var _loc1_:Seed = null;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc6_:Number = NaN;
|
||||
this._shootTimer -= FlxG.elapsed;
|
||||
if(this._shootTimer <= 0 && getScreenXY().y >= 0)
|
||||
{
|
||||
play("shoot");
|
||||
this._shootTimer = SHOOT_TIME + ArcU.rand(0,SHOOT_TIME * 50) / 100;
|
||||
}
|
||||
else if(this._shootTimer <= 0)
|
||||
{
|
||||
this._shootTimer = SHOOT_TIME / 10 + ArcU.rand(0,SHOOT_TIME * 50) / 100;
|
||||
}
|
||||
if(_curAnim.name == "shoot" && finished)
|
||||
{
|
||||
play("unshoot");
|
||||
_loc1_ = new Seed(x + width / 2 - 3,y + 8,level);
|
||||
_loc2_ = Data.state.player.x + Data.state.player.width / 2;
|
||||
_loc3_ = Data.state.player.y + Data.state.player.height / 2;
|
||||
_loc4_ = _loc1_.x + _loc1_.width / 2;
|
||||
_loc5_ = _loc1_.y + _loc1_.height / 2;
|
||||
_loc6_ = Math.atan2(_loc3_ - _loc5_,_loc2_ - _loc4_);
|
||||
_loc1_.velocity.x = 120 * Math.cos(_loc6_);
|
||||
_loc1_.velocity.y = 120 * Math.sin(_loc6_);
|
||||
if(Data.state is HorizontalMode)
|
||||
{
|
||||
_loc1_.velocity.x += (Data.state as HorizontalMode).camera.velocity.x;
|
||||
}
|
||||
Data.state.enemies.add(_loc1_);
|
||||
}
|
||||
if(_curAnim.name == "unshoot" && finished)
|
||||
{
|
||||
play("idle");
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
|
||||
override public function goldenize() : void
|
||||
{
|
||||
killable = false;
|
||||
loadGraphic(spriteGold,true,true,19,14);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/121_com.arc.dh.objects.enemies.CeilingPlant_sprite.png")]
|
||||
public class CeilingPlant_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function CeilingPlant_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/224_com.arc.dh.objects.enemies.CeilingPlant_spriteGold.png")]
|
||||
public class CeilingPlant_spriteGold extends BitmapAsset
|
||||
{
|
||||
|
||||
public function CeilingPlant_spriteGold()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcU;
|
||||
|
||||
public class ClimbingSlime extends Enemy
|
||||
{
|
||||
|
||||
private static const sprite:Class = ClimbingSlime_sprite;
|
||||
|
||||
private var _jumping:Boolean = false;
|
||||
|
||||
public function ClimbingSlime(param1:Number, param2:Number, param3:int)
|
||||
{
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc5_:Number = NaN;
|
||||
_loc4_ = param1 * Config.BLOCK_SIZE;
|
||||
_loc5_ = param2 * Config.BLOCK_SIZE;
|
||||
_c = param1;
|
||||
_r = param2;
|
||||
super(_loc4_,_loc5_,param3);
|
||||
loadGraphic(sprite,true,true,14,11);
|
||||
facing = ArcU.rand(0,1) == 0 ? LEFT : RIGHT;
|
||||
velocity.x = facing == LEFT ? -MOVE_SPEED : MOVE_SPEED;
|
||||
width = 10;
|
||||
offset.x = 2;
|
||||
y += 1;
|
||||
hittable = true;
|
||||
acceleration.y = 400;
|
||||
var _loc6_:int = ArcU.rand(0,11);
|
||||
addAnimation("walk",[_loc6_ * 2,_loc6_ * 2 + 1],5,true);
|
||||
play("walk");
|
||||
}
|
||||
|
||||
override public function unhit() : void
|
||||
{
|
||||
go(_hitDirection);
|
||||
super.unhit();
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:uint = 0;
|
||||
var _loc4_:int = 0;
|
||||
if(!_hit)
|
||||
{
|
||||
_loc1_ = x / Config.BLOCK_SIZE + (velocity.x > 0 ? 1 : 0);
|
||||
_loc2_ = y / Config.BLOCK_SIZE + 1;
|
||||
_loc3_ = Data.state.tilemap.getTile(_loc1_,_loc2_);
|
||||
if(_loc3_ == 0 && !this._jumping)
|
||||
{
|
||||
velocity.y = -100;
|
||||
this._jumping = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_ = facing == RIGHT ? 3 : -2;
|
||||
_loc1_ = x / Config.BLOCK_SIZE + _loc4_;
|
||||
_loc2_ = y / Config.BLOCK_SIZE;
|
||||
if(_loc1_ < Config.BLOCK_WIDTH && _loc1_ > 0 && Data.state.tilemap.getTile(_loc1_,_loc2_) != 0 && !this._jumping)
|
||||
{
|
||||
if(Data.state.tilemap.getTile(_loc1_,_loc2_ - 4) == 0 && Data.state.tilemap.getTile(_loc1_ - _loc4_,_loc2_ - 4) == 0)
|
||||
{
|
||||
velocity.y = -200;
|
||||
this._jumping = true;
|
||||
}
|
||||
else if(Data.state.tilemap.getTile(_loc1_,_loc2_ - 3) == 0 && Data.state.tilemap.getTile(_loc1_ - _loc4_,_loc2_ - 3) == 0)
|
||||
{
|
||||
velocity.y = -160;
|
||||
this._jumping = true;
|
||||
}
|
||||
else if(Data.state.tilemap.getTile(_loc1_,_loc2_ - 2) == 0 && Data.state.tilemap.getTile(_loc1_ - _loc4_,_loc2_ - 2) == 0)
|
||||
{
|
||||
velocity.y = -120;
|
||||
this._jumping = true;
|
||||
}
|
||||
else if(Data.state.tilemap.getTile(_loc1_,_loc2_ - 1) == 0 && Data.state.tilemap.getTile(_loc1_ - _loc4_,_loc2_ - 1) == 0)
|
||||
{
|
||||
velocity.y = 0;
|
||||
this._jumping = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(velocity.x == 0)
|
||||
{
|
||||
go(facing == LEFT ? RIGHT : LEFT);
|
||||
}
|
||||
if(Boolean(touching & DOWN) && velocity.y >= 0)
|
||||
{
|
||||
this._jumping = false;
|
||||
}
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/283_com.arc.dh.objects.enemies.ClimbingSlime_sprite.png")]
|
||||
public class ClimbingSlime_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function ClimbingSlime_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcU;
|
||||
|
||||
public class DiveBird extends Enemy
|
||||
{
|
||||
|
||||
private static const sprite:Class = DiveBird_sprite;
|
||||
|
||||
private static const FLY_SPEED:Number = 180;
|
||||
|
||||
public function DiveBird(param1:Number, param2:Number, param3:int, param4:int)
|
||||
{
|
||||
var _loc5_:Number = NaN;
|
||||
var _loc6_:Number = NaN;
|
||||
_loc5_ = param1 * Config.BLOCK_SIZE;
|
||||
_loc6_ = param2 * Config.BLOCK_SIZE;
|
||||
_c = param1;
|
||||
_r = param2;
|
||||
super(_loc5_,_loc6_,param3);
|
||||
loadGraphic(sprite,true,true,33,18);
|
||||
width = 20;
|
||||
height = 11;
|
||||
offset.x = 6;
|
||||
offset.y = 6;
|
||||
facing = param4;
|
||||
var _loc7_:int = int(facing);
|
||||
this.goAt(ArcU.rand(30,130) / 200);
|
||||
if(_loc7_ == LEFT)
|
||||
{
|
||||
facing = LEFT;
|
||||
velocity.x *= -1;
|
||||
}
|
||||
velocity.y = ArcU.rand(10,40);
|
||||
killable = false;
|
||||
alpha = 0.5;
|
||||
addAnimation("fly",[0,1,2,1],5,true);
|
||||
play("fly");
|
||||
}
|
||||
|
||||
private function goAt(param1:Number) : void
|
||||
{
|
||||
velocity.x = FLY_SPEED * Math.cos(param1);
|
||||
velocity.y = FLY_SPEED * Math.sin(param1);
|
||||
facing = velocity.x < 0 ? LEFT : RIGHT;
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
if(velocity.x == 0)
|
||||
{
|
||||
this.goAt(Math.atan2(Data.state.player.y - y,Data.state.player.x - x));
|
||||
killable = true;
|
||||
alpha = 1;
|
||||
}
|
||||
if(velocity.y == 0)
|
||||
{
|
||||
_loc1_ = int(facing);
|
||||
this.goAt(-ArcU.rand(80,200) / 200);
|
||||
if(_loc1_ == LEFT)
|
||||
{
|
||||
facing = LEFT;
|
||||
velocity.x *= -1;
|
||||
}
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/46_com.arc.dh.objects.enemies.DiveBird_sprite.png")]
|
||||
public class DiveBird_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function DiveBird_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,271 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.Color;
|
||||
import com.arc.dh.entities.Entity;
|
||||
import com.arc.dh.objects.Bullet;
|
||||
import com.arc.dh.objects.Diamond;
|
||||
import com.arc.dh.objects.Healthbar;
|
||||
import com.arc.dh.objects.Missile;
|
||||
import com.arc.dh.state.BossMode;
|
||||
import com.arc.dh.state.EscapeMode;
|
||||
import com.arc.dh.state.HorizontalMode;
|
||||
import com.arc.dh.util.AchievementSystem;
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.dh.util.Sound;
|
||||
import com.arc.dh.util.SoundSystem;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
import com.arc.flixel.ArcU;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class Enemy extends Entity
|
||||
{
|
||||
|
||||
public static const MOVE_SPEED:int = 50;
|
||||
|
||||
protected static const BASE_HP:int = 50;
|
||||
|
||||
public static const FLASH_TIME:Number = 0.05;
|
||||
|
||||
protected var _moveSpeed:int = 50;
|
||||
|
||||
public var hp:int = 100;
|
||||
|
||||
public var hpm:int = 100;
|
||||
|
||||
public var flashTimer:Number = 0;
|
||||
|
||||
public var level:int = 1;
|
||||
|
||||
public var killable:Boolean = true;
|
||||
|
||||
public var pierce:Boolean = false;
|
||||
|
||||
protected var _hit:Boolean = false;
|
||||
|
||||
protected var _hitDirection:int = 0;
|
||||
|
||||
public var hittable:Boolean = false;
|
||||
|
||||
public var missileonly:Boolean = false;
|
||||
|
||||
public var bossenemy:Boolean = false;
|
||||
|
||||
protected var healthbar:Healthbar;
|
||||
|
||||
protected var healthbarOffset:int = 0;
|
||||
|
||||
protected var healthbarAlpha:Number = 0;
|
||||
|
||||
protected var _c:int;
|
||||
|
||||
protected var _r:int;
|
||||
|
||||
protected var _pixel:uint;
|
||||
|
||||
private var outsideFunction:Function;
|
||||
|
||||
public function Enemy(param1:Number, param2:Number, param3:int, param4:Boolean = true)
|
||||
{
|
||||
super(param1,param2);
|
||||
this.level = param3;
|
||||
this.hp = BASE_HP + (this.level - 1) * 5 * (Data.state is BossMode ? 10 : 1);
|
||||
this.hpm = this.hp;
|
||||
Data.state.spawner[this._c + "," + this._r] = true;
|
||||
this.killable = param4;
|
||||
if(this.killable)
|
||||
{
|
||||
this.healthbar = new Healthbar();
|
||||
this.healthbar.visible = false;
|
||||
this.healthbar.alpha = 0;
|
||||
Data.state.healthbars.add(this.healthbar);
|
||||
}
|
||||
if(Data.state is HorizontalMode)
|
||||
{
|
||||
this.outsideFunction = this.runmodeOutside;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.outsideFunction = this.playmodeOutside;
|
||||
}
|
||||
}
|
||||
|
||||
private function runmodeOutside() : Boolean
|
||||
{
|
||||
var _loc1_:int = x / Config.BLOCK_SIZE;
|
||||
if(_loc1_ <= Data.state.despawnTop - 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function playmodeOutside() : Boolean
|
||||
{
|
||||
var _loc1_:int = y / Config.BLOCK_SIZE;
|
||||
if(_loc1_ >= Data.state.despawnBottom + 2 || _loc1_ <= Data.state.despawnTop - 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(this.outsideFunction())
|
||||
{
|
||||
Data.state.spawner[this._c + "," + this._r] = null;
|
||||
exists = false;
|
||||
alive = false;
|
||||
if(this.healthbar != null)
|
||||
{
|
||||
this.healthbar.kill();
|
||||
}
|
||||
if(this is Boss && (this as Boss).bosshealthbar != null)
|
||||
{
|
||||
(this as Boss).bosshealthbar.kill();
|
||||
}
|
||||
}
|
||||
if(this.flashTimer > 0)
|
||||
{
|
||||
this.flashTimer -= FlxG.elapsed;
|
||||
color = 12268339;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = 16777215;
|
||||
}
|
||||
if(Boolean(touching & DOWN) && Boolean(this._hit) && velocity.y == 0)
|
||||
{
|
||||
this.unhit();
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
|
||||
public function flash() : void
|
||||
{
|
||||
this.flashTimer = FLASH_TIME;
|
||||
}
|
||||
|
||||
public function hit(param1:int) : void
|
||||
{
|
||||
if(!this.hittable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(param1 == LEFT)
|
||||
{
|
||||
velocity.x = -120;
|
||||
velocity.y = -60;
|
||||
}
|
||||
else
|
||||
{
|
||||
velocity.x = 120;
|
||||
velocity.y = -60;
|
||||
}
|
||||
y -= 2;
|
||||
this._hit = true;
|
||||
this._hitDirection = param1;
|
||||
}
|
||||
|
||||
public function unhit() : void
|
||||
{
|
||||
this._hit = false;
|
||||
}
|
||||
|
||||
public function damage(param1:int, param2:Bullet = null) : void
|
||||
{
|
||||
if(this.missileonly && !(param2 is Missile))
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.flash();
|
||||
this.hp -= param1;
|
||||
if(this.hp <= 0)
|
||||
{
|
||||
this.kill();
|
||||
}
|
||||
else if(this.healthbar != null)
|
||||
{
|
||||
this.healthbar.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
if(Data.state.boss == 0)
|
||||
{
|
||||
++Data.state.cenemies;
|
||||
++Data.enemies;
|
||||
AchievementSystem.enemies();
|
||||
SoundSystem.play(Sound["EXPLODE" + ArcU.rand(1,5)]);
|
||||
Data.state.despawn(this._c,this._r);
|
||||
if(ArcU.rand(1,20) == 5)
|
||||
{
|
||||
Data.state.createHeart(x,y);
|
||||
}
|
||||
Data.state.addDiamonds(x,y,ArcU.rand(2,Diamond.valueFromLevel(this.level) * 3 * (Data.state is EscapeMode ? 1 : 1) * (Data.state is HorizontalMode ? 0.6 : 1)));
|
||||
}
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.RED,getMidpoint().x,getMidpoint().y,5,1,0.3,0,-50,50,-50,50);
|
||||
if(this.healthbar != null)
|
||||
{
|
||||
this.healthbar.kill();
|
||||
}
|
||||
super.kill();
|
||||
}
|
||||
|
||||
override public function draw() : void
|
||||
{
|
||||
super.draw();
|
||||
if(this.healthbar != null && this.healthbar.visible)
|
||||
{
|
||||
if(this.healthbarAlpha < 1)
|
||||
{
|
||||
this.healthbarAlpha += FlxG.elapsed * 5;
|
||||
}
|
||||
if(this.healthbarOffset == 0)
|
||||
{
|
||||
this.healthbarOffset = Math.round(width / 2 - Healthbar.WIDTH / 2);
|
||||
}
|
||||
this.healthbar.scale(this.hp / this.hpm);
|
||||
this.healthbar.move(x + this.healthbarOffset,y - 7,this.healthbarAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
protected function reverse() : void
|
||||
{
|
||||
this.go(facing == LEFT ? RIGHT : LEFT);
|
||||
}
|
||||
|
||||
protected function go(param1:uint) : void
|
||||
{
|
||||
facing = param1;
|
||||
if(param1 == LEFT)
|
||||
{
|
||||
velocity.x = -this._moveSpeed;
|
||||
x = x - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
velocity.x = this._moveSpeed;
|
||||
x += 1;
|
||||
}
|
||||
}
|
||||
|
||||
public function silentKill() : void
|
||||
{
|
||||
exists = false;
|
||||
alive = false;
|
||||
visible = false;
|
||||
if(this.healthbar != null)
|
||||
{
|
||||
this.healthbar.kill();
|
||||
}
|
||||
}
|
||||
|
||||
public function goldenize() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcU;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class FloorPlant extends Enemy
|
||||
{
|
||||
|
||||
private static const sprite:Class = FloorPlant_sprite;
|
||||
|
||||
private static const spriteGold:Class = FloorPlant_spriteGold;
|
||||
|
||||
private static const SHOOT_TIME:Number = 3;
|
||||
|
||||
private var _shootTimer:Number = 3;
|
||||
|
||||
public function FloorPlant(param1:Number, param2:Number, param3:int)
|
||||
{
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc5_:Number = NaN;
|
||||
_loc4_ = param1 * Config.BLOCK_SIZE;
|
||||
_loc5_ = param2 * Config.BLOCK_SIZE + 3;
|
||||
_c = param1;
|
||||
_r = param2;
|
||||
super(_loc4_,_loc5_,param3);
|
||||
loadGraphic(sprite,true,true,19,9);
|
||||
addAnimation("idle",[0]);
|
||||
addAnimation("shoot",[1,2,3,4],10,false);
|
||||
addAnimation("unshoot",[4,3,2,1,0],10,false);
|
||||
play("idle");
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
var _loc1_:Number = NaN;
|
||||
var _loc2_:Seed = null;
|
||||
var _loc3_:Number = NaN;
|
||||
this._shootTimer -= FlxG.elapsed;
|
||||
if(this._shootTimer <= 0 && getScreenXY().y >= 0)
|
||||
{
|
||||
play("shoot");
|
||||
this._shootTimer = SHOOT_TIME + ArcU.rand(0,SHOOT_TIME * 50) / 100;
|
||||
}
|
||||
else if(this._shootTimer <= 0)
|
||||
{
|
||||
this._shootTimer = SHOOT_TIME / 3 + ArcU.rand(0,SHOOT_TIME * 50) / 100;
|
||||
}
|
||||
if(_curAnim.name == "shoot" && finished)
|
||||
{
|
||||
play("unshoot");
|
||||
_loc1_ = 70;
|
||||
while(_loc1_ < 130)
|
||||
{
|
||||
_loc2_ = new Seed(x + width / 2 - 3,y + 4,level);
|
||||
_loc2_.velocity.y = 100;
|
||||
_loc3_ = Math.PI / 180 * (_loc1_ + 180);
|
||||
_loc2_.velocity.x = 120 * Math.cos(_loc3_);
|
||||
_loc2_.velocity.y = 180 * Math.sin(_loc3_);
|
||||
_loc2_.acceleration.y = 300;
|
||||
Data.state.enemies.add(_loc2_);
|
||||
_loc1_ += 15;
|
||||
}
|
||||
}
|
||||
if(_curAnim.name == "unshoot" && finished)
|
||||
{
|
||||
play("idle");
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
|
||||
override public function goldenize() : void
|
||||
{
|
||||
killable = false;
|
||||
loadGraphic(spriteGold,true,true,19,9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/47_com.arc.dh.objects.enemies.FloorPlant_sprite.png")]
|
||||
public class FloorPlant_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function FloorPlant_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/173_com.arc.dh.objects.enemies.FloorPlant_spriteGold.png")]
|
||||
public class FloorPlant_spriteGold extends BitmapAsset
|
||||
{
|
||||
|
||||
public function FloorPlant_spriteGold()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcSprite;
|
||||
import org.flixel.FlxPoint;
|
||||
|
||||
public class Laser extends Enemy
|
||||
{
|
||||
|
||||
private static const sprite:Class = Laser_sprite;
|
||||
|
||||
public static const spriteH:Class = Laser_spriteH;
|
||||
|
||||
public static const spriteV:Class = Laser_spriteV;
|
||||
|
||||
private var _beam:ArcSprite;
|
||||
|
||||
private var _ldx:int;
|
||||
|
||||
private var _ldy:int;
|
||||
|
||||
public function Laser(param1:Number, param2:Number, param3:int, param4:int, param5:FlxPoint)
|
||||
{
|
||||
super(param1,param2,param3);
|
||||
loadGraphic(sprite,true,true,12,12);
|
||||
if(param4 == 0)
|
||||
{
|
||||
y -= 10;
|
||||
}
|
||||
var _loc6_:int = x;
|
||||
var _loc7_:int = y;
|
||||
var _loc8_:int = 10;
|
||||
var _loc9_:int = 10;
|
||||
if(param4 == 0)
|
||||
{
|
||||
_loc6_ += 1;
|
||||
_loc9_ = param5.y * Config.BLOCK_SIZE - param2 + 11;
|
||||
}
|
||||
else if(param4 == 1)
|
||||
{
|
||||
_loc7_ += 5;
|
||||
_loc8_ = param1 - param5.x * Config.BLOCK_SIZE + 11;
|
||||
_loc6_ -= _loc8_ - 6;
|
||||
}
|
||||
else if(param4 == 2)
|
||||
{
|
||||
_loc6_ += 1;
|
||||
_loc9_ = param2 - param5.y * Config.BLOCK_SIZE + 11;
|
||||
_loc7_ -= _loc9_ - 11;
|
||||
}
|
||||
else if(param4 == 3)
|
||||
{
|
||||
_loc7_ += 5;
|
||||
_loc8_ = param5.x * Config.BLOCK_SIZE - param1 + 11;
|
||||
}
|
||||
var _loc10_:Class = param4 == 0 || param4 == 2 ? spriteV : spriteH;
|
||||
this._beam = new LaserBeam(_loc6_,_loc7_,_loc8_,_loc9_,_loc10_,param4);
|
||||
Data.state.enemies.add(this._beam);
|
||||
this._ldx = _loc6_ - x;
|
||||
this._ldy = _loc7_ - y;
|
||||
addAnimation("facing",[param4]);
|
||||
play("facing");
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
this._beam.kill();
|
||||
super.kill();
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
this._beam.x = x + this._ldx + 3;
|
||||
this._beam.y = y + this._ldy;
|
||||
super.update();
|
||||
}
|
||||
|
||||
override public function goldenize() : void
|
||||
{
|
||||
killable = false;
|
||||
super.goldenize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.flixel.ArcSprite;
|
||||
import com.arc.flixel.ArcU;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class LaserBeam extends Enemy
|
||||
{
|
||||
|
||||
private static const BEAM_ALPHA:Number = 0.5;
|
||||
|
||||
private var _beam:ArcSprite;
|
||||
|
||||
public var face:int;
|
||||
|
||||
public function LaserBeam(param1:Number, param2:Number, param3:int, param4:int, param5:Class, param6:int)
|
||||
{
|
||||
super(param1,param2,1,false);
|
||||
loadGraphic(param5,true,true,param3,param4);
|
||||
pierce = false;
|
||||
this.face = param6;
|
||||
if(param5 == Laser.spriteH)
|
||||
{
|
||||
height = 4;
|
||||
offset.y = 3;
|
||||
y += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
width = 4;
|
||||
offset.x = 3;
|
||||
x += 3;
|
||||
}
|
||||
alpha = 0;
|
||||
immovable = true;
|
||||
var _loc7_:int = ArcU.rand(0,4);
|
||||
addAnimation("color",[_loc7_]);
|
||||
play("color");
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(alpha < BEAM_ALPHA)
|
||||
{
|
||||
alpha += FlxG.elapsed / 2;
|
||||
if(alpha > BEAM_ALPHA)
|
||||
{
|
||||
alpha = BEAM_ALPHA;
|
||||
}
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/182_com.arc.dh.objects.enemies.Laser_sprite.png")]
|
||||
public class Laser_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Laser_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/273_com.arc.dh.objects.enemies.Laser_spriteH.png")]
|
||||
public class Laser_spriteH extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Laser_spriteH()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/263_com.arc.dh.objects.enemies.Laser_spriteV.png")]
|
||||
public class Laser_spriteV extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Laser_spriteV()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.Color;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class Orb extends Enemy
|
||||
{
|
||||
|
||||
private static const sprite:Class = Orb_sprite;
|
||||
|
||||
private static const PARTICLE_DELAY:Number = 0.1;
|
||||
|
||||
private var _particleTimer:Number = 0.1;
|
||||
|
||||
public function Orb(param1:int, param2:int, param3:int)
|
||||
{
|
||||
super(param1,param2,1);
|
||||
loadGraphic(sprite,true,false,12,30);
|
||||
hp = hpm = param3;
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.WHITE,x,y,20,1,1,0,-50,50,-50,50,width,height);
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.PURPLE,x,y,20,1,1,0,-50,50,-50,50,width,height);
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
this._particleTimer -= FlxG.elapsed;
|
||||
if(this._particleTimer <= 0)
|
||||
{
|
||||
this._particleTimer = PARTICLE_DELAY;
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.WHITE,x + 6,y + 6,1,1,1,0,-50,50,-50,50);
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/126_com.arc.dh.objects.enemies.Orb_sprite.png")]
|
||||
public class Orb_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Orb_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcU;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class Plant extends Enemy
|
||||
{
|
||||
|
||||
private static const sprite:Class = Plant_sprite;
|
||||
|
||||
private static const spriteGold:Class = Plant_spriteGold;
|
||||
|
||||
private static const SHOOT_TIME:Number = 2.5;
|
||||
|
||||
private var _shootTimer:Number = ArcU.rand(10,SHOOT_TIME * 10) / 10;
|
||||
|
||||
public function Plant(param1:Number, param2:Number, param3:int, param4:int)
|
||||
{
|
||||
var _loc5_:Number = NaN;
|
||||
var _loc6_:Number = NaN;
|
||||
_loc5_ = param1 * Config.BLOCK_SIZE;
|
||||
_loc6_ = param2 * Config.BLOCK_SIZE;
|
||||
_c = param1;
|
||||
_r = param2;
|
||||
super(_loc5_,_loc6_,param3);
|
||||
loadGraphic(sprite,true,true,14,11);
|
||||
facing = param4;
|
||||
if(param4 == LEFT)
|
||||
{
|
||||
x += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
x -= 4;
|
||||
}
|
||||
addAnimation("idle",[0]);
|
||||
addAnimation("shoot",[1,2],8,true);
|
||||
play("idle");
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
var _loc1_:Seed = null;
|
||||
this._shootTimer -= FlxG.elapsed;
|
||||
if(this._shootTimer <= 0 && getScreenXY().y >= 0)
|
||||
{
|
||||
play("shoot");
|
||||
this._shootTimer = SHOOT_TIME + ArcU.rand(0,SHOOT_TIME * 50) / 100;
|
||||
}
|
||||
else if(this._shootTimer <= 0)
|
||||
{
|
||||
this._shootTimer = SHOOT_TIME / 10 + ArcU.rand(0,SHOOT_TIME * 20) / 100;
|
||||
}
|
||||
if(_curAnim.name == "shoot" && finished)
|
||||
{
|
||||
play("idle");
|
||||
_loc1_ = new Seed(x,y + 3,level);
|
||||
if(facing == RIGHT)
|
||||
{
|
||||
_loc1_.velocity.x = 100;
|
||||
_loc1_.x += 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_.velocity.x = -100;
|
||||
_loc1_.x -= 0;
|
||||
}
|
||||
Data.state.enemies.add(_loc1_);
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
|
||||
override public function goldenize() : void
|
||||
{
|
||||
killable = false;
|
||||
loadGraphic(spriteGold,true,true,14,11);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/211_com.arc.dh.objects.enemies.Plant_sprite.png")]
|
||||
public class Plant_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Plant_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/298_com.arc.dh.objects.enemies.Plant_spriteGold.png")]
|
||||
public class Plant_spriteGold extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Plant_spriteGold()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,305 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.Color;
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
import com.arc.flixel.ArcU;
|
||||
import org.flixel.FlxG;
|
||||
import org.flixel.FlxPoint;
|
||||
|
||||
public class ProfessorShade extends Boss
|
||||
{
|
||||
|
||||
private static const sprite:Class = ProfessorShade_sprite;
|
||||
|
||||
private static const LASER_DELAY:Number = 10;
|
||||
|
||||
private static const JUMP_DELAY:Number = 1;
|
||||
|
||||
private static const EXPLODE_SEED_SPEED:Number = 120;
|
||||
|
||||
private static const SPRAY_DELAY:Number = 2;
|
||||
|
||||
private static const LASER_SPEED:Number = 50;
|
||||
|
||||
private static const TADPOLE_DELAY:Number = 2;
|
||||
|
||||
private var laserTimer:Number = 1;
|
||||
|
||||
private var jumpTimer:Number = 1;
|
||||
|
||||
private var sprayTimer:Number = 0;
|
||||
|
||||
private var _thisPoint:FlxPoint = new FlxPoint();
|
||||
|
||||
private var _otherPoint:FlxPoint = new FlxPoint();
|
||||
|
||||
private var _laserLeft:Laser;
|
||||
|
||||
private var _laserLeftTarget:int = 12;
|
||||
|
||||
private var _laserRight:Laser;
|
||||
|
||||
private var _laserRightTarget:int = 336;
|
||||
|
||||
private var tadpoleTimer:Number = 2;
|
||||
|
||||
public function ProfessorShade(param1:Number, param2:Number)
|
||||
{
|
||||
super(param1,param2);
|
||||
loadGraphic(sprite,true,true,16,24);
|
||||
offset.y = 6;
|
||||
height = 16;
|
||||
offset.x = 3;
|
||||
width = 10;
|
||||
facing = LEFT;
|
||||
acceleration.y = 400;
|
||||
_moveSpeed = 100;
|
||||
hp = hpm = mode(12000,30000,50000);
|
||||
setPhases([70,40]);
|
||||
addAnimation("walk",[0,1,2,3,4],7,true);
|
||||
addAnimation("stand",[6,7],4,true);
|
||||
addAnimation("jump",[5]);
|
||||
play("walk");
|
||||
}
|
||||
|
||||
override public function intro() : Boolean
|
||||
{
|
||||
var _loc1_:Plant = null;
|
||||
var _loc2_:CeilingPlant = null;
|
||||
go(LEFT);
|
||||
if(heroic)
|
||||
{
|
||||
_loc2_ = new CeilingPlant(3,2,1);
|
||||
_loc2_.goldenize();
|
||||
Data.state.enemies.add(_loc2_);
|
||||
_loc2_ = new CeilingPlant(26,2,1);
|
||||
_loc2_.goldenize();
|
||||
Data.state.enemies.add(_loc2_);
|
||||
_loc2_ = new CeilingPlant(14,2,1);
|
||||
_loc2_.goldenize();
|
||||
Data.state.enemies.add(_loc2_);
|
||||
}
|
||||
this._laserLeft = new Laser(12,24,1,0,new FlxPoint(0,17));
|
||||
this._laserLeft.goldenize();
|
||||
Data.state.enemies.add(this._laserLeft);
|
||||
this._laserRight = new Laser(336,24,1,0,new FlxPoint(0,17));
|
||||
this._laserRight.goldenize();
|
||||
Data.state.enemies.add(this._laserRight);
|
||||
_loc1_ = new Plant(1,8,1,RIGHT);
|
||||
_loc1_.goldenize();
|
||||
Data.state.enemies.add(_loc1_);
|
||||
_loc1_ = new Plant(28,8,1,LEFT);
|
||||
_loc1_.goldenize();
|
||||
Data.state.enemies.add(_loc1_);
|
||||
super.intro();
|
||||
return true;
|
||||
}
|
||||
|
||||
override public function outro() : Boolean
|
||||
{
|
||||
var _loc1_:Enemy = null;
|
||||
for each(_loc1_ in Data.state.enemies.members)
|
||||
{
|
||||
if(!(_loc1_ is Boss))
|
||||
{
|
||||
_loc1_.silentKill();
|
||||
}
|
||||
}
|
||||
super.outro();
|
||||
return true;
|
||||
}
|
||||
|
||||
override public function engaged() : Boolean
|
||||
{
|
||||
var _loc5_:Tadpole = null;
|
||||
var _loc6_:int = 0;
|
||||
var _loc7_:Number = NaN;
|
||||
this.laserTimer -= FlxG.elapsed;
|
||||
if(heroic && this._laserLeft.x == 12 && this._laserRight.x == 336)
|
||||
{
|
||||
this.laserTimer = 0;
|
||||
}
|
||||
if(phase >= 2 && this.laserTimer <= 0)
|
||||
{
|
||||
this.laserTimer = LASER_DELAY;
|
||||
if(ArcU.rand(0,1) == 0)
|
||||
{
|
||||
this._laserLeftTarget = 12 + 250;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._laserRightTarget = 336 - 250;
|
||||
}
|
||||
}
|
||||
this.tadpoleTimer -= FlxG.elapsed;
|
||||
if(heroic && this.tadpoleTimer <= 0)
|
||||
{
|
||||
this.tadpoleTimer = TADPOLE_DELAY;
|
||||
_loc5_ = new Tadpole(ArcU.rand(0,1) == 0 ? 0 : 26,ArcU.rand(0,1) == 0 ? 3 : 17,5);
|
||||
Data.state.enemies.add(_loc5_);
|
||||
}
|
||||
if(velocity.x == 0)
|
||||
{
|
||||
go(facing == LEFT ? RIGHT : LEFT);
|
||||
}
|
||||
if(touching & DOWN)
|
||||
{
|
||||
this.jumpTimer -= FlxG.elapsed;
|
||||
if(this.jumpTimer <= 0)
|
||||
{
|
||||
velocity.y = -ArcU.rand(100,400);
|
||||
this.jumpTimer = JUMP_DELAY + ArcU.rand(0,500) / 1000;
|
||||
}
|
||||
}
|
||||
var _loc1_:int = x / Config.BLOCK_SIZE + (velocity.x > 0 ? 1 : 0);
|
||||
var _loc2_:int = y / Config.BLOCK_SIZE + 2;
|
||||
var _loc3_:uint = Data.state.tilemap.getTile(_loc1_,_loc2_);
|
||||
if(_loc3_ == 0 && Boolean(touching & DOWN))
|
||||
{
|
||||
velocity.y = -250;
|
||||
}
|
||||
this._thisPoint.x = x + 5;
|
||||
this._thisPoint.y = y + 8;
|
||||
this._otherPoint.x = Data.state.player.x + Data.state.player.width / 2;
|
||||
this._otherPoint.y = Data.state.player.y + Data.state.player.height / 2;
|
||||
this.sprayTimer -= FlxG.elapsed;
|
||||
if(Data.state.tilemap.ray(this._thisPoint,this._otherPoint) && this.sprayTimer <= 0 && (this._otherPoint.x < this._thisPoint.x && facing == LEFT || this._otherPoint.x > this._thisPoint.x && facing == RIGHT))
|
||||
{
|
||||
this.sprayTimer = SPRAY_DELAY;
|
||||
_loc6_ = facing == LEFT ? -7 : 3;
|
||||
_loc7_ = Math.atan2(this._otherPoint.y - this._thisPoint.y,this._otherPoint.x - this._thisPoint.x);
|
||||
if(phase == 1)
|
||||
{
|
||||
this.shootSeed(this._thisPoint.x + _loc6_,this._thisPoint.y - 5,_loc7_);
|
||||
}
|
||||
else if(phase == 2)
|
||||
{
|
||||
this.shootSeed(this._thisPoint.x + _loc6_,this._thisPoint.y - 5,_loc7_ - Math.PI / 56);
|
||||
this.shootSeed(this._thisPoint.x + _loc6_,this._thisPoint.y - 5,_loc7_ + Math.PI / 56);
|
||||
}
|
||||
else if(phase == 3)
|
||||
{
|
||||
this.shootSeed(this._thisPoint.x + _loc6_,this._thisPoint.y - 5,_loc7_ - Math.PI / 32);
|
||||
this.shootSeed(this._thisPoint.x + _loc6_,this._thisPoint.y - 5,_loc7_);
|
||||
this.shootSeed(this._thisPoint.x + _loc6_,this._thisPoint.y - 5,_loc7_ + Math.PI / 32);
|
||||
}
|
||||
}
|
||||
if(phase == 1)
|
||||
{
|
||||
_moveSpeed = 100;
|
||||
}
|
||||
else if(phase == 2)
|
||||
{
|
||||
_moveSpeed = 100;
|
||||
}
|
||||
else if(phase == 3)
|
||||
{
|
||||
_moveSpeed = 125;
|
||||
}
|
||||
var _loc4_:Number = mode(LASER_SPEED,LASER_SPEED,LASER_SPEED * 1.6);
|
||||
if(this._laserLeft.x < this._laserLeftTarget)
|
||||
{
|
||||
this._laserLeft.x += _loc4_ * FlxG.elapsed;
|
||||
if(this._laserLeft.x >= this._laserLeftTarget)
|
||||
{
|
||||
this._laserLeft.x = this._laserLeftTarget;
|
||||
this._laserLeftTarget = 12;
|
||||
}
|
||||
}
|
||||
else if(this._laserLeft.x > this._laserLeftTarget)
|
||||
{
|
||||
this._laserLeft.x -= _loc4_ * FlxG.elapsed;
|
||||
if(this._laserLeft.x <= this._laserLeftTarget)
|
||||
{
|
||||
this._laserLeft.x = this._laserLeftTarget;
|
||||
if(this._laserLeftTarget != 12)
|
||||
{
|
||||
this._laserLeftTarget = 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this._laserRight.x > this._laserRightTarget)
|
||||
{
|
||||
this._laserRight.x -= _loc4_ * FlxG.elapsed;
|
||||
if(this._laserRight.x <= this._laserRightTarget)
|
||||
{
|
||||
this._laserRight.x = this._laserRightTarget;
|
||||
this._laserRightTarget = 336;
|
||||
}
|
||||
}
|
||||
else if(this._laserRight.x < this._laserRightTarget)
|
||||
{
|
||||
this._laserRight.x += _loc4_ * FlxG.elapsed;
|
||||
if(this._laserRight.x >= this._laserRightTarget)
|
||||
{
|
||||
this._laserRight.x = this._laserRightTarget;
|
||||
if(this._laserRightTarget != 336)
|
||||
{
|
||||
this._laserRightTarget = 336;
|
||||
}
|
||||
}
|
||||
}
|
||||
super.engaged();
|
||||
return false;
|
||||
}
|
||||
|
||||
private function shootSeed(param1:int, param2:int, param3:Number) : void
|
||||
{
|
||||
var _loc4_:Seed = new Seed(param1,param2,1);
|
||||
_loc4_.velocity.x = EXPLODE_SEED_SPEED * Math.cos(param3);
|
||||
_loc4_.velocity.y = EXPLODE_SEED_SPEED * Math.sin(param3);
|
||||
Data.state.enemies.add(_loc4_);
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
super.kill();
|
||||
}
|
||||
|
||||
override public function changePhase(param1:int) : void
|
||||
{
|
||||
var _loc3_:Plant = null;
|
||||
var _loc4_:CeilingPlant = null;
|
||||
var _loc5_:Enemy = null;
|
||||
var _loc6_:Enemy = null;
|
||||
switch(param1)
|
||||
{
|
||||
case 2:
|
||||
_loc3_ = new Plant(1,16,1,RIGHT);
|
||||
_loc3_.goldenize();
|
||||
Data.state.enemies.add(_loc3_);
|
||||
_loc3_ = new Plant(28,16,1,LEFT);
|
||||
_loc3_.goldenize();
|
||||
Data.state.enemies.add(_loc3_);
|
||||
this._laserLeftTarget = 12 + 100;
|
||||
this._laserRightTarget = 336 - 100;
|
||||
break;
|
||||
case 3:
|
||||
_moveSpeed = 100;
|
||||
go(facing);
|
||||
this._laserLeftTarget = 12 + 150;
|
||||
this._laserRightTarget = 336 - 150;
|
||||
if(!heroic)
|
||||
{
|
||||
_loc4_ = new CeilingPlant(14,2,1);
|
||||
_loc4_.goldenize();
|
||||
Data.state.enemies.add(_loc4_);
|
||||
}
|
||||
}
|
||||
this.laserTimer = LASER_DELAY;
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.RED,getMidpoint().x,getMidpoint().y,50,1,1,0,-50,50,-50,50);
|
||||
var _loc2_:int = 2;
|
||||
while(_loc2_ < Config.BLOCK_WIDTH - 3)
|
||||
{
|
||||
_loc5_ = new BouncingSlime(_loc2_,3,mode(40,40,50));
|
||||
Data.state.enemies.add(_loc5_);
|
||||
_loc6_ = new Tadpole(_loc2_ + 4,3,mode(40,40,50));
|
||||
Data.state.enemies.add(_loc6_);
|
||||
_loc2_ += 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/150_com.arc.dh.objects.enemies.ProfessorShade_sprite.png")]
|
||||
public class ProfessorShade_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function ProfessorShade_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/249_com.arc.dh.objects.enemies.Professor_endingSprite.png")]
|
||||
public class Professor_endingSprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Professor_endingSprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/215.png")]
|
||||
public class Professor_equipmentSprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Professor_equipmentSprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/89_com.arc.dh.objects.enemies.Professor_sadSprite.png")]
|
||||
public class Professor_sadSprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Professor_sadSprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/174_com.arc.dh.objects.enemies.Professor_shieldSprite.png")]
|
||||
public class Professor_shieldSprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Professor_shieldSprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/100_com.arc.dh.objects.enemies.Professor_sprite.png")]
|
||||
public class Professor_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Professor_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.Color;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
import org.flixel.FlxG;
|
||||
import org.flixel.FlxObject;
|
||||
|
||||
public class Seed extends Enemy
|
||||
{
|
||||
|
||||
private static const sprite:Class = Seed_sprite;
|
||||
|
||||
public function Seed(param1:Number, param2:Number, param3:int)
|
||||
{
|
||||
super(param1,param2,param3,false);
|
||||
loadRotatedGraphic(sprite,16,-1,true,true);
|
||||
width = height = 5;
|
||||
offset.x = offset.y = 4;
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
angle += FlxG.elapsed * 1000;
|
||||
super.update();
|
||||
}
|
||||
|
||||
override public function handleCollision(param1:FlxObject) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
if(velocity.x < 0)
|
||||
{
|
||||
_loc2_ = 0;
|
||||
_loc4_ = 20;
|
||||
}
|
||||
else if(velocity.x > 0)
|
||||
{
|
||||
_loc2_ = -20;
|
||||
_loc4_ = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = -20;
|
||||
_loc4_ = 20;
|
||||
}
|
||||
if(velocity.y < 0)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
_loc5_ = 20;
|
||||
}
|
||||
else if(velocity.y > 0)
|
||||
{
|
||||
_loc3_ = -20;
|
||||
_loc5_ = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = -20;
|
||||
_loc5_ = 20;
|
||||
}
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.RED,x + width / 2,y + width / 2,2,2,0.25,0,_loc2_,_loc4_,_loc3_,_loc5_);
|
||||
exists = false;
|
||||
alive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/260_com.arc.dh.objects.enemies.Seed_sprite.png")]
|
||||
public class Seed_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Seed_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.Color;
|
||||
import com.arc.dh.objects.Bullet;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
import org.flixel.FlxG;
|
||||
import org.flixel.FlxPoint;
|
||||
|
||||
public class ShadowOrb extends Enemy
|
||||
{
|
||||
|
||||
public static const sprite:Class = ShadowOrb_sprite;
|
||||
|
||||
private static const SPEED:int = 250;
|
||||
|
||||
private static const ROTATION_SPEED:Number = 250;
|
||||
|
||||
private static const TARGET_DISTANCE:Number = 15;
|
||||
|
||||
private var degrees:int = 0;
|
||||
|
||||
private var professor:Professor;
|
||||
|
||||
private var _distance:Number = 0;
|
||||
|
||||
private var _shot:Boolean = false;
|
||||
|
||||
public function ShadowOrb(param1:int, param2:int, param3:int, param4:Professor)
|
||||
{
|
||||
super(param1,param2,1);
|
||||
this.professor = param4;
|
||||
this.degrees = param3;
|
||||
loadGraphic(sprite,true,false,14,14);
|
||||
healthbar.kill();
|
||||
healthbar = null;
|
||||
}
|
||||
|
||||
override public function damage(param1:int, param2:Bullet = null) : void
|
||||
{
|
||||
}
|
||||
|
||||
public function move(param1:int) : void
|
||||
{
|
||||
var _loc2_:Number = NaN;
|
||||
var _loc3_:FlxPoint = null;
|
||||
_loc2_ = Math.PI / 180 * param1;
|
||||
_loc3_ = this.professor.getMidpoint();
|
||||
x = _loc3_.x + this._distance * Math.cos(_loc2_) - 7;
|
||||
y = _loc3_.y + this._distance * Math.sin(_loc2_) - 7;
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(!this._shot)
|
||||
{
|
||||
if(this._distance < TARGET_DISTANCE)
|
||||
{
|
||||
this._distance += FlxG.elapsed * 50;
|
||||
if(this._distance > TARGET_DISTANCE)
|
||||
{
|
||||
this._distance = TARGET_DISTANCE;
|
||||
}
|
||||
}
|
||||
this.degrees += ROTATION_SPEED * FlxG.elapsed;
|
||||
this.move(this.degrees);
|
||||
}
|
||||
else if(touching & (DOWN | UP | LEFT | RIGHT))
|
||||
{
|
||||
this.kill();
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
|
||||
public function shoot() : void
|
||||
{
|
||||
this._shot = true;
|
||||
var _loc1_:Number = Math.atan2(Data.state.player.y - y,Data.state.player.x - x);
|
||||
velocity.x = SPEED * Math.cos(_loc1_);
|
||||
velocity.y = SPEED * Math.sin(_loc1_);
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.BLACK,getMidpoint().x,getMidpoint().y,15,1,0.3,0,-50,50,-50,50);
|
||||
super.kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/49_com.arc.dh.objects.enemies.ShadowOrb_sprite.png")]
|
||||
public class ShadowOrb_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function ShadowOrb_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcU;
|
||||
|
||||
public class Slime extends Enemy
|
||||
{
|
||||
|
||||
private static const sprite:Class = Slime_sprite;
|
||||
|
||||
public function Slime(param1:Number, param2:Number, param3:int)
|
||||
{
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc5_:Number = NaN;
|
||||
_loc4_ = param1 * Config.BLOCK_SIZE;
|
||||
_loc5_ = param2 * Config.BLOCK_SIZE;
|
||||
_c = param1;
|
||||
_r = param2;
|
||||
super(_loc4_,_loc5_,param3);
|
||||
loadGraphic(sprite,true,true,14,11);
|
||||
facing = ArcU.rand(0,1) == 0 ? LEFT : RIGHT;
|
||||
velocity.x = facing == LEFT ? -MOVE_SPEED : MOVE_SPEED;
|
||||
width = 10;
|
||||
offset.x = 2;
|
||||
y += 1;
|
||||
hittable = true;
|
||||
acceleration.y = 400;
|
||||
var _loc6_:int = ArcU.rand(0,11);
|
||||
addAnimation("walk",[_loc6_ * 2,_loc6_ * 2 + 1],5,true);
|
||||
play("walk");
|
||||
}
|
||||
|
||||
override public function unhit() : void
|
||||
{
|
||||
go(_hitDirection);
|
||||
super.unhit();
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:uint = 0;
|
||||
if(!_hit && velocity.y == 0)
|
||||
{
|
||||
_loc1_ = x / Config.BLOCK_SIZE + (velocity.x > 0 ? 1 : 0);
|
||||
_loc2_ = y / Config.BLOCK_SIZE + 1;
|
||||
_loc3_ = Data.state.tilemap.getTile(_loc1_,_loc2_);
|
||||
if(_loc3_ == 0)
|
||||
{
|
||||
if(velocity.x < 0)
|
||||
{
|
||||
go(RIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
go(LEFT);
|
||||
}
|
||||
}
|
||||
else if(velocity.x == 0)
|
||||
{
|
||||
go(facing == LEFT ? RIGHT : LEFT);
|
||||
}
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.Color;
|
||||
import com.arc.dh.state.StoryMode;
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.dh.util.text.Avatar;
|
||||
import com.arc.dh.util.text.TextSystem;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
import com.arc.flixel.ArcU;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class SlimeKing extends Boss
|
||||
{
|
||||
|
||||
private static const sprite:Class = SlimeKing_sprite;
|
||||
|
||||
private static const SLIME_SPAWN_DELAY:Number = 4;
|
||||
|
||||
private static const JUMP_DELAY:Number = 1;
|
||||
|
||||
private var slimeTimer:Number = 1;
|
||||
|
||||
private var jumpTimer:Number = 1;
|
||||
|
||||
public function SlimeKing(param1:Number, param2:Number)
|
||||
{
|
||||
super(param1,param2);
|
||||
loadGraphic(sprite,true,true,19,14);
|
||||
facing = LEFT;
|
||||
acceleration.y = 400;
|
||||
_moveSpeed = 100;
|
||||
hp = hpm = mode(1600,30000,50000);
|
||||
setPhases([70,40]);
|
||||
addAnimation("walk",[0,1,2],5,true);
|
||||
play("walk");
|
||||
}
|
||||
|
||||
override public function intro() : Boolean
|
||||
{
|
||||
TextSystem.display(Avatar.PROFESSOR,"I see you\'ve found my old useless gun, Silo. Unfortunately, your escape stops here.");
|
||||
go(LEFT);
|
||||
super.intro();
|
||||
return true;
|
||||
}
|
||||
|
||||
override public function outro() : Boolean
|
||||
{
|
||||
var _loc1_:Enemy = null;
|
||||
TextSystem.display(Avatar.PROFESSOR,"That was impressive. Don\'t think you\'re ever getting out of this cave though, my boy.");
|
||||
for each(_loc1_ in Data.state.enemies.members)
|
||||
{
|
||||
if(!(_loc1_ is Boss))
|
||||
{
|
||||
_loc1_.silentKill();
|
||||
}
|
||||
}
|
||||
super.outro();
|
||||
return true;
|
||||
}
|
||||
|
||||
override public function engaged() : Boolean
|
||||
{
|
||||
var _loc1_:Enemy = null;
|
||||
this.slimeTimer -= FlxG.elapsed;
|
||||
if(this.slimeTimer <= 0)
|
||||
{
|
||||
this.slimeTimer = SLIME_SPAWN_DELAY + mode(1,0,0);
|
||||
_loc1_ = new BouncingSlime(ArcU.rand(2,Config.BLOCK_WIDTH - 3),1,mode(1,30,90));
|
||||
Data.state.enemies.add(_loc1_);
|
||||
this.cornerShot();
|
||||
}
|
||||
if(velocity.x == 0)
|
||||
{
|
||||
go(facing == LEFT ? RIGHT : LEFT);
|
||||
}
|
||||
if(phase == 2 || phase == 3)
|
||||
{
|
||||
if(touching & DOWN)
|
||||
{
|
||||
this.jumpTimer -= FlxG.elapsed;
|
||||
if(this.jumpTimer <= 0)
|
||||
{
|
||||
velocity.y = -ArcU.rand(100,400);
|
||||
this.jumpTimer = JUMP_DELAY + ArcU.rand(0,500) / 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(phase == 4)
|
||||
{
|
||||
if(touching & DOWN)
|
||||
{
|
||||
this.jumpTimer -= FlxG.elapsed;
|
||||
if(this.jumpTimer <= 0)
|
||||
{
|
||||
velocity.y = -ArcU.rand(100,400);
|
||||
this.jumpTimer = ArcU.rand(0,300) / 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
super.engaged();
|
||||
return false;
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
super.kill();
|
||||
}
|
||||
|
||||
override public function changePhase(param1:int) : void
|
||||
{
|
||||
var _loc2_:CeilingPlant = null;
|
||||
var _loc4_:Enemy = null;
|
||||
switch(param1)
|
||||
{
|
||||
case 2:
|
||||
_loc2_ = new CeilingPlant(3,2,mode(1,50,150));
|
||||
_loc2_.goldenize();
|
||||
Data.state.enemies.add(_loc2_);
|
||||
_loc2_ = new CeilingPlant(26,2,mode(1,50,150));
|
||||
_loc2_.goldenize();
|
||||
Data.state.enemies.add(_loc2_);
|
||||
break;
|
||||
case 3:
|
||||
_moveSpeed = 140;
|
||||
go(facing);
|
||||
_loc2_ = new CeilingPlant(10,2,1);
|
||||
_loc2_.goldenize();
|
||||
Data.state.enemies.add(_loc2_);
|
||||
_loc2_ = new CeilingPlant(19,2,1);
|
||||
_loc2_.goldenize();
|
||||
Data.state.enemies.add(_loc2_);
|
||||
}
|
||||
if(Data.state is StoryMode)
|
||||
{
|
||||
Data.state.createHeart(x + 3,y);
|
||||
}
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.RED,getMidpoint().x,getMidpoint().y,50,1,1,0,-50,50,-50,50);
|
||||
var _loc3_:int = 2;
|
||||
while(_loc3_ < Config.BLOCK_WIDTH - 3)
|
||||
{
|
||||
_loc4_ = new BouncingSlime(_loc3_,1,mode(1,30,50));
|
||||
Data.state.enemies.add(_loc4_);
|
||||
_loc3_ += 8;
|
||||
}
|
||||
}
|
||||
|
||||
private function cornerShot() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:Number = NaN;
|
||||
var _loc4_:Number = NaN;
|
||||
if(!heroic)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(ArcU.rand(0,1) == 0)
|
||||
{
|
||||
_loc1_ = 16;
|
||||
_loc2_ = 24;
|
||||
_loc3_ = 0;
|
||||
_loc4_ = 90;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = 335;
|
||||
_loc2_ = 24;
|
||||
_loc3_ = 90;
|
||||
_loc4_ = 180;
|
||||
}
|
||||
var _loc5_:int = phase < 3 ? 15 : (phase < 4 ? 10 : 7);
|
||||
var _loc6_:int = _loc3_;
|
||||
while(_loc6_ <= _loc4_)
|
||||
{
|
||||
shoot(_loc1_,_loc2_,_loc6_,1);
|
||||
_loc6_ += _loc5_;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/194_com.arc.dh.objects.enemies.SlimeKing_sprite.png")]
|
||||
public class SlimeKing_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function SlimeKing_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/65_com.arc.dh.objects.enemies.Slime_sprite.png")]
|
||||
public class Slime_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Slime_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.flixel.ArcU;
|
||||
|
||||
public class Snail extends Enemy
|
||||
{
|
||||
|
||||
private static const sprite:Class = Snail_sprite;
|
||||
|
||||
private static const CRAWL_SPEED:int = 30;
|
||||
|
||||
public function Snail(param1:Number, param2:Number, param3:int)
|
||||
{
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc5_:Number = NaN;
|
||||
_loc4_ = param1 * Config.BLOCK_SIZE;
|
||||
_loc5_ = param2 * Config.BLOCK_SIZE;
|
||||
_c = param1;
|
||||
_r = param2;
|
||||
super(_loc4_,_loc5_,param3);
|
||||
loadGraphic(sprite,true,true,20,10);
|
||||
_moveSpeed = CRAWL_SPEED;
|
||||
acceleration.y = 400;
|
||||
hittable = true;
|
||||
width = 10;
|
||||
offset.x = 5;
|
||||
facing = ArcU.rand(0,1) == 0 ? LEFT : RIGHT;
|
||||
velocity.x = facing == LEFT ? -_moveSpeed : _moveSpeed;
|
||||
addAnimation("walk",[0,1,2,3],5,true);
|
||||
play("walk");
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(velocity.x == 0 && Boolean(touching & DOWN))
|
||||
{
|
||||
reverse();
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.Color;
|
||||
import com.arc.dh.entities.Player;
|
||||
import com.arc.dh.util.AchievementSystem;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
import com.arc.flixel.ArcSprite;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class SnailKing extends Boss
|
||||
{
|
||||
|
||||
private static const sprite:Class = SnailKing_sprite;
|
||||
|
||||
private static const SLIME_SPAWN_DELAY:Number = 4;
|
||||
|
||||
private var slimeTimer:Number = 1;
|
||||
|
||||
private var leftOrb:Orb;
|
||||
|
||||
private var rightOrb:Orb;
|
||||
|
||||
private var _shieldSprite:ArcSprite;
|
||||
|
||||
private var _speedMove:int = 80;
|
||||
|
||||
private var _startHP:int;
|
||||
|
||||
public function SnailKing(param1:Number, param2:Number)
|
||||
{
|
||||
super(param1,param2);
|
||||
loadGraphic(sprite,true,true,20,12);
|
||||
facing = RIGHT;
|
||||
acceleration.y = 400;
|
||||
_moveSpeed = 30;
|
||||
hp = hpm = mode(8000,60000,60000);
|
||||
setPhases([70,30]);
|
||||
this._shieldSprite = new ArcSprite(0,0,Player.shieldSprite);
|
||||
this._shieldSprite.visible = false;
|
||||
this._startHP = Data.hp;
|
||||
addAnimation("walk",[0,1,2,3],5,true);
|
||||
play("walk");
|
||||
}
|
||||
|
||||
override public function intro() : Boolean
|
||||
{
|
||||
go(RIGHT);
|
||||
super.intro();
|
||||
return true;
|
||||
}
|
||||
|
||||
override public function outro() : Boolean
|
||||
{
|
||||
var _loc1_:Enemy = null;
|
||||
for each(_loc1_ in Data.state.enemies.members)
|
||||
{
|
||||
if(!(_loc1_ is Boss))
|
||||
{
|
||||
_loc1_.silentKill();
|
||||
}
|
||||
}
|
||||
super.outro();
|
||||
return true;
|
||||
}
|
||||
|
||||
override public function engaged() : Boolean
|
||||
{
|
||||
var _loc1_:Tadpole = null;
|
||||
this.slimeTimer -= FlxG.elapsed;
|
||||
if(this.slimeTimer <= 0)
|
||||
{
|
||||
this.slimeTimer = SLIME_SPAWN_DELAY;
|
||||
_loc1_ = new Tadpole(15,3,mode(30,30,50));
|
||||
_loc1_.goldenize();
|
||||
Data.state.enemies.add(_loc1_);
|
||||
}
|
||||
if((this.leftOrb == null || this.leftOrb.alive == false) && (this.rightOrb == null || this.rightOrb.alive == false))
|
||||
{
|
||||
killable = true;
|
||||
if(_moveSpeed == this._speedMove)
|
||||
{
|
||||
_moveSpeed = 30;
|
||||
go(facing);
|
||||
}
|
||||
}
|
||||
if(velocity.x == 0)
|
||||
{
|
||||
this.burst();
|
||||
if(facing == RIGHT)
|
||||
{
|
||||
x = 325;
|
||||
y = 46;
|
||||
go(LEFT);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 12;
|
||||
y = 46;
|
||||
go(RIGHT);
|
||||
}
|
||||
this.burst();
|
||||
}
|
||||
super.engaged();
|
||||
return false;
|
||||
}
|
||||
|
||||
private function burst() : void
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.BLUE,getMidpoint().x,getMidpoint().y,20,1,1,0,-50,50,-50,50);
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.YELLOW,getMidpoint().x,getMidpoint().y,20,1,1,0,-50,50,-50,50);
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
if(Data.hp == this._startHP)
|
||||
{
|
||||
AchievementSystem.snailimmune();
|
||||
}
|
||||
super.kill();
|
||||
}
|
||||
|
||||
override public function draw() : void
|
||||
{
|
||||
super.draw();
|
||||
if(killable == false && phase > 1)
|
||||
{
|
||||
this._shieldSprite.x = x - 1;
|
||||
this._shieldSprite.y = y - 3;
|
||||
this._shieldSprite.draw();
|
||||
}
|
||||
}
|
||||
|
||||
override public function changePhase(param1:int) : void
|
||||
{
|
||||
var _loc2_:CeilingPlant = null;
|
||||
var _loc3_:Plant = null;
|
||||
switch(param1)
|
||||
{
|
||||
case 2:
|
||||
_loc2_ = new CeilingPlant(5,2,1);
|
||||
_loc2_.goldenize();
|
||||
Data.state.enemies.add(_loc2_);
|
||||
spawnBurst(_loc2_.getMidpoint().x,_loc2_.getMidpoint().y);
|
||||
_loc2_ = new CeilingPlant(24,2,1);
|
||||
_loc2_.goldenize();
|
||||
Data.state.enemies.add(_loc2_);
|
||||
spawnBurst(_loc2_.getMidpoint().x,_loc2_.getMidpoint().y);
|
||||
if(heroic)
|
||||
{
|
||||
_loc2_ = new CeilingPlant(14,2,1);
|
||||
_loc2_.goldenize();
|
||||
Data.state.enemies.add(_loc2_);
|
||||
spawnBurst(_loc2_.getMidpoint().x,_loc2_.getMidpoint().y);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
_loc3_ = new Plant(10,16,1,RIGHT);
|
||||
_loc3_.goldenize();
|
||||
Data.state.enemies.add(_loc3_);
|
||||
spawnBurst(_loc3_.getMidpoint().x,_loc3_.getMidpoint().y);
|
||||
_loc3_ = new Plant(19,16,1,LEFT);
|
||||
_loc3_.goldenize();
|
||||
Data.state.enemies.add(_loc3_);
|
||||
spawnBurst(_loc3_.getMidpoint().x,_loc3_.getMidpoint().y);
|
||||
if(heroic)
|
||||
{
|
||||
_loc3_ = new Plant(7,12,1,RIGHT);
|
||||
_loc3_.goldenize();
|
||||
Data.state.enemies.add(_loc3_);
|
||||
spawnBurst(_loc3_.getMidpoint().x,_loc3_.getMidpoint().y);
|
||||
_loc3_ = new Plant(22,12,1,LEFT);
|
||||
_loc3_.goldenize();
|
||||
Data.state.enemies.add(_loc3_);
|
||||
spawnBurst(_loc3_.getMidpoint().x,_loc3_.getMidpoint().y);
|
||||
_loc3_ = new Plant(4,8,1,RIGHT);
|
||||
_loc3_.goldenize();
|
||||
Data.state.enemies.add(_loc3_);
|
||||
spawnBurst(_loc3_.getMidpoint().x,_loc3_.getMidpoint().y);
|
||||
_loc3_ = new Plant(25,8,1,LEFT);
|
||||
_loc3_.goldenize();
|
||||
Data.state.enemies.add(_loc3_);
|
||||
spawnBurst(_loc3_.getMidpoint().x,_loc3_.getMidpoint().y);
|
||||
}
|
||||
}
|
||||
this.leftOrb = new Orb(20,31,mode(700,3500,7500));
|
||||
this.rightOrb = new Orb(330,31,mode(700,3500,7500));
|
||||
Data.state.enemies.add(this.leftOrb);
|
||||
Data.state.enemies.add(this.rightOrb);
|
||||
killable = false;
|
||||
_moveSpeed = this._speedMove;
|
||||
go(facing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/266_com.arc.dh.objects.enemies.SnailKing_sprite.png")]
|
||||
public class SnailKing_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function SnailKing_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/50_com.arc.dh.objects.enemies.Snail_sprite.png")]
|
||||
public class Snail_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Snail_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.Color;
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
import com.arc.flixel.ArcU;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class Snake extends Boss
|
||||
{
|
||||
|
||||
private static const sprite:Class = Snake_sprite;
|
||||
|
||||
private static const SLIME_SPAWN_DELAY:Number = 4;
|
||||
|
||||
private static const JUMP_DELAY:Number = 1;
|
||||
|
||||
private static const EXPLODE_SEED_SPEED:Number = 100;
|
||||
|
||||
public static const SPEED:int = 70;
|
||||
|
||||
private var slimeTimer:Number = 1;
|
||||
|
||||
private var jumpTimer:Number = 1;
|
||||
|
||||
private var seedColumnTimer:Number = 3;
|
||||
|
||||
private var degrees:int = 0;
|
||||
|
||||
public var turns:Array = new Array();
|
||||
|
||||
private var _tadpoles:int = 0;
|
||||
|
||||
public function Snake(param1:Number, param2:Number)
|
||||
{
|
||||
super(param1,param2);
|
||||
loadRotatedGraphic(sprite,60,-1,true,true);
|
||||
width = height = 22;
|
||||
offset.x = offset.y = 8;
|
||||
hp = hpm = mode(10000,50000,80000);
|
||||
setPhases([70,30]);
|
||||
_moveSpeed = SPEED;
|
||||
}
|
||||
|
||||
public function move(param1:int) : void
|
||||
{
|
||||
this.degrees = param1;
|
||||
angle = this.degrees + 45;
|
||||
var _loc2_:Number = Math.PI / 180 * this.degrees;
|
||||
velocity.x = _moveSpeed * Math.cos(_loc2_);
|
||||
velocity.y = _moveSpeed * Math.sin(_loc2_);
|
||||
this.turns.push([x,y,velocity.x,velocity.y]);
|
||||
}
|
||||
|
||||
private function touch(param1:uint) : Boolean
|
||||
{
|
||||
return isTouching(param1);
|
||||
}
|
||||
|
||||
override public function intro() : Boolean
|
||||
{
|
||||
var _loc1_:Plant = null;
|
||||
this.degrees = ArcU.rand(0,360);
|
||||
this.move(this.degrees);
|
||||
if(heroic)
|
||||
{
|
||||
_loc1_ = new Plant(1,13,1,RIGHT);
|
||||
_loc1_.goldenize();
|
||||
Data.state.enemies.add(_loc1_);
|
||||
spawnBurst(_loc1_.getMidpoint().x,_loc1_.getMidpoint().y);
|
||||
_loc1_ = new Plant(28,13,1,LEFT);
|
||||
_loc1_.goldenize();
|
||||
Data.state.enemies.add(_loc1_);
|
||||
spawnBurst(_loc1_.getMidpoint().x,_loc1_.getMidpoint().y);
|
||||
}
|
||||
super.intro();
|
||||
return true;
|
||||
}
|
||||
|
||||
override public function outro() : Boolean
|
||||
{
|
||||
var _loc1_:Enemy = null;
|
||||
for each(_loc1_ in Data.state.enemies.members)
|
||||
{
|
||||
if(!(_loc1_ is Boss))
|
||||
{
|
||||
_loc1_.silentKill();
|
||||
}
|
||||
}
|
||||
super.outro();
|
||||
return true;
|
||||
}
|
||||
|
||||
override public function engaged() : Boolean
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:Number = NaN;
|
||||
var _loc6_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
if(!visible)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(this.touch(LEFT | RIGHT | UP | DOWN))
|
||||
{
|
||||
if(this.touch(LEFT))
|
||||
{
|
||||
if(velocity.y < 0)
|
||||
{
|
||||
_loc1_ = ArcU.rand(-60,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = ArcU.rand(0,60);
|
||||
}
|
||||
}
|
||||
else if(this.touch(RIGHT))
|
||||
{
|
||||
if(velocity.y < 0)
|
||||
{
|
||||
_loc1_ = ArcU.rand(180,240);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = ArcU.rand(120,180);
|
||||
}
|
||||
}
|
||||
else if(this.touch(DOWN))
|
||||
{
|
||||
if(velocity.x > 0)
|
||||
{
|
||||
_loc1_ = ArcU.rand(270,330);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = ArcU.rand(210,270);
|
||||
}
|
||||
}
|
||||
else if(this.touch(UP))
|
||||
{
|
||||
if(velocity.x > 0)
|
||||
{
|
||||
_loc1_ = ArcU.rand(30,90);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = ArcU.rand(90,150);
|
||||
}
|
||||
}
|
||||
this.move(_loc1_);
|
||||
_loc2_ = getMidpoint().x;
|
||||
_loc3_ = getMidpoint().y;
|
||||
_loc4_ = ArcU.rand(0,59);
|
||||
while(_loc4_ < 360)
|
||||
{
|
||||
this.shootSeed(_loc2_,_loc3_,_loc4_);
|
||||
_loc4_ += mode(60,60,30);
|
||||
}
|
||||
}
|
||||
this.seedColumnTimer -= FlxG.elapsed;
|
||||
if(this.seedColumnTimer <= 0)
|
||||
{
|
||||
_loc5_ = 0;
|
||||
_loc6_ = 1;
|
||||
switch(phase)
|
||||
{
|
||||
case 1:
|
||||
_loc5_ = 5;
|
||||
break;
|
||||
case 2:
|
||||
_loc5_ = 4;
|
||||
break;
|
||||
case 3:
|
||||
_loc5_ = 4;
|
||||
_loc6_ = 2;
|
||||
}
|
||||
this.seedColumnTimer = _loc5_;
|
||||
if(_loc6_ == 1)
|
||||
{
|
||||
this.shootColumn(ArcU.rand(0,2));
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc7_ = ArcU.rand(0,2);
|
||||
if(_loc7_ == 0)
|
||||
{
|
||||
this.shootColumn(0);
|
||||
this.shootColumn(1);
|
||||
}
|
||||
else if(_loc7_ == 1)
|
||||
{
|
||||
this.shootColumn(1);
|
||||
this.shootColumn(2);
|
||||
}
|
||||
else if(_loc7_ == 2)
|
||||
{
|
||||
this.shootColumn(0);
|
||||
this.shootColumn(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(FlxG.keys.justPressed("Q"))
|
||||
{
|
||||
this.shootColumn(0);
|
||||
this.shootColumn(1);
|
||||
this.shootColumn(2);
|
||||
}
|
||||
super.engaged();
|
||||
return false;
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
super.kill();
|
||||
}
|
||||
|
||||
override public function changePhase(param1:int) : void
|
||||
{
|
||||
var _loc3_:SnakeTail = null;
|
||||
switch(param1)
|
||||
{
|
||||
case 2:
|
||||
_moveSpeed = 100;
|
||||
break;
|
||||
case 3:
|
||||
_moveSpeed = 140;
|
||||
}
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.RED,getMidpoint().x,getMidpoint().y,50,1,1,0,-50,50,-50,50);
|
||||
visible = false;
|
||||
bosshealthbar.visible = false;
|
||||
solid = false;
|
||||
velocity.x = velocity.y = 0;
|
||||
this._tadpoles = 10;
|
||||
var _loc2_:int = 0;
|
||||
while(_loc2_ < this._tadpoles)
|
||||
{
|
||||
_loc3_ = new SnakeTail(0,0,this,mode(50,20,50));
|
||||
_loc3_.x = x + 4;
|
||||
_loc3_.y = y + 4;
|
||||
Data.state.enemies.add(_loc3_);
|
||||
_loc2_++;
|
||||
}
|
||||
x = _c * Config.BLOCK_SIZE;
|
||||
y = _r * Config.BLOCK_SIZE;
|
||||
}
|
||||
|
||||
public function shootSeed(param1:int, param2:int, param3:int) : void
|
||||
{
|
||||
var _loc4_:Number = param3 * Math.PI / 180;
|
||||
var _loc5_:Seed = new Seed(param1,param2,1);
|
||||
_loc5_.velocity.x = EXPLODE_SEED_SPEED * Math.cos(_loc4_);
|
||||
_loc5_.velocity.y = EXPLODE_SEED_SPEED * Math.sin(_loc4_);
|
||||
Data.state.enemies.add(_loc5_);
|
||||
}
|
||||
|
||||
private function shootColumn(param1:int) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc4_:Seed = null;
|
||||
switch(param1)
|
||||
{
|
||||
case 0:
|
||||
_loc2_ = 1;
|
||||
break;
|
||||
case 1:
|
||||
_loc2_ = 12;
|
||||
break;
|
||||
case 2:
|
||||
_loc2_ = 23;
|
||||
}
|
||||
var _loc3_:int = _loc2_;
|
||||
while(_loc3_ < _loc2_ + (param1 == 0 ? 7 : 7))
|
||||
{
|
||||
_loc4_ = new Seed(_loc3_ * Config.BLOCK_SIZE,1 * Config.BLOCK_SIZE,1);
|
||||
_loc4_.velocity.y = 50;
|
||||
_loc4_.x += 5;
|
||||
Data.state.enemies.add(_loc4_);
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
|
||||
public function killTadpole() : void
|
||||
{
|
||||
--this._tadpoles;
|
||||
if(this._tadpoles <= 0)
|
||||
{
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.RED,getMidpoint().x,getMidpoint().y,50,1,1,0,-50,50,-50,50);
|
||||
visible = true;
|
||||
bosshealthbar.visible = true;
|
||||
solid = true;
|
||||
this.degrees = ArcU.rand(0,360);
|
||||
this.move(this.degrees);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.flixel.ArcU;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class SnakeTail extends Enemy
|
||||
{
|
||||
|
||||
private static const sprite:Class = SnakeTail_sprite;
|
||||
|
||||
private static const SPEED:int = 90;
|
||||
|
||||
private var degrees:int = 0;
|
||||
|
||||
private var _snake:Snake;
|
||||
|
||||
public function SnakeTail(param1:Number, param2:Number, param3:Snake, param4:int)
|
||||
{
|
||||
var _loc5_:Number = NaN;
|
||||
var _loc6_:Number = NaN;
|
||||
_loc5_ = param1 * Config.BLOCK_SIZE;
|
||||
_loc6_ = param2 * Config.BLOCK_SIZE;
|
||||
_c = param1;
|
||||
_r = param2;
|
||||
super(_loc5_,_loc6_,param4);
|
||||
loadRotatedGraphic(sprite,60,-1,true,true);
|
||||
this._snake = param3;
|
||||
width = height = 10;
|
||||
offset.x = offset.y = 6;
|
||||
x += 20;
|
||||
y -= 20;
|
||||
this.degrees = ArcU.rand(0,360);
|
||||
this.move(this.degrees);
|
||||
}
|
||||
|
||||
public function move(param1:int) : void
|
||||
{
|
||||
this.degrees = param1;
|
||||
angle = this.degrees + 45;
|
||||
var _loc2_:Number = Math.PI / 180 * this.degrees;
|
||||
velocity.x = SPEED * Math.cos(_loc2_);
|
||||
velocity.y = SPEED * Math.sin(_loc2_);
|
||||
}
|
||||
|
||||
private function touch(param1:uint) : Boolean
|
||||
{
|
||||
return isTouching(param1);
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
if(FlxG.keys.justPressed("X"))
|
||||
{
|
||||
this.move(this.degrees + 5);
|
||||
}
|
||||
if(this.touch(LEFT | RIGHT | UP | DOWN))
|
||||
{
|
||||
if(this.touch(LEFT))
|
||||
{
|
||||
if(velocity.y < 0)
|
||||
{
|
||||
_loc1_ = ArcU.rand(-60,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = ArcU.rand(0,60);
|
||||
}
|
||||
}
|
||||
else if(this.touch(RIGHT))
|
||||
{
|
||||
if(velocity.y < 0)
|
||||
{
|
||||
_loc1_ = ArcU.rand(180,240);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = ArcU.rand(120,180);
|
||||
}
|
||||
}
|
||||
else if(this.touch(DOWN))
|
||||
{
|
||||
if(velocity.x > 0)
|
||||
{
|
||||
_loc1_ = ArcU.rand(270,330);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = ArcU.rand(210,270);
|
||||
}
|
||||
}
|
||||
else if(this.touch(UP))
|
||||
{
|
||||
if(velocity.x > 0)
|
||||
{
|
||||
_loc1_ = ArcU.rand(30,90);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = ArcU.rand(90,150);
|
||||
}
|
||||
}
|
||||
this.move(_loc1_);
|
||||
_loc2_ = getMidpoint().x;
|
||||
_loc3_ = getMidpoint().y;
|
||||
_loc4_ = ArcU.rand(0,59);
|
||||
while(_loc4_ < 360)
|
||||
{
|
||||
this._snake.shootSeed(_loc2_,_loc3_,_loc4_);
|
||||
_loc4_ += 120;
|
||||
}
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
this._snake.killTadpole();
|
||||
super.kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/285_com.arc.dh.objects.enemies.SnakeTail_sprite.png")]
|
||||
public class SnakeTail_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function SnakeTail_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/267_com.arc.dh.objects.enemies.Snake_sprite.png")]
|
||||
public class Snake_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Snake_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.state.HorizontalMode;
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcSprite;
|
||||
import com.arc.flixel.ArcU;
|
||||
import org.flixel.FlxPoint;
|
||||
|
||||
public class Spider extends Enemy
|
||||
{
|
||||
|
||||
private static const sprite:Class = Spider_sprite;
|
||||
|
||||
private static const threadSprite:Class = Spider_threadSprite;
|
||||
|
||||
private var _thread:ArcSprite;
|
||||
|
||||
private var _falling:Boolean = false;
|
||||
|
||||
private var _climbing:Boolean = false;
|
||||
|
||||
private var _sp:FlxPoint;
|
||||
|
||||
public function Spider(param1:Number, param2:Number, param3:int)
|
||||
{
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc5_:Number = NaN;
|
||||
_loc4_ = param1 * Config.BLOCK_SIZE;
|
||||
_loc5_ = param2 * Config.BLOCK_SIZE;
|
||||
_c = param1;
|
||||
_r = param2;
|
||||
super(_loc4_,_loc5_,param3);
|
||||
loadGraphic(sprite,true,true,13,10);
|
||||
width = 9;
|
||||
offset.x = 2;
|
||||
y -= 12;
|
||||
this._sp = new FlxPoint(x,y);
|
||||
this._thread = new ArcSprite(x + 4,y,threadSprite);
|
||||
addAnimation("wiggle",[0,1],5,true);
|
||||
play("wiggle");
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(!this._falling && !this._climbing && ArcU.abs(Data.state.player.getMidpoint().x + (Data.state is HorizontalMode ? (Data.state as HorizontalMode).camera.velocity.x * 0.3 : 0) - getMidpoint().x) < 40)
|
||||
{
|
||||
if(Data.state.tilemap.ray(this._sp,new FlxPoint(Data.state.player.x,Data.state.player.y)))
|
||||
{
|
||||
velocity.y = 150;
|
||||
acceleration.y = 400;
|
||||
this._falling = true;
|
||||
}
|
||||
}
|
||||
if(this._falling && !this._climbing && Boolean(touching & DOWN))
|
||||
{
|
||||
this._climbing = true;
|
||||
acceleration.y = 0;
|
||||
velocity.y = -50;
|
||||
}
|
||||
if(this._climbing && this._falling && y <= this._sp.y)
|
||||
{
|
||||
this._climbing = false;
|
||||
this._falling = false;
|
||||
y = this._sp.y;
|
||||
velocity.y = 0;
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
|
||||
override public function draw() : void
|
||||
{
|
||||
this._thread.sourceRect.height = y - this._sp.y + 2;
|
||||
this._thread.draw();
|
||||
super.draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/225_com.arc.dh.objects.enemies.Spider_sprite.png")]
|
||||
public class Spider_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Spider_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/125_com.arc.dh.objects.enemies.Spider_threadSprite.png")]
|
||||
public class Spider_threadSprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Spider_threadSprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.util.Config;
|
||||
|
||||
public class Spike extends Enemy
|
||||
{
|
||||
|
||||
private static const sprite:Class = Spike_sprite;
|
||||
|
||||
public function Spike(param1:Number, param2:Number, param3:int)
|
||||
{
|
||||
_c = param1;
|
||||
_r = param2;
|
||||
super(param1 * Config.BLOCK_SIZE + 2,param2 * Config.BLOCK_SIZE + 8,param3,false);
|
||||
loadGraphic(sprite,true,true,12,12);
|
||||
width = 8;
|
||||
offset.x = 2;
|
||||
height = 4;
|
||||
offset.y = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/165_com.arc.dh.objects.enemies.Spike_sprite.png")]
|
||||
public class Spike_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Spike_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.Color;
|
||||
import com.arc.dh.util.AchievementSystem;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.dh.util.text.Avatar;
|
||||
import com.arc.dh.util.text.TextSystem;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
import com.arc.flixel.ArcU;
|
||||
import org.flixel.FlxG;
|
||||
import org.flixel.FlxPoint;
|
||||
|
||||
public class StoneBird extends Boss
|
||||
{
|
||||
|
||||
private static const sprite:Class = StoneBird_sprite;
|
||||
|
||||
private static const BIRD_SPAWN_DELAY:Number = 4;
|
||||
|
||||
private static const SLIME_DROP_DELAY:Number = 6;
|
||||
|
||||
private static const JUMP_DELAY:Number = 1;
|
||||
|
||||
private static const HEROIC_SHOOT_DELAY:Number = 0.3;
|
||||
|
||||
private var birdTimer:Number = 1;
|
||||
|
||||
private var slimeTimer:Number = 6;
|
||||
|
||||
private var jumpTimer:Number = 1;
|
||||
|
||||
private var heroicShootTimer:Number = 0.3;
|
||||
|
||||
private var heroicShootAngle:Number = 45;
|
||||
|
||||
public function StoneBird(param1:Number, param2:Number)
|
||||
{
|
||||
super(param1,param2);
|
||||
loadGraphic(sprite,true,true,33,18);
|
||||
facing = RIGHT;
|
||||
_moveSpeed = 60;
|
||||
go(LEFT);
|
||||
hp = hpm = mode(6000,60000,80000);
|
||||
setPhases([75,50]);
|
||||
addAnimation("walk",[0,1],5,true);
|
||||
play("walk");
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(velocity.x == 0)
|
||||
{
|
||||
go(facing == LEFT ? RIGHT : LEFT);
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
|
||||
override public function intro() : Boolean
|
||||
{
|
||||
super.intro();
|
||||
return true;
|
||||
}
|
||||
|
||||
override public function outro() : Boolean
|
||||
{
|
||||
var _loc1_:Enemy = null;
|
||||
TextSystem.display(Avatar.PROFESSOR,"Not bad... Not bad at all.");
|
||||
for each(_loc1_ in Data.state.enemies.members)
|
||||
{
|
||||
if(!(_loc1_ is Boss))
|
||||
{
|
||||
_loc1_.silentKill();
|
||||
}
|
||||
}
|
||||
super.outro();
|
||||
return true;
|
||||
}
|
||||
|
||||
private function spawnBird(param1:int, param2:int) : void
|
||||
{
|
||||
var _loc3_:Enemy = null;
|
||||
_loc3_ = new DiveBird(0,0,param1,param2);
|
||||
_loc3_.x = x;
|
||||
_loc3_.y = y;
|
||||
Data.state.enemies.add(_loc3_);
|
||||
}
|
||||
|
||||
override public function engaged() : Boolean
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Enemy = null;
|
||||
var _loc5_:BouncingSlime = null;
|
||||
var _loc6_:FlxPoint = null;
|
||||
this.birdTimer -= FlxG.elapsed;
|
||||
if(this.birdTimer <= 0)
|
||||
{
|
||||
this.birdTimer = BIRD_SPAWN_DELAY - (phase > 1 ? 1 : 0);
|
||||
_loc1_ = mode(2,15,50);
|
||||
this.spawnBird(_loc1_,facing);
|
||||
if(phase > 2)
|
||||
{
|
||||
this.spawnBird(_loc1_,facing == LEFT ? int(RIGHT) : int(LEFT));
|
||||
}
|
||||
_loc2_ = 0;
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < Data.state.enemies.members.length)
|
||||
{
|
||||
_loc4_ = Data.state.enemies.members[_loc3_];
|
||||
if(_loc4_ != null && _loc4_ is DiveBird && _loc4_.alive)
|
||||
{
|
||||
_loc2_++;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
AchievementSystem.birds(_loc2_);
|
||||
}
|
||||
this.slimeTimer -= FlxG.elapsed;
|
||||
if(this.slimeTimer <= 0)
|
||||
{
|
||||
this.slimeTimer = SLIME_DROP_DELAY;
|
||||
_loc5_ = new BouncingSlime(ArcU.rand(0,1) == 0 ? 2 : 28,2,mode(20,20,50));
|
||||
_loc5_._jumping = true;
|
||||
Data.state.enemies.add(_loc5_);
|
||||
}
|
||||
this.heroicShootTimer -= FlxG.elapsed;
|
||||
if(this.heroicShootTimer <= 0 && heroic)
|
||||
{
|
||||
this.heroicShootTimer = HEROIC_SHOOT_DELAY;
|
||||
_loc6_ = getMidpoint();
|
||||
shoot(_loc6_.x,_loc6_.y,this.heroicShootAngle,1);
|
||||
this.heroicShootAngle += 15;
|
||||
if(this.heroicShootAngle > 135)
|
||||
{
|
||||
this.heroicShootAngle -= 90;
|
||||
}
|
||||
}
|
||||
super.engaged();
|
||||
return false;
|
||||
}
|
||||
|
||||
override public function kill() : void
|
||||
{
|
||||
super.kill();
|
||||
}
|
||||
|
||||
override public function changePhase(param1:int) : void
|
||||
{
|
||||
var _loc2_:CeilingPlant = null;
|
||||
var _loc3_:Plant = null;
|
||||
switch(param1)
|
||||
{
|
||||
case 2:
|
||||
_loc2_ = new CeilingPlant(7,2,1);
|
||||
_loc2_.goldenize();
|
||||
Data.state.enemies.add(_loc2_);
|
||||
_loc2_ = new CeilingPlant(22,2,1);
|
||||
_loc2_.goldenize();
|
||||
Data.state.enemies.add(_loc2_);
|
||||
break;
|
||||
case 3:
|
||||
_loc3_ = new Plant(1,16,1,RIGHT);
|
||||
_loc3_.goldenize();
|
||||
Data.state.enemies.add(_loc3_);
|
||||
if(heroic)
|
||||
{
|
||||
_loc3_ = new Plant(28,16,1,LEFT);
|
||||
_loc3_.goldenize();
|
||||
Data.state.enemies.add(_loc3_);
|
||||
}
|
||||
}
|
||||
ArcParticleSystem.emit(Data.state.particles,Color.RED,getMidpoint().x,getMidpoint().y,50,1,1,0,-50,50,-50,50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/172_com.arc.dh.objects.enemies.StoneBird_sprite.png")]
|
||||
public class StoneBird_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function StoneBird_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import com.arc.dh.state.HorizontalMode;
|
||||
import com.arc.dh.state.TadpoleMode;
|
||||
import com.arc.dh.util.Config;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.flixel.ArcU;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public class Tadpole extends Enemy
|
||||
{
|
||||
|
||||
public static const sprite:Class = Tadpole_sprite;
|
||||
|
||||
public static const redSprite:Class = Tadpole_redSprite;
|
||||
|
||||
private static const SPEED:int = 100;
|
||||
|
||||
private var degrees:int = 0;
|
||||
|
||||
public var red:Boolean = false;
|
||||
|
||||
public function Tadpole(param1:Number, param2:Number, param3:int)
|
||||
{
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc5_:Number = NaN;
|
||||
_loc4_ = param1 * Config.BLOCK_SIZE;
|
||||
_loc5_ = param2 * Config.BLOCK_SIZE;
|
||||
_c = param1;
|
||||
_r = param2;
|
||||
super(_loc4_,_loc5_,param3);
|
||||
loadRotatedGraphic(sprite,60,-1,true,true);
|
||||
width = height = 10;
|
||||
offset.x = offset.y = 6;
|
||||
x += 20;
|
||||
y -= 20;
|
||||
this.degrees = ArcU.rand(0,360);
|
||||
this.move(this.degrees);
|
||||
if(Data.state is TadpoleMode)
|
||||
{
|
||||
hpm = hp = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public function move(param1:int) : void
|
||||
{
|
||||
var _loc2_:Number = Data.state is HorizontalMode ? SPEED * 0.5 : SPEED;
|
||||
this.degrees = param1;
|
||||
angle = this.degrees + 45;
|
||||
var _loc3_:Number = Math.PI / 180 * this.degrees;
|
||||
velocity.x = _loc2_ * Math.cos(_loc3_);
|
||||
velocity.y = _loc2_ * Math.sin(_loc3_);
|
||||
}
|
||||
|
||||
private function touch(param1:uint) : Boolean
|
||||
{
|
||||
return isTouching(param1);
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
if(FlxG.keys.justPressed("X"))
|
||||
{
|
||||
this.move(this.degrees + 5);
|
||||
}
|
||||
if(this.touch(LEFT | RIGHT | UP | DOWN))
|
||||
{
|
||||
if(this.touch(LEFT))
|
||||
{
|
||||
if(velocity.y < 0)
|
||||
{
|
||||
_loc1_ = ArcU.rand(-60,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = ArcU.rand(0,60);
|
||||
}
|
||||
}
|
||||
else if(this.touch(RIGHT))
|
||||
{
|
||||
if(velocity.y < 0)
|
||||
{
|
||||
_loc1_ = ArcU.rand(180,240);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = ArcU.rand(120,180);
|
||||
}
|
||||
}
|
||||
else if(this.touch(DOWN))
|
||||
{
|
||||
if(velocity.x > 0)
|
||||
{
|
||||
_loc1_ = ArcU.rand(270,330);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = ArcU.rand(210,270);
|
||||
}
|
||||
}
|
||||
else if(this.touch(UP))
|
||||
{
|
||||
if(velocity.x > 0)
|
||||
{
|
||||
_loc1_ = ArcU.rand(30,90);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = ArcU.rand(90,150);
|
||||
}
|
||||
}
|
||||
if(this.red)
|
||||
{
|
||||
this.kill();
|
||||
}
|
||||
this.move(_loc1_);
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/216_com.arc.dh.objects.enemies.Tadpole_redSprite.png")]
|
||||
public class Tadpole_redSprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Tadpole_redSprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.enemies
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/62_com.arc.dh.objects.enemies.Tadpole_sprite.png")]
|
||||
public class Tadpole_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function Tadpole_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.arc.dh.objects.powerups
|
||||
{
|
||||
import com.arc.dh.Color;
|
||||
import com.arc.dh.util.AchievementSystem;
|
||||
import com.arc.dh.util.Data;
|
||||
import com.arc.dh.util.Sound;
|
||||
import com.arc.dh.util.SoundSystem;
|
||||
import com.arc.flixel.ArcParticleSystem;
|
||||
|
||||
public class HeartCrystal extends Powerup
|
||||
{
|
||||
|
||||
private static const sprite:Class = HeartCrystal_sprite;
|
||||
|
||||
private static const spriteBorder:Class = HeartCrystal_spriteBorder;
|
||||
|
||||
private static const sprite_outline:Class = HeartCrystal_sprite_outline;
|
||||
|
||||
private var _id:int;
|
||||
|
||||
public function HeartCrystal(param1:Number, param2:Number, param3:int)
|
||||
{
|
||||
this._id = param3;
|
||||
super(param1,param2,Data.heartcrystals[this._id] == 1 ? sprite_outline : sprite,Data.heartcrystals[this._id] == 1 ? null : Color.RED,Data.heartcrystals[this._id] == 1 ? sprite_outline : spriteBorder,17);
|
||||
}
|
||||
|
||||
override public function update() : void
|
||||
{
|
||||
if(Data.heartcrystals[this._id] == 1)
|
||||
{
|
||||
solid = false;
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
|
||||
override public function activate() : void
|
||||
{
|
||||
if(Data.hp <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
++Data.hp;
|
||||
Data.heartcrystals[this._id] = 1;
|
||||
var _loc1_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
while(_loc2_ < 17)
|
||||
{
|
||||
_loc1_ += Data.heartcrystals[_loc2_];
|
||||
_loc2_++;
|
||||
}
|
||||
Data.vitality = _loc1_;
|
||||
ArcParticleSystem.emit(Data.state.emitters,Color.RED,x + 6,y + 6,15,2,0.5,0,-80,80,-80,80);
|
||||
AchievementSystem.heartcrystal();
|
||||
SoundSystem.play(Sound.HEART_CRYSTAL);
|
||||
kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.arc.dh.objects.powerups
|
||||
{
|
||||
import mx.core.BitmapAsset;
|
||||
|
||||
[Embed(source="/_assets/96_com.arc.dh.objects.powerups.HeartCrystal_sprite.png")]
|
||||
public class HeartCrystal_sprite extends BitmapAsset
|
||||
{
|
||||
|
||||
public function HeartCrystal_sprite()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user