initial commit, kind of working.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user