Section 1
//AdLoader (CPMStar.AdLoader)
package CPMStar {
import flash.events.*;
import flash.display.*;
import flash.system.*;
import flash.net.*;
public class AdLoader extends Sprite {
private var contentspotid:String;
private var cpmstarLoader:Loader;
public function AdLoader(_arg1:String){
this.contentspotid = _arg1;
addEventListener(Event.ADDED, addedHandler);
}
private function addedHandler(_arg1:Event):void{
var _local2:String;
var _local3:DisplayObjectContainer;
removeEventListener(Event.ADDED, addedHandler);
Security.allowDomain("server.cpmstar.com");
_local2 = "http://server.cpmstar.com/adviewas3.swf";
_local3 = parent;
cpmstarLoader = new Loader();
cpmstarLoader.contentLoaderInfo.addEventListener(Event.INIT, dispatchHandler);
cpmstarLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dispatchHandler);
cpmstarLoader.load(new URLRequest(((_local2 + "?contentspotid=") + contentspotid)));
addChild(cpmstarLoader);
}
private function dispatchHandler(_arg1:Event):void{
dispatchEvent(_arg1);
}
}
}//package CPMStar
Section 2
//MainTimeline (RunBobbyRun_fla.MainTimeline)
package RunBobbyRun_fla {
import flash.events.*;
import CPMStar.*;
import flash.display.*;
public dynamic class MainTimeline extends MovieClip {
public var buttonSkipCPMStarAd:SimpleButton;
public var loader:MovieClip;
public var ad:DisplayObject;
public var loaderBack:MovieClip;
public var adBox:MovieClip;
public var CPMStarContentSpotID:String;
public function MainTimeline(){
addFrameScript(0, frame1, 7, frame8);
}
public function myloading(_arg1:Event){
var _local2:*;
var _local3:*;
var _local4:*;
trace("loading..");
_local2 = stage.loaderInfo.bytesTotal;
_local3 = stage.loaderInfo.bytesLoaded;
_local4 = Math.round(((_local3 * 100) / _local2));
if (_local3 >= _local2){
trace("loaded");
removeEventListener(Event.ENTER_FRAME, myloading);
buttonSkipCPMStarAd.visible = true;
loader.visible = false;
};
}
function frame1(){
stop();
loader.visible = true;
buttonSkipCPMStarAd.visible = false;
CPMStarContentSpotID = "623QD8A5D0A9";
buttonSkipCPMStarAd.addEventListener(MouseEvent.CLICK, buttonSkipCPMStarAdPressed);
addEventListener(Event.ENTER_FRAME, myloading);
ad = new AdLoader(CPMStarContentSpotID);
adBox.addChild(ad);
buttonSkipCPMStarAd.visible = false;
}
function frame8(){
stop();
}
public function buttonSkipCPMStarAdPressed(_arg1:MouseEvent){
buttonSkipCPMStarAd.removeEventListener(MouseEvent.CLICK, buttonSkipCPMStarAdPressed);
adBox.removeChild(ad);
this.removeChild(adBox);
gotoAndPlay("post_ad");
}
}
}//package RunBobbyRun_fla
Section 3
//mc_spiral_139 (RunBobbyRun_fla.mc_spiral_139)
package RunBobbyRun_fla {
import flash.display.*;
public dynamic class mc_spiral_139 extends MovieClip {
public var m_gr:MovieClip;
}
}//package RunBobbyRun_fla
Section 4
//sun_1 (RunBobbyRun_fla.sun_1)
package RunBobbyRun_fla {
import flash.display.*;
public dynamic class sun_1 extends MovieClip {
public function sun_1(){
addFrameScript(34, frame35, 65, frame66);
}
function frame35(){
stop();
}
function frame66(){
stop();
MovieClip(parent).play();
}
}
}//package RunBobbyRun_fla
Section 5
//Achievements (Achievements)
package {
public class Achievements {
static var list:Array;
public static function TestAtLevelComplete(){
var _local1:Achievement;
var _local2:Boolean;
var _local3:AchievementItem;
var _local4:Boolean;
for each (_local1 in list) {
if (_local1.complete == false){
_local2 = true;
for each (_local3 in _local1.items) {
_local4 = _local3.Test();
if (_local4 == false){
_local2 = false;
};
};
if (_local2){
_local1.complete = true;
trace((("ACHIEVEMENT: " + _local1.name) + " COMPLETED"));
} else {
trace((("ACHIEVEMENT: " + _local1.name) + " FAILED"));
};
};
};
}
public static function InitOnce(){
var _local1:XML;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:XML;
var _local6:Achievement;
var _local7:int;
var _local8:XML;
var _local9:AchievementItem;
list = new Array();
_local1 = ExternalData.xml;
_local2 = _local1.achievement.length();
_local3 = 0;
_local4 = 0;
_local3 = 0;
while (_local3 < _local2) {
_local5 = _local1.achievement[_local3];
_local6 = new Achievement();
_local6.name = _local5.@name;
list.push(_local6);
_local7 = _local5.item.length();
_local4 = 0;
while (_local4 < _local7) {
_local8 = _local5.item[_local4];
_local9 = new AchievementItem();
_local9.id = int(_local8.@id);
_local9.levelName = _local8.@level;
_local9.variableName = _local8.@variable;
_local9.condition = _local8.@condition;
_local9.value = _local8.@value;
_local6.items.push(_local9);
_local4++;
};
_local3++;
};
}
}
}//package
class AchievementItem {
private var variableName:String;
private var id:int;
private var levelName:String;
private var value:String;
private var condition:String;
public static const CONDITION_EQUALS:String = "equals";
public static const CONDITION_GREATERTHANEQUAL:String = "greaterthanequal";
public static const CONDITION_LESSTHANEQUAL:String = "lessthanequal";
public static const CONDITION_GREATERTHAN:String = "greaterthan";
public static const CONDITION_LESSTHAN:String = "lessthan";
private function AchievementItem(){
}
public function Test():Boolean{
var _local1:int;
var _local2:int;
if (levelName != Game.level.name){
return (false);
};
_local1 = 0;
if (variableName == "kills"){
_local1 = Stats.levelNumKills;
};
if (variableName == "time"){
_local1 = Stats.levelTime;
};
if (variableName == "cash"){
_local1 = Stats.levelCash;
};
if (variableName == "damage"){
_local1 = Stats.levelDamage;
};
_local2 = int(value);
if (condition == CONDITION_EQUALS){
if (_local1 == _local2){
return (true);
};
} else {
if (condition == CONDITION_LESSTHAN){
if (_local1 < _local2){
return (true);
};
} else {
if (condition == CONDITION_LESSTHANEQUAL){
if (_local1 <= _local2){
return (true);
};
} else {
if (condition == CONDITION_GREATERTHAN){
if (_local1 > _local2){
return (true);
};
} else {
if (condition == CONDITION_GREATERTHANEQUAL){
if (_local1 >= _local2){
return (true);
};
};
};
};
};
};
return (false);
}
}
class Achievement {
private var items:Array;
private var complete:Boolean;
private var name:String;
private function Achievement(){
items = new Array();
name = "";
complete = false;
}
}
Section 6
//AnimDef (AnimDef)
package {
public class AnimDef {
var f0:int;
var f1:int;
var name:String;
var vel:Number;
public function AnimDef(_arg1:String, _arg2:int, _arg3:int, _arg4:Number){
name = _arg1;
f0 = (_arg2 - 1);
f1 = (_arg3 - 1);
vel = _arg4;
}
}
}//package
Section 7
//AnimPoint (AnimPoint)
package {
public class AnimPoint {
var frame:int;
var rot:Number;
var x:Number;
var y:Number;
public function AnimPoint(_arg1:int, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){
x = _arg2;
y = _arg3;
rot = _arg4;
frame = _arg1;
}
}
}//package
Section 8
//AnimPoints (AnimPoints)
package {
public class AnimPoints {
static var anims:Array;
static var xml:XML;
static var xml1:XML = <data>
<Motion duration="39">
<source>
<Source frameRate="34" x="8.5" y="-36" scaleX="1" scaleY="1" rotation="0" elementType="movie clip" symbolName="Symbol 5">
<dimensions>
<Rectangle left="0" top="0" width="7" height="8"/>
</dimensions>
<transformationPoint>
<Point x="0.5" y="0.5"/>
</transformationPoint>
</Source>
</source>
<Keyframe index="0"/>
<Keyframe index="1"/>
<Keyframe index="2"/>
<Keyframe index="3" x="-1" y="1"/>
<Keyframe index="4" x="-2" y="4"/>
<Keyframe index="5"/>
<Keyframe index="6" x="-5" y="5"/>
<Keyframe index="7" x="-8" y="7"/>
<Keyframe index="8" x="-11"/>
<Keyframe index="9" x="-9" y="9"/>
<Keyframe index="10" x="-14"/>
<Keyframe index="11" x="-18"/>
<Keyframe index="12" x="-21"/>
<Keyframe index="13" x="-23"/>
<Keyframe index="14" x="-25"/>
<Keyframe index="15" x="-26" y="8"/>
<Keyframe index="16"/>
<Keyframe index="17"/>
<Keyframe index="18"/>
<Keyframe index="19"/>
<Keyframe index="20"/>
<Keyframe index="21" x="-23" y="11"/>
<Keyframe index="22" x="-19"/>
<Keyframe index="23" x="-14" y="12"/>
<Keyframe index="24" x="-9"/>
<Keyframe index="25"/>
<Keyframe index="26"/>
<Keyframe index="27" x="-3" y="2"/>
<Keyframe index="28" x="1"/>
<Keyframe index="29"/>
<Keyframe index="30" x="7"/>
<Keyframe index="31"/>
<Keyframe index="32" x="9" y="1"/>
<Keyframe index="33" x="11" y="0"/>
<Keyframe index="34"/>
<Keyframe index="35" x="8" y="3"/>
<Keyframe index="36" scaleX="0.998" scaleY="0.998" rotation="-40.4"/>
<Keyframe index="37" x="6.25" y="-0.25"/>
<Keyframe index="38" x="7.449999999999999" y="-21.6" scaleX="0.997" scaleY="0.997" rotation="-156"/>
</Motion>
</data>
;
public static function GetFramePoint(_arg1:int):AnimPoint{
var _local2:AnimPoint;
for each (_local2 in anims) {
if (_local2.frame == _arg1){
return (_local2);
};
};
return (null);
}
public static function InitOnce(){
var _local1:int;
var _local2:int;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:XML;
var _local9:AnimPoint;
anims = new Array();
XML.ignoreWhitespace = true;
xml = new XML(xml1);
_local1 = xml.Motion.Keyframe.length();
trace(("animpoints: " + _local1));
_local3 = 0;
_local4 = 0;
_local5 = 0;
_local6 = Number(xml.Motion.source.Source.@x);
_local7 = Number(xml.Motion.source.Source.@y);
_local2 = 0;
while (_local2 < _local1) {
_local8 = xml.Motion.Keyframe[_local2];
if (_local8.attribute("x") != undefined){
_local3 = Number(_local8.@x);
};
if (_local8.attribute("y") != undefined){
_local4 = Number(_local8.@y);
};
if (_local8.attribute("rot") != undefined){
_local5 = Number(_local8.@rot);
};
_local9 = new AnimPoint(int(_local8.@index), (_local3 + _local6), (_local4 + _local7), _local5);
anims.push(_local9);
_local2++;
};
}
}
}//package
Section 9
//BattleCopter (BattleCopter)
package {
import flash.display.*;
public dynamic class BattleCopter extends MovieClip {
}
}//package
Section 10
//Bosscopter (Bosscopter)
package {
import flash.display.*;
public dynamic class Bosscopter extends MovieClip {
}
}//package
Section 11
//BouncingBomb (BouncingBomb)
package {
import flash.display.*;
public dynamic class BouncingBomb extends MovieClip {
}
}//package
Section 12
//CannonBullet1 (CannonBullet1)
package {
import flash.display.*;
public dynamic class CannonBullet1 extends MovieClip {
}
}//package
Section 13
//CannonBullet2 (CannonBullet2)
package {
import flash.display.*;
public dynamic class CannonBullet2 extends MovieClip {
}
}//package
Section 14
//CannonFiring (CannonFiring)
package {
import flash.display.*;
public dynamic class CannonFiring extends MovieClip {
}
}//package
Section 15
//CannonNotFiring (CannonNotFiring)
package {
import flash.display.*;
public dynamic class CannonNotFiring extends MovieClip {
}
}//package
Section 16
//Clouds (Clouds)
package {
import flash.display.*;
public dynamic class Clouds extends MovieClip {
}
}//package
Section 17
//Clouds1 (Clouds1)
package {
import flash.display.*;
public dynamic class Clouds1 extends MovieClip {
}
}//package
Section 18
//Collision (Collision)
package {
import flash.geom.*;
public class Collision {
public static var stats_numPolyCollisionTests:int;
public static var stats_numBBTests:int;
public static var closestX:Number = 0;
public static var closestY:Number = 0;
public static var main:Main;
public static var stats_numIntersections:int;
static var PolyCollision_LineHit:Line;
public static var IntersectionX:Number = 0;
public static var IntersectionY:Number = 0;
public static var closestInfiniteX:Number = 0;
public static var closestInfiniteY:Number = 0;
static function DotProduct(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
_local5 = ((_arg1 * _arg3) + (_arg2 * _arg4));
return (_local5);
}
static function PointRectangleCollision(_arg1:GameObj, _arg2:Number, _arg3:Number):Boolean{
var _local4:ObjectDef;
var _local5:Rectangle;
_local4 = _arg1.GetObjectDef();
_local5 = _local4.colRects[0].clone();
_local4.colRects[0].clone().x = (_local5.x + _arg1.xpos);
_local5.y = (_local5.y + _arg1.ypos);
return (_local5.contains(_arg2, _arg3));
}
static function PolyCollision(_arg1:GameObj, _arg2:Poly, _arg3:Number, _arg4:Number, _arg5:Number):Boolean{
var _local6:Array;
var _local7:Array;
var _local8:Line;
var _local9:Boolean;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Line;
var _local16:int;
var _local17:int;
var _local18:*;
var _local19:Number;
var _local20:Number;
var _local21:Line;
var _local22:Line;
stats_numPolyCollisionTests++;
_local6 = new Array();
_local7 = new Array();
_local11 = (_arg1.xpos + _arg3);
_local12 = (_arg1.ypos + _arg4);
_local13 = _arg5;
_local14 = (_arg5 * _local13);
for each (_local15 in _arg2.lineList) {
_local9 = SideOfLine(_local15.x0, _local15.y0, _local15.x1, _local15.y1, _local11, _local12);
if (_local9 == true){
_local10 = Dist2ToLine(_local15.x0, _local15.y0, _local15.x1, _local15.y1, _local11, _local12);
if (_local10 < _local14){
_local6.push(_local15);
_local7.push(_local10);
};
};
};
_local18 = _local6.length;
_local16 = 0;
while (_local16 < (_local18 - 1)) {
_local17 = _local16;
while (_local17 < _local18) {
_local19 = _local7[_local16];
_local20 = _local7[_local17];
_local21 = _local6[_local16];
_local22 = _local6[_local17];
if (_local20 < _local19){
_local7[_local16] = _local20;
_local7[_local17] = _local19;
_local6[_local16] = _local22;
_local6[_local17] = _local21;
};
_local17++;
};
_local16++;
};
_local16 = 0;
while (_local16 < _local18) {
_local8 = _local6[_local16];
_local9 = SideOfLine(_local8.x0, _local8.y0, _local8.x1, _local8.y1, _local11, _local12);
if (_local9 == true){
_local10 = Dist2ToLine(_local8.x0, _local8.y0, _local8.x1, _local8.y1, _local11, _local12);
if (_local10 < _local14){
stats_numIntersections++;
Intersected(_arg1, _local8, closestX, closestY, _arg3, _arg4, _arg5);
PolyCollision_LineHit = _local8;
return (true);
};
};
return (true);
_local16++;
};
return (false);
}
public static function ClosestPointOnLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):void{
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local7 = (_arg5 - _arg1);
_local8 = (_arg6 - _arg2);
_local9 = (_arg3 - _arg1);
_local10 = (_arg4 - _arg2);
_local11 = ((_local9 * _local9) + (_local10 * _local10));
_local12 = ((_local7 * _local9) + (_local8 * _local10));
_local13 = (_local12 / _local11);
closestInfiniteX = (_arg1 + (_local9 * _local13));
closestInfiniteY = (_arg2 + (_local10 * _local13));
if (_local13 < 0){
_local13 = 0;
};
if (_local13 > 1){
_local13 = 1;
};
closestX = (_arg1 + (_local9 * _local13));
closestY = (_arg2 + (_local10 * _local13));
}
public static function GetSwitchInRange(_arg1:GameObj):GameObj{
var _local2:GameObj;
return (null);
return (null);
}
static function SideOfLine1(_arg1:Line, _arg2:Number, _arg3:Number):Boolean{
var _local4:Number;
_local4 = DotProduct((_arg1.x1 - _arg1.x0), (_arg1.y1 - _arg1.y0), (_arg2 - _arg1.x0), (_arg3 - _arg1.y0));
if (_local4 < 0){
return (false);
};
return (true);
}
public static function MissileEnemyCollision(){
var _local1:GameObj;
var _local2:GameObj;
for each (_local1 in GameObjects.objs) {
if (((((_local1.active) && (_local1.isEnemyMissile))) && ((_local1.controlMode == 2)))){
for each (_local2 in GameObjects.objs) {
if (((_local2.active) && (_local2.canBekilledByMissile))){
if (RectangleRectangleCollision(_local1, _local2)){
_local2.EnemyShotByMissile(_local1);
return;
};
};
};
};
};
}
static function RectangleRectangleCollision(_arg1:GameObj, _arg2:GameObj):Boolean{
var _local3:ObjectDef;
var _local4:ObjectDef;
var _local5:Rectangle;
var _local6:Rectangle;
_local3 = _arg1.GetObjectDef();
_local4 = _arg2.GetObjectDef();
_local5 = _local3.colRects[0].clone();
_local6 = _local4.colRects[0].clone();
_local5.x = (_local5.x + _arg1.xpos);
_local5.y = (_local5.y + _arg1.ypos);
_local6.x = (_local6.x + _arg2.xpos);
_local6.y = (_local6.y + _arg2.ypos);
return (_local5.intersects(_local6));
}
public static function PlayerDeathZoneCollision():void{
var _local1:GameObj;
var _local2:Poly;
if (Game.goPlayer.colFlag_playercanbekilled == false){
return;
};
_local1 = Game.goPlayer;
for each (_local2 in Game.polygonList) {
if (((((_local2.active) && ((_local2.type == Poly.polytype_ZONE)))) && ((_local2.subTypeName == "Death")))){
if (GameObjectInPolyBoundingBox(_local1, _local2)){
if (PointInConvexPoly(_local1.xpos, _local1.ypos, _local2.lineList)){
_local1.PlayerHitEnemy(null);
return;
};
};
};
};
}
public static function GetNearestEnemy(_arg1:Number, _arg2:Number):GameObj{
var _local3:GameObj;
var _local4:Number;
var _local5:GameObj;
var _local6:Number;
_local3 = null;
_local4 = 99999999;
for each (_local5 in GameObjects.objs) {
if (((_local5.active) && (_local5.colFlag_isEnemy))){
_local6 = Utils.Dist2BetweenPoints(_arg1, _arg2, _local5.xpos, _local5.ypos);
if (_local6 < _local4){
_local4 = _local6;
_local3 = _local5;
};
};
};
return (_local3);
}
static function Dist2Between(_arg1:GameObj, _arg2:GameObj):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg2.xpos - _arg1.xpos);
_local4 = (_arg2.ypos - _arg1.ypos);
return (((_local3 * _local3) + (_local4 * _local4)));
}
public static function FindPathByIndex(_arg1:int):Poly{
var _local2:int;
var _local3:Poly;
_local2 = 0;
for each (_local3 in Game.polygonList) {
if (((_local3.active) && ((_local3.type == Poly.polytype_PATH)))){
if (_local2 == _arg1){
return (_local3);
};
_local2++;
};
};
return (null);
}
static function Dist2BetweenPoints(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
_local5 = (_arg3 - _arg1);
_local6 = (_arg4 - _arg2);
return (((_local5 * _local5) + (_local6 * _local6)));
}
public static function FindNearestPathStartPointToPos(_arg1:Number, _arg2:Number):Poly{
var _local3:Poly;
var _local4:Number;
var _local5:Poly;
var _local6:Point;
var _local7:*;
_local3 = null;
_local4 = 99999999;
for each (_local5 in Game.polygonList) {
if (((_local5.active) && ((_local5.type == Poly.polytype_PATH)))){
_local6 = _local5.GetPoint(0);
_local7 = Utils.Dist2BetweenPoints(_local6.x, _local6.y, _arg1, _arg2);
if (_local7 < _local4){
_local4 = _local7;
_local3 = _local5;
};
};
};
return (_local3);
}
static function SideOfLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Boolean{
var _local7:Number;
_local7 = DotProduct((_arg3 - _arg1), (_arg4 - _arg2), (_arg5 - _arg1), (_arg6 - _arg2));
if (_local7 < 0){
return (false);
};
return (true);
}
static function PlayerObjectRectangleCollision(_arg1:GameObj):Boolean{
var _local2:GameObj;
var _local3:ObjectDef;
var _local4:ObjectDef;
var _local5:Rectangle;
var _local6:Rectangle;
_local2 = Game.goPlayer;
_local3 = _local2.GetObjectDef();
_local4 = _arg1.GetObjectDef();
_local5 = _local3.colRects[0].clone();
_local6 = _local4.colRects[0].clone();
_local5.x = (_local5.x + _local2.xpos);
_local5.y = (_local5.y + _local2.ypos);
_local6.x = (_local6.x + _arg1.xpos);
_local6.y = (_local6.y + _arg1.ypos);
return (_local5.intersects(_local6));
}
static function GameObjectInPolyBoundingBox(_arg1:GameObj, _arg2:Poly):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = (_arg1.radius + 50);
_local4 = _arg1.xpos;
_local5 = _arg1.ypos;
if (_arg2.boundingRectangle == null){
return (false);
};
stats_numBBTests++;
if (_local4 < (_arg2.boundingRectangle.left - _local3)){
return (false);
};
if (_local4 > (_arg2.boundingRectangle.right + _local3)){
return (false);
};
if (_local5 < (_arg2.boundingRectangle.top - _local3)){
return (false);
};
if (_local5 > (_arg2.boundingRectangle.bottom + _local3)){
return (false);
};
return (true);
}
public static function PlayerEnemyBulletCollision(){
var _local1:GameObj;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:GameObj;
_local1 = Game.goPlayer;
if (_local1.isDead){
return;
};
if (_local1.flashTimer > 0){
return;
};
for each (_local5 in GameObjects.objs) {
if (((_local5.active) && (_local5.colFlag_isEnemyBullet))){
if (PlayerObjectRectangleCollision(_local5)){
_local1.PlayerHitEnemy(_local5);
};
};
};
}
public static function BulletEnemyCollision(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Rectangle;
var _local5:Rectangle;
var _local6:GameObj;
var _local7:Number;
var _local8:Number;
var _local9:GameObj;
var _local10:ObjectDef;
for each (_local6 in GameObjects.objs) {
if (((_local6.active) && (_local6.colFlag_isBullet))){
_local7 = _local6.xpos;
_local8 = _local6.ypos;
for each (_local9 in GameObjects.objs) {
if (((_local9.active) && (_local9.colFlag_isEnemy))){
_local10 = _local9.GetObjectDef();
if (_local6.colFlag_UseRadius){
if (Utils.DistBetweenPoints(_local7, _local8, _local9.xpos, _local9.ypos) < _local6.radius){
_local9.EnemyHitByBullet(_local6);
};
} else {
for each (_local4 in _local10.colRects) {
_local5 = _local4.clone();
_local4.clone().x = (_local5.x + _local9.xpos);
_local5.y = (_local5.y + _local9.ypos);
if (_local5.contains(_local7, _local8)){
_local9.EnemyHitByBullet(_local6);
};
};
};
if (_local9.dodgeBullets){
_local9.DodgeBullet(_local6);
};
if (_local9.bulletTestCollisionExtraFunction != null){
if (_local9.bulletTestCollisionExtraFunction(_local6)){
};
};
};
};
};
};
}
public static function LineLineIntersection(_arg1:Line, _arg2:Line):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
_local3 = _arg1.x0;
_local4 = _arg1.y0;
_local5 = _arg1.x1;
_local6 = _arg1.y1;
_local7 = _arg2.x0;
_local8 = _arg2.y0;
_local9 = _arg2.x1;
_local10 = _arg2.y1;
_local11 = (_local5 - _local3);
_local12 = (_local9 - _local7);
_local13 = ((_local6 - _local4) / _local11);
_local14 = ((_local10 - _local8) / _local12);
_local15 = (_local4 - (_local13 * _local3));
_local16 = (_local8 - (_local14 * _local7));
_local17 = ((_local15 - _local16) / (_local14 - _local13));
_local18 = (((_local13 * (_local16 - _local15)) / (_local13 - _local14)) + _local15);
if (_arg1.boundingRect.contains(_local17, _local18)){
if (_arg2.boundingRect.contains(_local17, _local18)){
IntersectionX = _local17;
IntersectionY = _local18;
return (true);
};
};
return (false);
}
public static function ShootEnemyAtCursor(){
var _local1:Number;
var _local2:Number;
var _local3:GameObj;
_local1 = MouseControl.mousePosX;
_local2 = MouseControl.mousePosY;
for each (_local3 in GameObjects.objs) {
if (((_local3.active) && (_local3.colFlag_isEnemy))){
if (PointRectangleCollision(_local3, _local1, _local2)){
_local3.EnemyShot();
};
};
};
}
public static function PlayerPowerupCollision(){
var _local1:GameObj;
if (Game.goPlayer.colFlag_playercanbekilled == false){
return;
};
for each (_local1 in GameObjects.objs) {
if (((_local1.active) && (_local1.colFlag_isPowerup))){
if (PlayerObjectRectangleCollision(_local1)){
};
};
};
}
public static function PlayerPickupCollision(){
var _local1:GameObj;
var _local2:Number;
var _local3:Number;
var _local4:GameObj;
var _local5:Number;
_local1 = Game.goPlayer;
if (_local1.isDead){
return;
};
_local2 = _local1.xpos;
_local3 = _local1.ypos;
for each (_local4 in GameObjects.objs) {
if (((_local4.active) && (_local4.colFlag_canBePickedUp))){
_local5 = Utils.Dist2BetweenPoints(_local4.xpos, _local4.ypos, _local2, _local3);
_local4.controlMode = 0;
if (_local5 < (50 * 50)){
_local4.controlMode = 1;
};
if (_local5 < (30 * 30)){
};
};
};
}
static function PlayerObjectPointCollision(_arg1:GameObj):Boolean{
var _local2:GameObj;
var _local3:ObjectDef;
var _local4:Rectangle;
_local2 = Game.goPlayer;
_local3 = _local2.GetObjectDef();
_local4 = _local3.colRects[0].clone();
_local3.colRects[0].clone().x = (_local4.x + _local2.xpos);
_local4.y = (_local4.y + _local2.ypos);
return (_local4.contains(_arg1.xpos, _arg1.ypos));
}
static function Dist2ToLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Number{
var _local7:Number;
var _local8:Number;
ClosestPointOnLine(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
_local7 = (closestX - _arg5);
_local8 = (closestY - _arg6);
return (((_local7 * _local7) + (_local8 * _local8)));
}
static function Intersected(_arg1:GameObj, _arg2:Line, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):void{
var _local8:int;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:int;
var _local15:Number;
_local8 = 50;
_local9 = ((_arg1.oldxpos + _arg5) - _arg3);
_local10 = ((_arg1.oldypos + _arg6) - _arg4);
_local9 = (_local9 / Number(_local8));
_local10 = (_local10 / Number(_local8));
_local11 = (_arg1.xpos + _arg5);
_local12 = (_arg1.ypos + _arg6);
_local13 = (_arg7 * _arg7);
_local14 = 0;
while (_local14 < _local8) {
_local11 = (_local11 + _local9);
_local12 = (_local12 + _local10);
_local15 = Dist2ToLine(_arg2.x0, _arg2.y0, _arg2.x1, _arg2.y1, _local11, _local12);
if (_local15 > _local13){
_arg1.xpos = (_local11 - _arg5);
_arg1.ypos = (_local12 - _arg6);
return;
};
_local14++;
};
}
public static function SingleObjectZoneCollision(_arg1:GameObj):Poly{
var _local2:Poly;
for each (_local2 in Game.polygonList) {
if (((_local2.active) && ((_local2.type == Poly.polytype_ZONE)))){
if (GameObjectInPolyBoundingBox(_arg1, _local2)){
if (PointInConvexPoly(_arg1.xpos, _arg1.ypos, _local2.lineList)){
return (_local2);
};
};
};
};
return (null);
}
static function DistBetween(_arg1:GameObj, _arg2:GameObj):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg2.xpos - _arg1.xpos);
_local4 = (_arg2.ypos - _arg1.ypos);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
static function DistBetweenPoints(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
_local5 = (_arg3 - _arg1);
_local6 = (_arg4 - _arg2);
return (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))));
}
public static function PointInConvexPoly(_arg1:Number, _arg2:Number, _arg3:Array):Boolean{
var _local4:int;
var _local5:int;
var _local6:Line;
var _local7:Number;
_local4 = _arg3.length;
_local5 = 0;
while (_local5 < _local4) {
_local6 = _arg3[_local5];
_local7 = DotProduct((_local6.x0 - _arg1), (_local6.y0 - _arg2), _local6.nx, _local6.ny);
if (_local7 < 0){
return (false);
};
_local5++;
};
return (true);
}
public static function Update(_arg1:Main){
(main = _arg1);
(stats_numIntersections = 0);
(stats_numBBTests = 0);
(stats_numPolyCollisionTests = 0);
PlayerEnemyCollision();
PlayerEnemyBulletCollision();
MissileEnemyCollision();
}
public static function PlayerEnemyCollision(){
var _local1:GameObj;
var _local2:GameObj;
_local1 = Game.goPlayer;
if (_local1.flashTimer > 0){
return;
};
if (_local1.isDead){
return;
};
for each (_local2 in GameObjects.objs) {
if (((_local2.active) && (_local2.colFlag_isEnemy))){
if (PlayerObjectRectangleCollision(_local2)){
_local1.PlayerHitEnemy(_local2);
return;
};
};
};
}
static function DistToLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Number{
var _local7:Number;
var _local8:Number;
var _local9:Number;
ClosestPointOnLine(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
_local7 = (closestX - _arg5);
_local8 = (closestY - _arg6);
_local9 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
return (_local9);
}
public static function SingleObjectPlatformCollision(_arg1:GameObj):GameObj{
var _local2:Number;
var _local3:Number;
var _local4:GameObj;
var _local5:Rectangle;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local2 = _arg1.xpos;
_local3 = _arg1.ypos;
for each (_local4 in GameObjects.objs) {
if (((_local4.active) && (_local4.colFlag_isPlatform))){
_local5 = _local4.GetObjectRectangle();
_local6 = (_local4.xpos + _local5.x);
_local7 = (_local6 + _local5.width);
_local8 = (_local4.ypos + _local5.y);
_local9 = (_local8 + 15);
if ((((((((((_local2 >= _local6)) && ((_local2 <= _local7)))) && ((_arg1.yvel >= 0)))) && ((_local3 >= _local8)))) && ((_local3 <= _local9)))){
return (_local4);
};
};
};
return (null);
}
public static function EnemyPointInPolyCollision(_arg1:Poly, _arg2:GameObj){
var _local3:GameObj;
for each (_local3 in GameObjects.objs) {
if (((_local3.active) && (_local3.colFlag_isEnemy))){
if (GameObjectInPolyBoundingBox(_local3, _arg1)){
if (PointInConvexPoly(_local3.xpos, _local3.ypos, _arg1.lineList)){
_local3.EnemyHitByBullet(_arg2, true);
};
};
};
};
}
}
}//package
Section 19
//CreditsScreen (CreditsScreen)
package {
import flash.display.*;
public dynamic class CreditsScreen extends MovieClip {
public var buttonOK:SimpleButton;
}
}//package
Section 20
//Cursor (Cursor)
package {
import flash.display.*;
public dynamic class Cursor extends MovieClip {
}
}//package
Section 21
//Debug (Debug)
package {
public class Debug {
public static var debugMode:int = 0;
public static function RenderCollision(){
var _local1:Number;
var _local2:Number;
var _local3:int;
var _local4:uint;
var _local5:Line;
var _local6:Line;
var _local7:int;
var _local8:Poly;
return;
}
}
}//package
Section 22
//Defs (Defs)
package {
import flash.geom.*;
public class Defs {
public static const zpos_PICKUP = 1100;
public static const zpos_ENEMY = 1000;
public static const displayarea_w = 640;
public static const zpos_OVERLAY = 500;
public static const zpos_FAR = 10000;
public static const zpos_PLAYER = 1000;
public static const fps:Number = 34;
public static const platformW2 = 15;
public static const fps2:Number = 68;
public static const zpos_BACKGROUND = 10000;
public static const displayarea_h = 480;
public static var pointZero:Point = new Point(0, 0);
public static var screenRect:Rectangle = new Rectangle(0, 0, displayarea_w, displayarea_h);
}
}//package
Section 23
//DisplayObj (DisplayObj)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.geom.*;
import flash.filters.*;
public dynamic class DisplayObj {
var currentSetupFrame:int;
var flags:int;
var mc:MovieClip;
var ready:Boolean;
var frames:Array;
public var frame:int;
public function DisplayObj(_arg1:MovieClip, _arg2:Number, _arg3:int, _arg4:Boolean=false):void{
frames = null;
flags = _arg3;
mc = _arg1;
ready = false;
frame = 0;
currentSetupFrame = 1;
if (_arg4){
if (mc != null){
GraphicObjects.totalFramesDone = (GraphicObjects.totalFramesDone + CreateBitmapsFromMovieClip(mc, flags));
ready = true;
};
};
}
public function GetBitmap():Bitmap{
return (frames[frame].bitmap);
}
public function CreateFont(_arg1:TextFormat):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Matrix;
var _local7:Rectangle;
var _local8:Bitmap;
var _local9:BitmapData;
var _local10:Array;
var _local11:TextField;
var _local12:*;
frames = new Array();
_local10 = CreateAsciiStringTable();
_local2 = 0;
while (_local2 < _local10.length) {
_local11 = new TextField();
_local11.textColor = 4294967295;
_local11.selectable = false;
_local11.embedFonts = true;
_local11.autoSize = TextFieldAutoSize.LEFT;
_local11.x = 0;
_local11.y = 0;
_local11.text = _local10[_local2];
_local11.setTextFormat(_arg1);
_local12 = new DisplayObjFrame();
_local12.bitmaps = new Array();
_local12.xoffsets = new Array();
_local12.yoffsets = new Array();
_local12.mat = new Matrix();
_local12.colTrans = new ColorTransform();
_local7 = _local11.getBounds(null);
_local6 = new Matrix();
_local12.xoffsets.push(0);
_local12.yoffsets.push(0);
_local8 = new Bitmap();
_local9 = new BitmapData(_local7.width, _local7.height, true, 0);
_local9.draw(_local11, _local6);
_local8.bitmapData = _local9;
_local12.bitmaps.push(_local8);
frames.push(_local12);
_local2++;
};
}
public function RenderAt(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Boolean=false):void{
frames[frame].RenderAt(_arg1, _arg2, _arg3, _arg4);
}
public function GetMaxFrames():int{
return (frames.length);
}
public function GetFrame():int{
return (frame);
}
public function SetFrame(_arg1:int){
frame = _arg1;
if (frame < 0){
frame = 0;
};
if (frame >= frames.length){
frame = (frames.length - 1);
};
}
public function GetXOffset():Number{
return (frames[frame].xoffset);
}
public function CreateBitmapsFromMovieClip(_arg1:MovieClip, _arg2:int):int{
var _local3:Boolean;
var _local4:Boolean;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:Matrix;
var _local11:Rectangle;
var _local12:Bitmap;
var _local13:BitmapData;
var _local14:Bitmap;
var _local15:BitmapData;
var _local16:ColorTransform;
var _local17:*;
_local3 = true;
_local4 = false;
if (_arg2 == 5){
_local4 = true;
_arg2 = 0;
};
if (_arg2 == 4){
_local3 = false;
};
_local5 = false;
if (_arg2 == 6){
_local5 = true;
};
if (frames == null){
};
frames = new Array();
_local16 = new ColorTransform(1, 1, 1, 1, 0xFF, 0xFF, 0xFF, 0);
_arg1.gotoAndStop(1);
_local6 = 0;
while (_local6 < _arg1.totalFrames) {
_local17 = new DisplayObjFrame();
_local17.bitmaps = new Array();
_local17.xoffsets = new Array();
_local17.yoffsets = new Array();
_local17.mat = new Matrix();
_local17.colTrans = new ColorTransform();
_local11 = _arg1.getBounds(null);
_local11.x = Math.floor(_local11.x);
_local11.y = Math.floor(_local11.y);
_local11.width = Math.floor((_local11.width + 1));
_local11.height = Math.floor((_local11.height + 1));
_local9 = Math.floor(_local9);
_local10 = new Matrix();
_local8 = _local11.left;
_local9 = _local11.top;
_local10.translate(-(_local8), -(_local9));
_local17.xoffsets.push(Number(_local8));
_local17.yoffsets.push(Number(_local9));
if (((!((_arg1.width == 0))) && (!((_arg1.height == 0))))){
_local12 = new Bitmap();
_local13 = new BitmapData(_local11.width, _local11.height, true, 0);
_local13.draw(_arg1, _local10);
_local12.bitmapData = _local13;
_local17.bitmaps.push(_local12);
} else {
_local17.bitmaps.push(null);
};
if (_local4){
_local11 = _arg1.getBounds(null);
_local11.x = Math.floor(_local11.x);
_local11.y = Math.floor(_local11.y);
_local11.width = Math.floor((_local11.width + 1));
_local11.height = Math.floor((_local11.height + 1));
_local9 = Math.floor(_local9);
_local10 = new Matrix();
_local8 = _local11.left;
_local9 = _local11.top;
_local10.translate(-(_local8), -(_local9));
_local10.scale(-1, 1);
_local10.translate(_local11.width, 0);
_local17.xoffsets.push(Number(-(_local11.right)));
_local17.yoffsets.push(Number(_local9));
if (((!((_arg1.width == 0))) && (!((_arg1.height == 0))))){
_local12 = new Bitmap();
_local13 = new BitmapData(_local11.width, _local11.height, true, 0);
_local13.draw(_arg1, _local10);
_local12.bitmapData = _local13;
_local17.bitmaps.push(_local12);
} else {
_local17.bitmaps.push(null);
};
};
frames.push(_local17);
_arg1.nextFrame();
_local6++;
};
return (_arg1.totalFrames);
}
public function GetYOffset():Number{
return (frames[frame].yoffset);
}
function CreateAsciiStringTable():Array{
var _local1:Array;
_local1 = new Array();
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push(" ");
_local1.push("!");
_local1.push("'");
_local1.push("#");
_local1.push("$");
_local1.push("%");
_local1.push("&");
_local1.push("'");
_local1.push("(");
_local1.push(")");
_local1.push("*");
_local1.push("+");
_local1.push(",");
_local1.push("-");
_local1.push(".");
_local1.push("/");
_local1.push("0");
_local1.push("1");
_local1.push("2");
_local1.push("3");
_local1.push("4");
_local1.push("5");
_local1.push("6");
_local1.push("7");
_local1.push("8");
_local1.push("9");
_local1.push(":");
_local1.push(";");
_local1.push("<");
_local1.push("=");
_local1.push(">");
_local1.push("?");
_local1.push("@");
_local1.push("A");
_local1.push("B");
_local1.push("C");
_local1.push("D");
_local1.push("E");
_local1.push("F");
_local1.push("G");
_local1.push("H");
_local1.push("I");
_local1.push("J");
_local1.push("K");
_local1.push("L");
_local1.push("M");
_local1.push("N");
_local1.push("O");
_local1.push("P");
_local1.push("Q");
_local1.push("R");
_local1.push("S");
_local1.push("T");
_local1.push("U");
_local1.push("V");
_local1.push("W");
_local1.push("X");
_local1.push("Y");
_local1.push("Z");
_local1.push("[");
_local1.push("\\");
_local1.push("]");
_local1.push("^");
_local1.push("_");
_local1.push("'");
_local1.push("a");
_local1.push("b");
_local1.push("c");
_local1.push("d");
_local1.push("e");
_local1.push("f");
_local1.push("g");
_local1.push("h");
_local1.push("i");
_local1.push("j");
_local1.push("k");
_local1.push("l");
_local1.push("m");
_local1.push("n");
_local1.push("o");
_local1.push("p");
_local1.push("q");
_local1.push("r");
_local1.push("s");
_local1.push("t");
_local1.push("u");
_local1.push("v");
_local1.push("w");
_local1.push("x");
_local1.push("y");
_local1.push("z");
_local1.push("{");
_local1.push("|");
_local1.push("}");
_local1.push("~");
return (_local1);
}
public function CreateBitmapsFromMovieClip1(_arg1:MovieClip, _arg2:int):int{
var _local3:Boolean;
var _local4:Boolean;
var _local5:Boolean;
var _local6:Boolean;
var _local7:Boolean;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:Matrix;
var _local13:Rectangle;
var _local14:Bitmap;
var _local15:BitmapData;
var _local16:Bitmap;
var _local17:BitmapData;
var _local18:Matrix;
var _local19:ColorTransform;
var _local20:ColorTransform;
var _local21:int;
var _local22:*;
var _local23:BlurFilter;
var _local24:Bitmap;
var _local25:BitmapData;
_local3 = false;
_local4 = true;
_local5 = true;
if (_arg2 == 2){
_local3 = true;
_arg2 = 0;
};
if (_arg2 == 4){
_local4 = false;
};
if (_arg2 == 5){
_local4 = false;
_local5 = false;
};
if (_arg2 == 3){
};
_local6 = false;
if (_arg2 == 6){
_local6 = true;
};
if (frames == null){
currentSetupFrame = 1;
frames = new Array();
};
_local7 = false;
_local12 = new Matrix();
_local18 = new Matrix();
_local19 = new ColorTransform(0, 0, 0, 0.5, 0, 0, 0, 0);
_local20 = new ColorTransform(1, 1, 1, 1, 0xFF, 0xFF, 0xFF, 0);
_local21 = 0;
if (currentSetupFrame < (_arg1.totalFrames + 1)){
_arg1.gotoAndStop(currentSetupFrame);
_local22 = new DisplayObjFrame();
_local22.bitmaps = new Array();
_local22.shadowBitmaps = new Array();
_local22.xoffsets = new Array();
_local22.yoffsets = new Array();
_local22.mat = new Matrix();
_local22.colTrans = new ColorTransform();
_local13 = _arg1.getBounds(null);
_local13.x = Math.floor(_local13.x);
_local13.y = Math.floor(_local13.y);
_local13.width = Math.floor((_local13.width + 1));
_local13.height = Math.floor((_local13.height + 1));
_local11 = Math.floor(_local11);
_local12.identity();
_local10 = _local13.left;
_local11 = _local13.top;
_local12.translate(-(_local10), -(_local11));
_local22.xoffsets.push(Number(_local10));
_local22.yoffsets.push(Number(_local11));
if (((!((_arg1.width == 0))) && (!((_arg1.height == 0))))){
_local14 = new Bitmap();
_local15 = new BitmapData(_local13.width, _local13.height, _local5, 0);
if (_local6){
_local15.draw(_arg1, _local12, _local20);
_local23 = new BlurFilter();
_local15.applyFilter(_local15, new Rectangle(0, 0, _local15.width, _local15.height), Defs.pointZero, _local23);
_local14.bitmapData = _local15;
_local22.bitmaps.push(_local14);
} else {
_local15.draw(_arg1, _local12);
_local14.bitmapData = _local15;
_local22.bitmaps.push(_local14);
};
if (_local4){
_local24 = new Bitmap();
_local25 = new BitmapData(_local13.width, _local13.height, _local5, 0);
_local25.draw(_local15, null, _local19);
_local24.bitmapData = _local25;
_local22.shadowBitmaps.push(_local24);
};
} else {
_local22.bitmaps.push(null);
_local22.shadowBitmaps.push(null);
};
frames.push(_local22);
currentSetupFrame++;
_local21++;
};
_local12 = null;
_local19 = null;
return (_local21);
}
public function GetFrameWidth(_arg1:int):Number{
return (frames[_arg1].bitmap.width);
}
public function RenderAtRot(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean):void{
if (_arg5){
frames[frame].RenderAtRotBurned(_arg1, _arg2, _arg3, _arg4);
} else {
frames[frame].RenderAtRot(_arg1, _arg2, _arg3, _arg4);
};
}
public function RenderAtColTrans(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:ColorTransform, _arg5:Boolean=false):void{
frames[frame].RenderAtColTrans(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public function GetWidth():Number{
return (frames[frame].bitmap.width);
}
public function GetHeight():Number{
return (frames[frame].bitmap.height);
}
public function GetScaledBitmap():Bitmap{
return (frames[frame].scaledBitmap);
}
}
}//package
import flash.display.*;
import flash.geom.*;
class DisplayObjFrame {
public var colTrans:ColorTransform;
public var mat:Matrix;
public var shadowBitmaps:Array;
public var yoffsets:Array;
public var xoffsets:Array;
public var bitmaps:Array;
private function DisplayObjFrame(){
}
public function RenderAtScaled(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Number=1):void{
var _local6:Bitmap;
var _local7:Number;
var _local8:Number;
_local6 = bitmaps[0];
_local7 = xoffsets[0];
_local8 = yoffsets[0];
if (_arg4){
_local6 = bitmaps[1];
_local7 = xoffsets[1];
_local8 = yoffsets[1];
};
mat.identity();
mat.scale(_arg5, _arg5);
mat.translate((_arg2 + (_local7 * _arg5)), (_arg3 + (_local8 * _arg5)));
if (_local6 != null){
if (_local6.bitmapData != null){
_arg1.draw(_local6.bitmapData, mat);
};
};
}
public function RenderAtShadow(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Boolean=false):void{
var _local5:Bitmap;
var _local6:Number;
var _local7:Number;
_local5 = shadowBitmaps[0];
_local6 = xoffsets[0];
_local7 = yoffsets[0];
if (_arg4){
_local5 = shadowBitmaps[1];
_local6 = xoffsets[1];
_local7 = yoffsets[1];
};
_arg1.copyPixels(_local5.bitmapData, new Rectangle(0, 0, _local5.width, _local5.height), new Point((_arg2 + _local6), (_arg3 + _local7)), null, null, true);
}
public function RenderAt(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Boolean=false):void{
var _local5:Bitmap;
var _local6:Number;
var _local7:Number;
_local5 = bitmaps[0];
_local6 = xoffsets[0];
_local7 = yoffsets[0];
if (_arg4){
_local5 = bitmaps[1];
_local6 = xoffsets[1];
_local7 = yoffsets[1];
};
_arg1.copyPixels(_local5.bitmapData, new Rectangle(0, 0, _local5.width, _local5.height), new Point((_arg2 + _local6), (_arg3 + _local7)), null, null, true);
}
public function RenderAtSplit(_arg1:BitmapData, _arg2:Number, _arg3:Number):void{
var _local4:int;
var _local5:Bitmap;
var _local6:Number;
var _local7:Number;
_local4 = 0;
while (_local4 < bitmaps.length) {
_local5 = bitmaps[_local4];
_local6 = xoffsets[_local4];
_local7 = yoffsets[_local4];
_arg1.copyPixels(_local5.bitmapData, new Rectangle(0, 0, _local5.width, _local5.height), new Point((_arg2 + _local6), (_arg3 + _local7)), null, null, true);
_local4++;
};
}
public function RenderAtAlpha(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Bitmap;
var _local6:Number;
var _local7:Number;
_local5 = bitmaps[0];
_local6 = xoffsets[0];
_local7 = yoffsets[0];
mat.identity();
mat.translate((_arg2 + _local6), (_arg3 + _local7));
colTrans.alphaMultiplier = _arg4;
if (_local5 != null){
if (_local5.bitmapData != null){
_arg1.draw(_local5.bitmapData, mat, colTrans);
};
};
}
public function RenderAtFunction(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:String):void{
var _local6:Bitmap;
var _local7:Number;
var _local8:Number;
_local6 = bitmaps[0];
_local7 = xoffsets[0];
_local8 = yoffsets[0];
mat.identity();
mat.translate((_arg2 + _local7), (_arg3 + _local8));
colTrans.alphaMultiplier = _arg4;
if (_local6 != null){
if (_local6.bitmapData != null){
_arg1.draw(_local6.bitmapData, mat, colTrans, _arg5);
};
};
}
public function RenderAtRotScaled(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Number=1, _arg6:Number=0):void{
var _local7:Bitmap;
var _local8:Number;
var _local9:Number;
_local7 = bitmaps[0];
_local8 = xoffsets[0];
_local9 = yoffsets[0];
if (_arg4){
_local7 = bitmaps[1];
_local8 = xoffsets[1];
_local9 = yoffsets[1];
};
mat.identity();
mat.translate(_local8, _local9);
mat.rotate(_arg6);
mat.translate(-(_local8), -(_local9));
mat.scale(_arg5, _arg5);
mat.translate((_arg2 + (_local8 * _arg5)), (_arg3 + (_local9 * _arg5)));
if (_local7 != null){
if (_local7.bitmapData != null){
_arg1.draw(_local7.bitmapData, mat);
};
};
}
public function RenderAtRot(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:int;
var _local6:int;
var _local7:Bitmap;
var _local8:Number;
var _local9:Number;
_arg4 = (_arg4 - 0.01);
_local5 = bitmaps.length;
_arg4 = ((Number(_local5) / (Math.PI * 2)) * _arg4);
_local6 = _arg4;
while (_local6 < 0) {
_local6 = (_local6 + _local5);
};
while (_local6 > (_local5 - 1)) {
_local6 = (_local6 - _local5);
};
_local6 = ((_local5 - 1) - _local6);
_local7 = bitmaps[_local6];
_local8 = xoffsets[_local6];
_local9 = yoffsets[_local6];
_arg1.copyPixels(_local7.bitmapData, new Rectangle(0, 0, _local7.width, _local7.height), new Point((_arg2 + _local8), (_arg3 + _local9)));
}
public function RenderAtRotScaledColTrans(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Number=1, _arg6:Number=0, _arg7:ColorTransform=null):void{
var _local8:Bitmap;
var _local9:Number;
var _local10:Number;
_local8 = bitmaps[0];
_local9 = xoffsets[0];
_local10 = yoffsets[0];
if (_arg4){
_local8 = bitmaps[1];
_local9 = xoffsets[1];
_local10 = yoffsets[1];
};
mat.identity();
mat.translate(_local9, _local10);
mat.rotate(_arg6);
mat.translate(-(_local9), -(_local10));
mat.scale(_arg5, _arg5);
mat.translate((_arg2 + (_local9 * _arg5)), (_arg3 + (_local10 * _arg5)));
if (_local8 != null){
if (_local8.bitmapData != null){
_arg1.draw(_local8.bitmapData, mat, _arg7);
};
};
}
public function RenderAtColTrans(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:ColorTransform=null, _arg6:String=null):void{
var _local7:Bitmap;
var _local8:Number;
var _local9:Number;
_local7 = bitmaps[0];
_local8 = xoffsets[0];
_local9 = yoffsets[0];
if (_arg4){
_local7 = bitmaps[1];
_local8 = xoffsets[1];
_local9 = yoffsets[1];
};
mat.identity();
mat.translate((_arg2 + _local8), (_arg3 + _local9));
if (_local7 != null){
if (_local7.bitmapData != null){
_arg1.draw(_local7.bitmapData, mat, _arg5, _arg6);
};
};
}
public function RenderAtAdditive(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Bitmap;
var _local6:Number;
var _local7:Number;
_local5 = bitmaps[0];
_local6 = xoffsets[0];
_local7 = yoffsets[0];
mat.identity();
mat.translate((_arg2 + _local6), (_arg3 + _local7));
colTrans.alphaMultiplier = _arg4;
if (_local5 != null){
if (_local5.bitmapData != null){
_arg1.draw(_local5.bitmapData, mat, colTrans, "add");
};
};
}
}
Section 24
//EnemyBullet (EnemyBullet)
package {
import flash.display.*;
public dynamic class EnemyBullet extends MovieClip {
}
}//package
Section 25
//EnemyCopter (EnemyCopter)
package {
import flash.display.*;
public dynamic class EnemyCopter extends MovieClip {
}
}//package
Section 26
//EnemyMissile (EnemyMissile)
package {
import flash.display.*;
public dynamic class EnemyMissile extends MovieClip {
}
}//package
Section 27
//explo01 (explo01)
package {
import flash.media.*;
public dynamic class explo01 extends Sound {
}
}//package
Section 28
//explo02 (explo02)
package {
import flash.media.*;
public dynamic class explo02 extends Sound {
}
}//package
Section 29
//Explosion1 (Explosion1)
package {
import flash.display.*;
public dynamic class Explosion1 extends MovieClip {
}
}//package
Section 30
//Explosion2 (Explosion2)
package {
import flash.display.*;
public dynamic class Explosion2 extends MovieClip {
}
}//package
Section 31
//ExternalData (ExternalData)
package {
import flash.events.*;
import flash.net.*;
public class ExternalData {
static var f:Function;
static var xml:XML;
static var xxx:XML = <data>
<enemies>
<enemy type="cannon1"/>
<enemy type="cannon2"/>
<enemy type="bouncingbomb"/>
<enemy type="landmine"/>
<enemy type="jetpackred"/>
<enemy type="jetpackblue"/>
<enemy type="copter"/>
<enemy type="boss"/>
</enemies>
<!-- Level definition from here: -->
<!-- You can make changes to this list -->
<!-- When done, save the file, and press '8' in-game. this will re-load the levels -->
<!-- Pressing '9' in-game advances to the next wave -->
<player shotspeed="3" tempadd="0.01" noshotadd="-0.005"/>
<wavedef time="5">
<enemy type="cannon1" max="1" freq="1"/>
</wavedef>
<wavedef time="5">
<enemy type="cannon2" max="1" freq="1"/>
</wavedef>
<wavedef time="7">
<enemy type="cannon1" max="1" freq="1"/>
<enemy type="cannon2" max="1" freq="1"/>
<enemy type="bouncingbomb" max="1" freq="1"/>
</wavedef>
<wavedef time="9">
<enemy type="cannon1" max="2" freq="1"/>
<enemy type="cannon2" max="2" freq="1"/>
<enemy type="bouncingbomb" max="2" freq="1"/>
</wavedef>
<wavedef time="10">
<enemy type="cannon1" max="5" freq="0.7"/>
<enemy type="cannon2" max="5" freq="0.7"/>
<enemy type="bouncingbomb" max="3" freq="3"/>
</wavedef>
<wavedef time="15">
<enemy type="cannon1" max="3" freq="1.3"/>
<enemy type="cannon2" max="3" freq="1.3"/>
<enemy type="bouncingbomb" max="2" freq="2"/>
<enemy type="jetpackred" max="1" freq="20"/>
</wavedef>
<wavedef time="7">
<enemy type="boss" max="1" freq="1" difficulty="1"/>
</wavedef>
<wavedef time="13">
<enemy type="cannon1" max="0" freq="0"/>
<enemy type="cannon2" max="0" freq="0"/>
<enemy type="bouncingbomb" max="4" freq="2"/>
<enemy type="jetpackred" max="3" freq="20"/>
</wavedef>
<wavedef time="10">
<enemy type="cannon1" max="5" freq="1"/>
<enemy type="cannon2" max="5" freq="1"/>
<enemy type="landmine" max="3" freq="4"/>
</wavedef>
<wavedef time="10">
<enemy type="copter" max="1" freq="26"/>
</wavedef>
<wavedef time="10">
<enemy type="cannon1" max="5" freq="1"/>
<enemy type="cannon2" max="5" freq="1"/>
</wavedef>
<wavedef time="10">
<enemy type="cannon1" max="10" freq="0.3"/>
<enemy type="cannon2" max="7" freq="0.3"/>
</wavedef>
<wavedef time="3">
<enemy type="cannon1" max="10" freq="0.2"/>
<enemy type="cannon2" max="7" freq="0.2"/>
</wavedef>
<wavedef time="7">
<enemy type="boss" max="1" freq="1" difficulty="2"/>
</wavedef>
<wavedef time="5">
<enemy type="cannon1" max="0" freq="2"/>
<enemy type="cannon2" max="0" freq="2"/>
</wavedef>
<wavedef time="18">
<enemy type="jetpackblue" max="1" freq="26"/>
<enemy type="copter" max="1" freq="26"/>
</wavedef>
<wavedef time="15">
<enemy type="cannon1" max="9" freq="0.4"/>
<enemy type="cannon2" max="9" freq="0.5"/>
<enemy type="landmine" max="7" freq="5"/>
<enemy type="bouncingbomb" max="7" freq="3"/>
</wavedef>
<wavedef time="5">
<enemy type="cannon1" max="1" freq="2"/>
<enemy type="cannon2" max="1" freq="2"/>
</wavedef>
<wavedef time="15">
<enemy type="cannon1" max="30" freq="0.2"/>
<enemy type="cannon2" max="30" freq="0.2"/>
</wavedef>
<wavedef time="7">
<enemy type="boss" max="1" freq="1" difficulty="4"/>
</wavedef>
<wavedef time="5">
<enemy type="cannon1" max="1" freq="2"/>
<enemy type="cannon2" max="1" freq="2"/>
</wavedef>
<wavedef time="15">
<enemy type="cannon1" max="15" freq="0.4"/>
<enemy type="cannon2" max="15" freq="0.4"/>
</wavedef>
<wavedef time="10">
<enemy type="bouncingbomb" max="15" freq="0.2"/>
</wavedef>
<wavedef time="15">
<enemy type="cannon1" max="9" freq="2"/>
<enemy type="cannon2" max="9" freq="2"/>
<enemy type="landmine" max="7" freq="5"/>
<enemy type="bouncingbomb" max="7" freq="6"/>
<enemy type="copter" max="1" freq="26"/>
</wavedef>
<wavedef time="15">
<enemy type="cannon1" max="2" freq="5"/>
<enemy type="cannon2" max="2" freq="5"/>
<enemy type="landmine" max="7" freq="8"/>
<enemy type="bouncingbomb" max="7" freq="9"/>
<enemy type="copter" max="1" freq="26"/>
<enemy type="jetpackblue" max="1" freq="26"/>
</wavedef>
<wavedef time="15">
<enemy type="cannon1" max="2" freq="2"/>
<enemy type="cannon2" max="2" freq="2"/>
<enemy type="landmine" max="7" freq="4"/>
<enemy type="bouncingbomb" max="7" freq="2"/>
<enemy type="copter" max="1" freq="26"/>
<enemy type="jetpackblue" max="1" freq="26"/>
</wavedef>
<wavedef time="15">
<enemy type="cannon1" max="15" freq="0.1"/>
<enemy type="cannon2" max="15" freq="0.1"/>
</wavedef>
</data>
;
static var xmlLoader:URLLoader;
public static function InitOnce(_arg1:Function){
f = _arg1;
XmlLoadedInternal();
}
public static function xmlLoaded(_arg1:Event){
XML.ignoreWhitespace = true;
xml = new XML(_arg1.target.data);
f();
}
public static function XmlLoadedInternal(){
XML.ignoreWhitespace = true;
xml = new XML(xxx);
f();
}
}
}//package
Section 32
//FarBackground (FarBackground)
package {
import flash.display.*;
public dynamic class FarBackground extends MovieClip {
}
}//package
Section 33
//Font1 (Font1)
package {
import flash.text.*;
public dynamic class Font1 extends Font {
}
}//package
Section 34
//Game (Game)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
public class Game {
static const levelState_Dead = 4;
static const levelFinishedState_WON = 1;
static const levelFinishedState_NOT = 0;
static const levelFinishedState_LOST = 2;
static const levelState_Play = 1;
static const levelState_BonusTime = 2;
static const levelState_LevelStart = 0;
static const levelState_EndSequence = 3;
public static var gunShootDelay:int;
static var goBattleCopter:GameObj;
static var dibsSpeechTimer:int;
static var currentWave:int;
public static var gunTemperature:Number;
static var levelFinishedState:int;
static var isBossLevel:Boolean;
static var waveTimeMax:int;
static var levelTimer:int;
static var currentBackgroundFrame:int;
public static var gunNoShootAdder:Number;
public static var currentPortalGroup:int;
static var goBackground:GameObj;
static var offsett:Number = -40;
static var updateEnemyTimer:int = 0;
public static var gravity;
public static var firstTime_Powerup3:Boolean;
public static var firstTime_Powerup1:Boolean;
public static var firstTime_Powerup2:Boolean;
public static var firstTime_Powerup4:Boolean;
public static var currentStartPointIndex:int;
static var invincibleTimer:int;
public static var levelstart_score:int;
static var shakeMax:Number = 1;
public static var maxFallSpeed;
static var playerWeaponGroups:Array;
static var numLevels:int;
static var currentScore:int;
static var ed:ExternalData;
static var effectInited:Boolean = false;
public static var playerExtraJumpYvel = -4;
public static var LevelUpdateCallback:Object;
public static var animDefs:Array;
public static var mouseMapX:Number;
public static var mouseMapY:Number;
static var effectRad:Number = 160;
static var showingOverlay:Boolean;
static var backgroundB:Bitmap;
static var shakeDecVel:Number = -0.1;
public static var numEnemiesActive:int;
public static var normalHeight = 100;
public static var bulletTime:int;
public static var polygonList:Array;
static var shake:Number = 0;
static var numCreds:int;
public static var gunShootDelayPerShot:int;
public static var bossGO:GameObj;
static var numWeenies:int;
public static var scrollH:Number;
static var invincibleTimerMax:int;
static var numLives:int;
static var showingOverlayID:int;
static var speedupTimerMax:int;
public static var scrollW:Number;
public static var scrollX:Number;
public static var scrollY:Number;
static var cash:int;
static var speedupTimer:int;
static var doOverlay:Boolean = true;
public static var particleMode:int;
public static var gunOverheatAdder:Number;
public static var levelstart_shotsfired:int;
static var tempRect1:Rectangle = new Rectangle(10, 10, 200, 10);
static var map:BitmapData = null;
static var waveTime:int;
public static var floorYpos:int = 440;
static var shakeMin:Number = 0;
static var levelState:int;
public static var levelstart_cash:int;
public static var scrollSpeed:Number = 20;
public static var numKilledInWaveList:Array;
public static var level:Level;
static var currentLevel:int;
static var doScale:Boolean = true;
public static var gunShootAdder:Number;
static var levelsCompleted:Boolean;
static var dibsSpeechFlag:Boolean;
static var enemyCountList:Array;
static var main:Main;
static var multiplier:int;
public static var gunOverheated:Boolean;
public static var startPointX:Number;
public static var startPointY:Number;
static var genTimer:int;
static var levelStateTimer:int;
public static var startPointObjs:Array;
public static var playerJumpYvel = -6;
static var tempRect:Rectangle = new Rectangle(10, 10, 200, 10);
static var scrollMaxX;
static var scrollMaxY;
public static var startPoints:Array;
static var overlayMC:MovieClip;
static var goPlayer:GameObj;
public static var portalDef:PortalDef;
static var pause:Boolean;
static var backgroundBD:BitmapData;
public static function InitAnimDefs():void{
animDefs = new Array();
animDefs.push(new AnimDef("man_walk", 1, 38, 1.7));
animDefs.push(new AnimDef("man_run", 39, 55, 1.5));
animDefs.push(new AnimDef("man_punch", 56, 102, 4));
animDefs.push(new AnimDef("man_kick", 103, 162, 4));
animDefs.push(new AnimDef("man_backjump", 163, 262, 1.5));
animDefs.push(new AnimDef("man_idle", 263, 275, 1));
}
static function GetWeaponGroupById(_arg1):PlayerWeaponGroup{
var _local2:PlayerWeaponGroup;
for each (_local2 in playerWeaponGroups) {
if (_local2.id == _arg1){
return (_local2);
};
};
return (null);
}
public static function HandleMouseWheel(_arg1:int){
}
public static function UpdateGameplay():void{
var _local1:int;
var _local2:int;
if (pause == true){
return;
};
SoundPlayer.UpdateOncePerFrame();
mouseMapX = (MouseControl.mousePosX + Game.scrollX);
mouseMapY = (MouseControl.mousePosY + Game.scrollY);
if (LevelUpdateCallback != null){
LevelUpdateCallback();
};
_local1 = 1;
if (levelState == levelState_LevelStart){
levelStateTimer--;
if (levelStateTimer <= 0){
};
};
if (levelState == levelState_BonusTime){
levelStateTimer--;
if (levelStateTimer <= 0){
};
};
if (levelState == levelState_EndSequence){
levelStateTimer--;
if (levelStateTimer <= 0){
};
};
if (levelState == levelState_Dead){
levelStateTimer--;
if (levelStateTimer <= 0){
TitleScreenState.InitGameOver();
};
};
numEnemiesActive = CountActiveEnemies();
if (invincibleTimer > 0){
invincibleTimer--;
};
_local2 = 0;
while (_local2 < _local1) {
if (bulletTime > 0){
bulletTime--;
};
if ((((((levelState == levelState_Play)) || ((levelState == levelState_BonusTime)))) || ((levelState == levelState_LevelStart)))){
levelTimer++;
};
if (isBossLevel == false){
currentScore++;
};
UpdateWave();
GameObjects.Update();
Collision.Update(main);
Particles.Update(1);
_local2++;
};
if ((((((levelState == levelState_Play)) || ((levelState == levelState_BonusTime)))) || ((levelState == levelState_LevelStart)))){
if (goPlayer.health < 0){
goPlayer.health = 0;
InitLevelState(levelState_Dead);
};
};
}
public static function CountAll():void{
var _local1:int;
var _local2:GameObj;
_local1 = 0;
while (_local1 < WaveDefs.et_max) {
enemyCountList[_local1] = 0;
_local1++;
};
for each (_local2 in GameObjects.objs) {
if ((((_local2.active == true)) && (_local2.colFlag_isEnemy))){
var _local5 = enemyCountList;
var _local6 = _local2.enemyType;
var _local7 = (_local5[_local6] + 1);
_local5[_local6] = _local7;
};
};
}
public static function InitLevel(){
var _local1:GameObj;
var _local2:XML;
pause = true;
currentScore = 0;
main.screenBD.fillRect(Defs.screenRect, 0);
Debug.debugMode = 0;
KeyReader.InitOnce(main.stage);
MusicPlayer.StartMusic(1);
WaveDefs.InitOnce();
ObjectDefs.Init();
Particles.Reset();
GameObjects.ClearAll();
levelFinishedState = levelFinishedState_NOT;
goPlayer = GameObjects.AddObj(300, 400, 1000);
goPlayer.InitPlayer();
goBattleCopter = GameObjects.AddObj(0, 0, 1000);
goBattleCopter.InitBattleCopter();
_local1 = GameObjects.AddObj(0, 0, 100);
_local1.InitCursor();
_local1 = GameObjects.AddObj(0, 0, 10000);
_local1.InitBackground(GraphicObjects.gfx_bg_farbackground, 0);
_local1 = GameObjects.AddObj(0, 0, 9000);
_local1.InitBackground(GraphicObjects.gfx_bg_clouds, 1, 2000);
_local1 = GameObjects.AddObj(0, -30, 8000);
_local1.InitBackground(GraphicObjects.gfx_bg_clouds1, 1.6, 2000);
_local1 = GameObjects.AddObj(0, 330, 7000);
_local1.InitBackground(GraphicObjects.gfx_bg_grass, 0.6);
_local1 = GameObjects.AddObj(0, 350, 6000);
_local1.InitBackground(GraphicObjects.gfx_bg_grass1, 1);
_local1 = GameObjects.AddObj(0, 375, 100);
_local1.InitBackground(GraphicObjects.gfx_bg_grass2, 2);
_local1 = GameObjects.AddObj(0, 300, 9500);
_local1.InitMoon();
scrollX = 0;
scrollY = 0;
main.effectScreenBD.fillRect(Defs.screenRect, 0);
LevelUpdateCallback = null;
scrollW = 1000;
scrollH = 1000;
scrollMaxX = (scrollW - Defs.displayarea_w);
scrollMaxY = (scrollH - Defs.displayarea_h);
gravity = 0.4;
maxFallSpeed = 15;
showingOverlay = false;
showingOverlayID = 0;
invincibleTimer = 0;
invincibleTimerMax = (Defs.fps * 2);
speedupTimer = 0;
speedupTimerMax = (Defs.fps * 10);
numWeenies = 0;
numCreds = 0;
dibsSpeechFlag = false;
dibsSpeechTimer = 0;
firstTime_Powerup1 = false;
firstTime_Powerup2 = false;
firstTime_Powerup3 = false;
firstTime_Powerup4 = false;
InitLevelState(levelState_Play);
InitGenerateEnemies();
bossGO = null;
bulletTime = 0;
currentBackgroundFrame = 0;
trace(("starting bg " + currentBackgroundFrame));
numEnemiesActive = 0;
levelstart_score = currentScore;
levelstart_cash = cash;
currentPortalGroup = 0;
levelTimer = 0;
Stats.StartLevel();
particleMode = 0;
InitUpdateEnemies();
_local2 = ExternalData.xml;
gunTemperature = 0;
gunShootAdder = Number(_local2.player.@tempadd);
gunNoShootAdder = Number(_local2.player.@noshotadd);
gunOverheatAdder = Number(_local2.player.@noshotadd);
gunOverheated = false;
gunShootDelay = 0;
gunShootDelayPerShot = int(_local2.player.@shotspeed);
currentWave = 0;
InitWave();
enemyCountList = new Array(WaveDefs.et_max);
CountAll();
pause = false;
}
public static function GetPolyByName(_arg1:String):Poly{
var _local2:Poly;
for each (_local2 in polygonList) {
if (((_local2.active) && ((_local2.name == _arg1)))){
return (_local2);
};
};
return (null);
}
static function InitWave(){
var _local1:GameObj;
isBossLevel = false;
waveTime = (waveTimeMax = WaveDefs.GetWaveTime(currentWave));
if (WaveDefs.IsBossWave(currentWave)){
_local1 = GameObjects.AddObj(320, 100, 100);
_local1.InitOverlay(0);
};
WaveDefs.ResetTimers(currentWave);
}
public static function UpdatePortals():void{
}
public static function BossKilled():void{
InitLevelState(levelState_BonusTime);
}
static function InitPlayerWeapons(){
}
public static function ShowSign(_arg1:int){
if (showingOverlay){
return;
};
showingOverlay = true;
showingOverlayID = _arg1;
}
public static function RemovePoly(_arg1:String){
var _local2:Poly;
_local2 = GetPolyByName(_arg1);
if (_local2){
_local2.active = false;
};
}
public static function RemoveGO(_arg1:String){
var _local2:GameObj;
_local2 = GetGOByName(_arg1);
if (_local2){
_local2.active = false;
};
}
public static function AddScore(_arg1:int):void{
currentScore = (currentScore + (_arg1 * multiplier));
Stats.levelScore = (Stats.levelScore + (_arg1 * multiplier));
}
public static function ReloadDataAndRestartLevel(){
ExternalData.InitOnce(ReloadDataAndRestartLevel1);
}
public static function ReloadDataAndRestartLevel1(){
InitLevel();
}
static function DestroyBackground(){
}
static function NextWave():void{
currentWave++;
if (currentWave > (WaveDefs.list.length - 1)){
currentWave = (WaveDefs.list.length - 1);
};
InitWave();
}
public static function InitLevelState(_arg1:int){
var _local2:Particle;
var _local3:GameObj;
levelState = _arg1;
levelStateTimer = 0;
if (levelState == levelState_LevelStart){
levelStateTimer = (Defs.fps * 2);
};
if (levelState == levelState_Play){
};
if (levelState == levelState_BonusTime){
};
if (levelState == levelState_EndSequence){
};
if (levelState == levelState_Dead){
};
}
public static function CountInstallations():int{
var _local1:int;
var _local2:GameObj;
_local1 = 0;
for each (_local2 in GameObjects.objs) {
if (((_local2.active) && (_local2.colFlag_isInstallation))){
_local1++;
};
};
return (_local1);
}
public static function GenerateEnemies():void{
}
public static function GetEnemyMissile():GameObj{
var _local1:GameObj;
for each (_local1 in GameObjects.objs) {
if ((((((_local1.active == true)) && (_local1.isEnemyMissile))) && ((((_local1.controlMode == 0)) || ((_local1.controlMode == 1)))))){
return (_local1);
};
};
return (null);
}
static function RenderEffect(){
var _local1:uint;
var _local2:uint;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Point;
var _local8:DisplacementMapFilter;
var _local9:Number;
var _local10:Rectangle;
if (KeyReader.Down(KeyReader.KEY_1)){
offsett--;
trace(offsett);
};
if (KeyReader.Down(KeyReader.KEY_2)){
offsett++;
trace(offsett);
};
InitEffect();
_local1 = (effectRad / 2);
_local2 = (_local1 * 2);
_local3 = (goPlayer.xpos - scrollX);
_local4 = (goPlayer.ypos - scrollY);
_local5 = (_local3 - _local1);
_local6 = (_local4 - _local1);
_local7 = new Point(_local5, _local6);
_local8 = new DisplacementMapFilter();
_local8.mapBitmap = map;
_local8.mapPoint = _local7;
_local8.componentX = BitmapDataChannel.RED;
_local8.componentY = BitmapDataChannel.BLUE;
_local8.scaleX = _local1;
_local8.scaleY = _local1;
_local8.mode = DisplacementMapFilterMode.IGNORE;
_local9 = offsett;
_local10 = new Rectangle((_local3 - _local1), (_local4 - _local1), _local2, _local2);
main.screenBD.applyFilter(main.screenBD, _local10, new Point((_local3 + _local9), (_local4 + _local9)), _local8);
}
static function InitEffect(){
var _local1:int;
var _local2:int;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:uint;
var _local16:uint;
var _local17:uint;
if (effectInited){
return;
};
effectInited = true;
map = new BitmapData(effectRad, effectRad, false, 0x7F7F7F);
_local3 = (map.width / 2);
_local4 = (map.height / 2);
map.lock();
_local1 = 0;
while (_local1 < map.width) {
_local2 = 0;
while (_local2 < map.height) {
_local5 = (map.width / 2);
_local6 = (_local3 - Number(_local1));
_local7 = (_local4 - Number(_local2));
_local8 = Number(_local1);
_local9 = Number(_local2);
_local10 = Utils.DistBetweenPoints(0, 0, _local6, _local7);
if (_local10 >= _local5){
map.setPixel(_local1, _local2, 0x7F7F7F);
} else {
_local11 = ((1 / _local5) * _local10);
if (_local11 > 1){
_local11 = 1;
};
if (_local11 < 0){
_local11 = 0;
};
_local11 = (_local11 * 64);
_local12 = Math.atan2(_local7, _local6);
_local13 = (Math.cos(_local12) * _local11);
_local14 = (Math.sin(_local12) * _local11);
_local13 = (_local13 + _local6);
_local14 = (_local14 + _local7);
_local13 = (_local13 + 127);
if (_local13 > 0xFF){
_local13 = 0xFF;
};
if (_local13 < 0){
_local13 = 0;
};
_local14 = (_local14 + 127);
if (_local14 > 0xFF){
_local14 = 0xFF;
};
if (_local14 < 0){
_local14 = 0;
};
_local15 = (uint(_local13) << 16);
_local16 = uint(_local14);
_local17 = (_local15 | _local16);
map.setPixel(_local1, _local2, _local17);
};
_local2++;
};
_local1++;
};
}
public static function GetRandomEdge(_arg1:Number):Point{
var _local2:Point;
_local2 = new Point();
if (Utils.RandBool()){
_local2.x = RandWorldX();
if (Utils.RandBool()){
_local2.y = (0 - _arg1);
} else {
_local2.y = (1000 + _arg1);
};
} else {
_local2.y = RandWorldY();
if (Utils.RandBool()){
_local2.x = (0 - _arg1);
} else {
_local2.x = (1000 + _arg1);
};
};
return (_local2);
}
public static function buttonOverlayClosedPressed(_arg1:MouseEvent){
Overlay_Remove();
InitLevelState(levelState_Play);
}
public static function CountEnemyMissiles():int{
var _local1:int;
var _local2:GameObj;
_local1 = 0;
for each (_local2 in GameObjects.objs) {
if ((((_local2.active == true)) && (_local2.isEnemyMissile))){
_local1++;
};
};
return (_local1);
}
static function UpdateScroll(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local1 = scrollX;
_local2 = scrollY;
_local3 = 0;
_local4 = goPlayer.xpos;
_local5 = goPlayer.ypos;
_local4 = (_local4 - 320);
_local5 = (_local5 - 240);
scrollX = (scrollX + ((_local4 - scrollX) * 0.4));
scrollY = (scrollY + ((_local5 - scrollY) * 0.4));
if (scrollX < 0){
scrollX = 0;
};
if (scrollY < 0){
scrollY = 0;
};
if (scrollX > scrollMaxX){
scrollX = scrollMaxX;
};
if (scrollY > scrollMaxY){
scrollY = scrollMaxY;
};
_local6 = (scrollX - _local1);
_local7 = (scrollY - _local2);
main.effectScreenBD.scroll(-(_local6), -(_local7));
}
public static function Init(_arg1:Main){
main = _arg1;
currentScore = 0;
multiplier = 1;
numLevels = 8;
currentLevel = 0;
}
static function Portal_SetAppearPos(_arg1:GameObj):Boolean{
_arg1.xpos = Utils.RandBetweenFloat((scrollX + 50), ((scrollX + Defs.displayarea_w) - 50));
_arg1.ypos = Utils.RandBetweenFloat((scrollY + 50), ((scrollY + Defs.displayarea_h) - 50));
if (Utils.Dist2BetweenPoints(_arg1.xpos, _arg1.ypos, goPlayer.xpos, goPlayer.ypos) < (100 * 100)){
return (false);
};
return (true);
}
public static function GetAnimDefByName(_arg1:String):AnimDef{
var _local2:AnimDef;
for each (_local2 in animDefs) {
if (_local2.name == _arg1){
return (_local2);
};
};
trace(("ERROR: AnimDef not found: " + _arg1));
return (animDefs[0]);
}
public static function InitGame(_arg1:Boolean=false){
Debug.debugMode = 0;
numLives = 3;
InitAnimDefs();
Achievements.InitOnce();
levelsCompleted = false;
polygonList = new Array();
startPoints = new Array();
startPointObjs = new Array();
currentStartPointIndex = 0;
LevelDef1.Init(main);
currentLevel = 0;
backgroundBD = new BitmapData(1000, 1000, false, 0);
Stats.InitOnce();
AnimPoints.InitOnce();
}
static function ScrollToPlayer(){
var _local1:int;
_local1 = 0;
while (_local1 < 100) {
UpdateScroll();
_local1++;
};
}
static function AddCash(_arg1:int){
multiplier = 1;
if (levelState == levelState_BonusTime){
multiplier = 2;
};
cash = (cash + (_arg1 * multiplier));
Stats.levelCash = (Stats.levelCash + (_arg1 * multiplier));
Stats.totalCash = (Stats.totalCash + (_arg1 * multiplier));
}
public static function InitDibsSpeech(_arg1:int){
}
public static function GetGOFrame(_arg1:String):int{
var _local2:GameObj;
_local2 = GetGOByName(_arg1);
if (_local2){
return (int(_local2.frame));
};
return (-1);
}
public static function CountActiveEnemies():int{
var _local1:int;
var _local2:GameObj;
_local1 = 0;
for each (_local2 in GameObjects.objs) {
if ((((_local2.active == true)) && (_local2.colFlag_isEnemy))){
_local1++;
};
};
return (_local1);
}
public static function Overlay_Remove(){
if (overlayMC != null){
main.removeChild(overlayMC);
overlayMC = null;
KeyReader.InitOnce(main.stage);
};
}
static function UpdateWave():void{
var _local1:GameObj;
var _local2:Array;
var _local3:WaveDef;
var _local4:int;
var _local5:int;
CountAll();
if (isBossLevel){
} else {
waveTime--;
if (waveTime < 0){
NextWave();
};
};
_local2 = WaveDefs.GetWaveDefs(currentWave);
for each (_local3 in _local2) {
_local3.timer--;
if (_local3.timer <= 0){
_local3.timer = 0;
_local4 = _local3.enemyType;
_local5 = _local3.max;
if (enemyCountList[_local4] < _local5){
_local3.timer = Utils.RandBetweenInt(_local3.freq, (_local3.freq + (_local3.freq / 4)));
if (_local4 == WaveDefs.et_cannon1){
_local1 = GameObjects.AddObj(0, 0, 1000);
_local1.InitEnemy_CannonBullet1();
};
if (_local4 == WaveDefs.et_cannon2){
_local1 = GameObjects.AddObj(0, 0, 1000);
_local1.InitEnemy_CannonBullet2();
};
if (_local4 == WaveDefs.et_bouncingbomb){
_local1 = GameObjects.AddObj(0, 0, 1000);
_local1.InitEnemy_BouncingBomb();
};
if (_local4 == WaveDefs.et_landmine){
_local1 = GameObjects.AddObj(0, 0, 1000);
_local1.InitEnemy_LandMine();
};
if (_local4 == WaveDefs.et_jetpackred){
_local1 = GameObjects.AddObj(0, 0, 1000);
_local1.InitEnemy_JetpackRobotRed();
};
if (_local4 == WaveDefs.et_jetpackblue){
_local1 = GameObjects.AddObj(0, 0, 1000);
_local1.InitEnemy_JetpackRobotBlue();
};
if (_local4 == WaveDefs.et_copter){
_local1 = GameObjects.AddObj(0, 0, 1000);
_local1.InitEnemy_Copter();
};
if ((((_local4 == WaveDefs.et_boss)) && ((enemyCountList[WaveDefs.et_boss] == 0)))){
trace(enemyCountList[WaveDefs.et_boss]);
_local1 = GameObjects.AddObj(0, 0, 1000);
_local1.InitEnemy_BossHelicopter(_local3.difficulty);
};
};
};
};
if (Utils.RandBetweenInt(0, 1000) < 5){
_local1 = GameObjects.AddObj(0, 0, 9300);
_local1.InitEnemy_ShadowCopter();
};
}
public static function InitGenerateEnemies():void{
var _local1:int;
genTimer = 0;
}
public static function RandWorldX():Number{
return (Utils.RandBetweenFloat(0, 1000));
}
public static function RandWorldY():Number{
return (Utils.RandBetweenFloat(0, 1000));
}
static function RenderBackground(){
var _local1:Number;
var _local2:Number;
_local1 = goBackground.xpos;
_local2 = goBackground.ypos;
main.backScreenBD.copyPixels(backgroundBD, new Rectangle(0, 0, 1000, 1000), new Point(_local1, _local2), null, null, true);
}
static function Render(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Matrix;
var _local10:Bitmap;
if (pause == true){
return;
};
GameObjects.Render();
Particles.Render(main);
if (shake > shakeMin){
shake = (shake + shakeDecVel);
};
if (shake < shakeMin){
shake = shakeMin;
};
_local1 = Utils.RandBetweenFloat(-3, 3);
_local2 = Utils.RandBetweenFloat(-3, 3);
_local3 = (shake * 0.1);
_local4 = (1 + (shake * 0.2));
_local5 = Utils.RandBetweenFloat(-(_local3), _local3);
_local6 = Utils.RandBetweenFloat(1, _local4);
_local7 = (Defs.displayarea_w * 0.5);
_local8 = (Defs.displayarea_h * 0.5);
_local9 = new Matrix();
_local9.translate(-(_local7), -(_local8));
_local9.scale(_local6, _local6);
_local9.rotate(_local5);
_local9.translate(_local7, _local8);
_local9.translate(_local1, _local2);
if (doScale){
main.backScreenBD.draw(main.screenBD, _local9);
} else {
main.backScreenBD.copyPixels(main.screenBD, Defs.screenRect, Defs.pointZero);
};
if (doOverlay){
_local10 = GraphicObjects.GetBitmap(GraphicObjects.gfx_bg_overlay, 0);
main.backScreenBD.draw(_local10.bitmapData, null, null, "multiply");
};
RenderPanel(main.backScreenBD);
}
public static function GetGOByName(_arg1:String):GameObj{
var _local2:GameObj;
for each (_local2 in GameObjects.objs) {
if (((_local2.active) && ((_local2.name == _arg1)))){
return (_local2);
};
};
return (null);
}
static function InitUpdateEnemies():void{
updateEnemyTimer = 20;
}
public static function Overlay_Show(_arg1:int){
}
static function RenderPanel(_arg1:BitmapData){
var _local2:String;
var _local3:int;
_local2 = ("Score:" + currentScore);
GraphicObjects.RenderStringAt(_arg1, GraphicObjects.gfx_font1, 400, 10, _local2);
_local3 = goPlayer.health;
_local3 = Utils.LimitInt(0, 99, _local3);
_local3 = (99 - _local3);
GraphicObjects.RenderAt(GraphicObjects.gfx_health_meter, _local3, _arg1, 10, 4);
_local3 = (gunTemperature * 100);
_local3 = Utils.LimitInt(0, 99, _local3);
_local3 = (99 - _local3);
GraphicObjects.RenderAt(GraphicObjects.gfx_overheat_meter, _local3, _arg1, 200, 10);
}
public static function ExitDibsSpeech(){
}
}
}//package
Section 35
//GameObj (GameObj)
package {
import flash.events.*;
import flash.geom.*;
public class GameObj {
public var colFlag_isInstallation:Boolean;
public var xvel:Number;
var path:Poly;
public var todir:Number;
var canBekilledByMissile:Boolean;
public var speed:Number;
public var colFlag_isEnemy:Boolean;
var objectDef:ObjectDef;
var startx:Number;
public var ypos2:Number;
var startz:Number;
var bobAdder:Number;
var hasShadow:Boolean;
public var colFlag_playercanbekilled:Boolean;
var starty:Number;
var doneAction:Boolean;
var frame1:Number;
public var movementVec:Vec;
var currentPathNode:int;
var squareBullet_offCentre:int;
public var visible:Boolean;
var enemyGenMode:int;
public var yvel:Number;
var numBounces:int;
var bgWidth:Number;
public var dir:Number;
var acc:Number;
public var radius:Number;
var particleColor:uint;
public var colFlag_isBullet:Boolean;
public var controlMode:int;
var oscillator:Number;
var isPlayer:Boolean;
var isDead:Boolean;
var EnemyHitByBulletFunctionCallback:Function;
var EnemyUpdateFunctionCallback:Function;
public var shadowRenderFunction:Function;
var pressedExtraWeapon:Boolean;// = false
var objectIndex:int;
public var xpos2:Number;
var bobDistance:Number;
public var zvel:Number;
var xflip:Boolean;
var maxBounces:int;
public var accel:Number;
var currentPoly:Poly;
var currentWeaponSlotID:int;
public var colFlag_killPlayer:Boolean;
var boss3_PathIndex:int;
var currentWeapon:int;
var shotControllers:Array;
public var xacc:Number;
public var count:int;
var minSpeed:Number;
var movementState:String;
var height:Number;
public var colFlag_isPlatform:Boolean;
public var colFlag_isEnemyBullet:Boolean;
var flashTimer:int;
var rotVelMax:Number;
public var colFlag_jumpon:Boolean;
var maxSpeed:Number;
public var dir1:Number;
var scale:Number;
var fireOffsetDir:Number;
var alpha:Number;
public var colFlag_UseRadius:Boolean;
public var yacc:Number;
var beingTracked:Boolean;
var frame:Number;
var healthBarTimer:int;
var shootingFlag:Boolean;
var portal_genFreqency:int;
public var controlIndex:int;
var pressedFire:Boolean;// = false
public var subtype:int;
public var oldxpos:Number;
var doublePressedRight:Boolean;// = false
var timer1:Number;
var portal_mode:int;
public var toPosX:Number;
public var toPosY:Number;
var dist:Number;
public var driveVec:Vec;
var prevToPosX:Number;
var prevToPosY:Number;
var main:Main;
var pressedFire1:Boolean;// = false
public var colFlag_isShop:Boolean;
var bobInitialHeight:Number;
var inFrontZone:Poly;
var portal_genType:String;
public var oldypos:Number;
var currentMaxSpeed:Number;
var pressedCycle:Boolean;// = false
var instantBullet_TrackedObject:GameObj;
var graphicID:int;
var fire_mode:int;
var collisionPoly:Poly;
var instantBullet_numObjects:int;
var pressedCyclePrev:Boolean;// = false
var minFrame:int;
var fire_radOffset:Number;
var isEnemyCopter:Boolean;
var rotVel:Number;
var yoffset:Number;
var fire_numBulletsFired:int;
var health:Number;
var pressedUp:Boolean;// = false
public var colFlag_canBeShot:Boolean;
public var colFlag_isPowerup:Boolean;
var fire_maxDelay:int;
var maxFrame:int;
var bulletPlayerWeapon:PlayerWeapon;
public var name:String;
public var toSpeed:Number;
var graphicID1:int;
var bobTimer:Number;
public var colFlag_canBePickedUp:Boolean;
public var colFlag_isCheckpoint:Boolean;
public var origspeed:Number;
var hitEnemyFunction:Function;
var actionTimer:int;
var doublePressedLeft:Boolean;// = false
var boss3_numPaths:int;
var isEnemyMissile:Boolean;
var particleType:int;
var enemyType:int;
public var xpos:Number;
var isBlueJetpack:Boolean;
public var frameVel:Number;
var bossDifficulty:int;
var xoffset:Number;
public var active:Boolean;
var weaponGroups:Array;
var pressedRight:Boolean;// = false
var tempVec:Vec;
var pathSpeed:Number;
var isRedJetpack:Boolean;
var toOffsetX:Number;
var toOffsetY:Number;
public var type:int;
public var ypos:Number;
var instantAngles:Array;
var timer:Number;
var colorTransform:ColorTransform;
var pressedLeft:Boolean;// = false
var fire_maxBullets:int;
var pressedJump:Boolean;// = false
var numWeapons:int;
public var hitTimer:Number;
var flashFlag:Boolean;
var toHeight:Number;
public var renderFunction:Function;
var instantPositions:Array;
public var zpos:Number;
public var colFlag_isBouncyPad:Boolean;
var heightVar1:Number;
var tailPieces:Array;
var isBoss:Boolean;
var portal_genAmount:int;
var playerWeapons:Array;
var heightVar0:Number;
public var updateFunction:Function;
public var externalVec:Vec;
public var bulletTestCollisionExtraFunction:Function;
public var zpos2:Number;
var usesBulletTime:Boolean;
var timerMax:Number;
var pressedDown:Boolean;// = false
var dodgeBullets:Boolean;
var fire_groupDelay:int;
var flashTimerMax:int;
var parentObj:GameObj;
var actionList:Array;
var fire_timer:int;
var pathPos:Number;
public function GameObj(_arg1, _arg2, _arg3, _arg4:int){
doublePressedLeft = false;
doublePressedRight = false;
pressedLeft = false;
pressedRight = false;
pressedUp = false;
pressedDown = false;
pressedJump = false;
pressedFire = false;
pressedFire1 = false;
pressedCycle = false;
pressedCyclePrev = false;
pressedExtraWeapon = false;
super();
xpos = _arg2;
ypos = _arg3;
zpos = 1;
starty = _arg2;
startx = _arg2;
active = false;
main = _arg1;
zpos = 0;
graphicID = 0;
frame = 0;
frameVel = 0;
controlIndex = 0;
timer = 0;
timer1 = 0;
radius = 14;
minFrame = 0;
maxFrame = 0;
movementVec = new Vec();
externalVec = new Vec();
objectIndex = _arg4;
colorTransform = new ColorTransform();
tempVec = new Vec();
}
function UpdateInstantBullet():void{
xpos = parentObj.xpos;
ypos = parentObj.ypos;
MakeCollisionPoly();
Collision.EnemyPointInPolyCollision(collisionPoly, this);
if (PlayAnimation()){
active = false;
};
}
function RenderCollisionPoly():void{
var _local1:Number;
var _local2:Number;
var _local3:Line;
if ((Debug.debugMode & 4) == 0){
return;
};
if (collisionPoly == null){
return;
};
_local1 = Math.floor(Game.scrollX);
_local2 = Math.floor(Game.scrollY);
for each (_local3 in collisionPoly.lineList) {
Utils.RenderDotLine(main.screenBD, (_local3.x0 - _local1), (_local3.y0 - _local2), (_local3.x1 - _local1), (_local3.y1 - _local2), 100, 4294967295);
};
}
public function UpdateBob(){
var _local1:Number;
bobTimer = (bobTimer + bobAdder);
_local1 = (Math.sin(bobTimer) * bobDistance);
height = (bobInitialHeight + _local1);
}
public function UpdateEnemy_Helicopter(){
var _local1:Number;
var _local2:Poly;
var _local3:Point;
timer1 = (timer1 + xvel);
timer = (timer + yvel);
_local1 = Math.sin(timer);
_local1 = (_local1 + Math.sin(timer1));
_local1 = Utils.NormalizeUnit(_local1);
_local2 = currentPoly;
if (_local2 == null){
return;
};
_local3 = _local2.GetPointOnCatmullRom(_local1);
toPosX = (Game.goPlayer.xpos + _local3.x);
toPosY = (Game.goPlayer.ypos + _local3.y);
xpos = (xpos + ((toPosX - xpos) * 0.005));
ypos = (ypos + ((toPosY - ypos) * 0.005));
dir = Math.atan2((Game.goPlayer.ypos - ypos), (Game.goPlayer.xpos - xpos));
dir1 = (dir1 + 0.4);
}
public function InitEnemy_AccelStraight(){
EnemyUpdateFunctionCallback = UpdateEnemy_AccelStraight;
controlMode = 0;
UpdateEnemy_TurnAndMoveToPoint_GetPosNearPlayer();
SetToRequiredRot();
if (enemyGenMode == 0){
toPosX = Game.goPlayer.xpos;
toPosY = Game.goPlayer.ypos;
SetToRequiredRot();
} else {
movementVec.rot = Utils.RandCircle();
};
movementVec.speed = Utils.RandBetweenFloat(objectDef.NumParamA, objectDef.NumParamB);
accel = Utils.RandBetweenFloat(objectDef.NumParamC, objectDef.NumParamD);
}
function UpdateEnemy_TurnAndMoveToPoint_GetPosNearPlayer(){
var _local1:Point;
_local1 = Utils.RandPointInCircle(50);
toPosX = (Game.goPlayer.xpos + _local1.x);
toPosY = (Game.goPlayer.ypos + _local1.y);
}
function UpdateEnemy(){
var _local1:ShotController;
if (EnemyUpdateFunctionCallback != null){
EnemyUpdateFunctionCallback();
};
if (shootingFlag){
for each (_local1 in shotControllers) {
if (_local1.active){
_local1.Update(this);
};
};
};
UpdateActions();
if (IsInWorld(200) == false){
active = false;
};
if (flashTimer > 0){
flashTimer--;
};
if (healthBarTimer > 0){
healthBarTimer--;
};
}
public function InitEnemy_RandomlyFlyRoundMap(){
EnemyUpdateFunctionCallback = UpdateEnemy_RandomlyFlyRoundMap;
rotVel = Utils.RandBetweenFloat(objectDef.NumParamA, objectDef.NumParamB);
toSpeed = Utils.RandBetweenFloat(objectDef.NumParamC, objectDef.NumParamD);
speed = 0;
InitEnemyRot_TakeFromPortalDef();
InitBob();
}
function InitPlayer():void{
isPlayer = true;
objectDef = ObjectDefs.GetObjectDefByExportName("Player");
health = objectDef.maxHealth;
updateFunction = UpdatePlayer;
frame = 0;
graphicID = GraphicObjects.gfx_playerrun;
particleColor = 4294967295;
particleType = 0;
xvel = 0;
yvel = 0;
frameVel = 1;
xpos = 320;
ypos = Game.floorYpos;
}
function RenderPlayer(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local1 = Math.floor(Game.scrollX);
_local2 = Math.floor(Game.scrollY);
_local3 = (Math.floor(xpos) - _local1);
_local4 = (Math.floor(ypos) - _local2);
if (Game.particleMode != 1){
GraphicObjects.RenderAtColTrans(graphicID, frame, main.screenBD, _local3, (_local4 - (height * 0.1)), false, colorTransform);
};
}
public function InitEnemy(_arg1:String, _arg2:int=0){
var _local3:ShotController;
var _local4:ShotController;
enemyGenMode = _arg2;
usesBulletTime = true;
height = Game.normalHeight;
hasShadow = true;
shotControllers = new Array();
updateFunction = UpdateEnemy;
renderFunction = RenderEnemy;
colFlag_killPlayer = true;
colFlag_canBeShot = true;
colFlag_isEnemy = true;
objectDef = ObjectDefs.GetObjectDefByExportName(_arg1);
graphicID = objectDef.GetAnimIDFromName("idle");
health = objectDef.maxHealth;
radius = 100;
actionTimer = 0;
actionList = new Array();
shootingFlag = true;
for each (_local3 in objectDef.shotControllers) {
_local4 = _local3.clone();
_local4.Reset();
shotControllers.push(_local4);
};
if (objectDef.initFuncName != ""){
var _local5 = this;
_local5[objectDef.initFuncName]();
};
dodgeBullets = objectDef.dodgeFlag;
}
function UpdateExplosion(){
if (PlayAnimation()){
active = false;
};
}
function BulletCollision_SnakeTail(_arg1:GameObj):Boolean{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:int;
var _local6:TailPiece;
var _local7:int;
_local2 = _arg1.xpos;
_local3 = _arg1.ypos;
_local4 = (16 * 16);
_local5 = tailPieces.length;
_local7 = 0;
while (_local7 < _local5) {
_local6 = tailPieces[_local7];
if (Utils.Dist2BetweenPoints(_local6.xpos, _local6.ypos, _local2, _local3) < _local4){
_arg1.health--;
if (_arg1.health <= 0){
_arg1.active = false;
return (true);
};
return (false);
};
_local7++;
};
return (false);
}
function UpdateBullet_Vortex():void{
var _local1:*;
var _local2:GameObj;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
toPosX = Game.mouseMapX;
toPosY = Game.mouseMapY;
movementVec.Set(Math.atan2((toPosY - ypos), (toPosX - xpos)), bulletPlayerWeapon.GetSpeed());
if (controlMode == 0){
xvel = movementVec.GetXComponent();
yvel = movementVec.GetYComponent();
xpos = (xpos + xvel);
ypos = (ypos + yvel);
if (Utils.Dist2BetweenPoints(xpos, ypos, toPosX, toPosY) < (10 * 10)){
xpos = toPosX;
ypos = toPosY;
};
};
_local1 = 300;
for each (_local2 in GameObjects.objs) {
if (((((_local2.active) && (_local2.colFlag_isEnemy))) && (!(_local2.colFlag_isInstallation)))){
_local3 = (xpos + ((Math.cos((Number((timer + _local2.objectIndex)) * 0.2)) * 20) + (_local2.objectIndex & 31)));
_local4 = (ypos + ((Math.sin((Number((timer + _local2.objectIndex)) * 0.2)) * 20) + (_local2.objectIndex & 31)));
_local5 = Utils.DistBetweenPoints(_local3, _local4, _local2.xpos, _local2.ypos);
if (_local5 < _local1){
_local5 = (_local1 - _local5);
_local5 = (_local5 * 0.02);
_local6 = Math.atan2((_local4 - _local2.ypos), (_local3 - _local2.xpos));
_local2.xpos = (_local2.xpos + (Math.cos(_local6) * _local5));
_local2.ypos = (_local2.ypos + (Math.sin(_local6) * _local5));
};
};
};
timer--;
if (timer < 0){
active = false;
};
CycleAnimation();
}
function RenderInstantBullet_Spline():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Poly;
var _local5:Point;
_local1 = Math.floor(Game.scrollX);
_local2 = Math.floor(Game.scrollY);
_local4 = currentPoly;
if (_local4 == null){
return;
};
_local3 = 0;
while (_local3 < 1) {
_local5 = _local4.GetPointOnCatmullRom(_local3);
GraphicObjects.RenderAt(graphicID, frame, main.screenBD, (_local5.x - _local1), (_local5.y - _local2));
_local3 = (_local3 + 0.05);
};
}
function InitBattleCopter():void{
objectDef = ObjectDefs.GetObjectDefByExportName("Player");
updateFunction = UpdateBattleCopter;
renderFunction = RenderBattleCopter;
graphicID = GraphicObjects.gfx_battlecopter;
frame = 0;
frameVel = 1;
graphicID1 = GraphicObjects.gfx_cannonnotfiring;
frame1 = 0;
dir1 = 0;
xpos = (startx = -200);
ypos = (starty = 200);
timer = 0;
timer1 = 0;
controlMode = 0;
}
function InitShop():void{
objectDef = ObjectDefs.GetObjectDefByExportName("Shop");
graphicID = objectDef.GetAnimIDFromName("idle");
updateFunction = UpdateShop;
graphicID;
colFlag_isShop = true;
yvel = 2;
xvel = 0;
}
function InitEnemyRot_TakeFromPortalDef(){
if (enemyGenMode == 0){
toPosX = Game.goPlayer.xpos;
toPosY = Game.goPlayer.ypos;
SetToRequiredRot();
} else {
movementVec.rot = Utils.RandCircle();
};
}
function GetBattleCopterBulletStartPoint():Point{
var _local1:Point;
_local1 = new Point(Game.goBattleCopter.xpos, Game.goBattleCopter.ypos);
return (_local1);
}
function UpdateEnemy_Copter():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:GameObj;
startx--;
if (startx < 550){
startx = 550;
};
xpos = (startx + (Math.cos((timer * 0.09)) * 50));
ypos = (starty + (Math.sin((timer * 0.07)) * 90));
CycleAnimation();
timer++;
dir1 = (dir1 + 0.02);
if (ypos > 250){
if (Game.CountEnemyMissiles() == 0){
_local5 = GameObjects.AddObj(xpos, (ypos + 50), 1010);
_local5.InitEnemy_Missile();
};
};
if (controlMode == 0){
graphicID1 = GraphicObjects.gfx_cannonnotfiring;
timer1 = 3;
} else {
if (controlMode == 1){
graphicID1 = GraphicObjects.gfx_cannonfiring;
timer1--;
if (timer1 <= 0){
controlMode = 0;
};
};
};
_local1 = xpos;
_local2 = ypos;
_local3 = (Game.goPlayer.xpos - _local1);
_local4 = (Game.goPlayer.ypos - _local2);
dir1 = Math.atan2(_local4, _local3);
dir1 = (dir1 - (Math.PI * 0.5));
UpdateFireAtPlayer();
UpdateEnemyStuff();
}
function InitWeaponGroups(){
}
public function InitMoon(){
graphicID = GraphicObjects.gfx_bg_moon;
frame = 0;
updateFunction = UpdateMoon;
timer = 0;
}
function UpdateEnemy_Path(){
var _local1:Boolean;
_local1 = Path_GetToPos();
if (_local1){
pathPos = 0;
};
pathPos = (pathPos + pathSpeed);
xpos = toPosX;
ypos = toPosY;
}
public function EnemyShotByMissile(_arg1:GameObj):void{
EnemyKilled();
_arg1.active = false;
if (isBoss){
Game.NextWave();
};
}
public function EnemyHitByBullet(_arg1:GameObj, _arg2:Boolean=false){
}
function RenderBlockCollision():void{
var _local1:Rectangle;
var _local2:Rectangle;
if (objectDef == null){
return;
};
if (objectDef.colRects.length == 0){
return;
};
for each (_local2 in objectDef.colRects) {
_local1 = _local2.clone();
_local1.x = (_local1.x + xpos);
_local1.y = (_local1.y + ypos);
_local1.x = (_local1.x - Game.scrollX);
_local1.y = (_local1.y - Game.scrollY);
main.screenBD.fillRect(_local1, 1082163328);
if (isEnemyMissile){
};
};
for each (_local2 in objectDef.shieldColRects) {
_local1 = _local2.clone();
_local1.x = (_local1.x + xpos);
_local1.y = (_local1.y + ypos);
_local1.x = (_local1.x - Game.scrollX);
_local1.y = (_local1.y - Game.scrollY);
main.screenBD.fillRect(_local1, 1082163200);
};
}
function UpdateBullet_BulletTime():void{
Game.bulletTime = 100;
timer--;
if (timer < 0){
timer = 0;
Game.bulletTime = 0;
active = false;
};
}
function UpdateBullet_Shockwave():void{
var _local1:*;
var _local2:GameObj;
var _local3:Number;
xpos = (xpos + xvel);
ypos = (ypos + yvel);
if (Utils.Dist2BetweenPoints(xpos, ypos, toPosX, toPosY) < (32 * 32)){
_local1 = 0;
while (_local1 < 16) {
_local2 = GameObjects.AddObj(0, 0, (zpos - 10));
_local3 = (((Math.PI * 2) / 16) * _local1);
_local2.InitBullet_ShockwaveBit(this, _local3);
_local1++;
};
active = false;
};
if (IsInWorld(32) == false){
active = false;
};
CycleAnimation();
}
function RenderNormally(){
var _local1:Number;
var _local2:Number;
_local1 = Math.floor(xpos);
_local2 = Math.floor(ypos);
if ((((flashTimer > 0)) && ((flashTimer & 2)))){
GraphicObjects.RenderAtColTrans(graphicID, frame, main.screenBD, _local1, _local2, xflip, new ColorTransform(1, 1, 1, 1, 0xFF, 0xFF, 0xFF, 0));
} else {
if (scale != 1){
GraphicObjects.RenderAtRotScaled(graphicID, frame, main.screenBD, _local1, _local2, xflip, scale, 0);
} else {
GraphicObjects.RenderAt(graphicID, frame, main.screenBD, _local1, _local2, xflip);
};
};
RenderHealthBar();
}
public function InitEnemy_FollowPlayer2(){
var _local1:Point;
EnemyUpdateFunctionCallback = UpdateEnemy_RotateToPlayer2;
rotVel = Utils.RandBetweenFloat(objectDef.NumParamA, objectDef.NumParamB);
speed = Utils.RandBetweenFloat(objectDef.NumParamC, objectDef.NumParamD);
_local1 = Utils.RandPointInCircle(objectDef.NumParamG);
toOffsetX = _local1.x;
toOffsetY = _local1.y;
toPosX = (Game.goPlayer.xpos + toOffsetX);
toPosY = (Game.goPlayer.ypos + toOffsetY);
timer = (Utils.RandBetweenFloat(objectDef.NumParamE, objectDef.NumParamF) * Defs.fps2);
SetToRequiredRot();
InitBob();
}
function RenderPreRotated(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:int;
_local1 = Math.floor(Game.scrollX);
_local2 = Math.floor(Game.scrollY);
_local3 = (Math.floor(xpos) - _local1);
_local4 = (Math.floor(ypos) - _local2);
_local5 = GraphicObjects.GetNumFrames(graphicID);
_local6 = dir;
_local6 = (_local6 - (Math.PI / 2));
while (_local6 < 0) {
_local6 = (_local6 + (Math.PI * 2));
};
while (_local6 > (Math.PI * 2)) {
_local6 = (_local6 - (Math.PI * 2));
};
_local7 = ((_local5 / (Math.PI * 2)) * _local6);
GraphicObjects.RenderAt(graphicID, _local7, main.screenBD, _local3, (_local4 - (height * 0.1)), false);
}
function InitCursor():void{
objectDef = ObjectDefs.GetObjectDefByExportName("Player");
updateFunction = UpdateCursor;
graphicID = GraphicObjects.gfx_cursor;
frame = 0;
}
public function InitEnemy_Tank(){
var _local1:Point;
EnemyUpdateFunctionCallback = UpdateEnemy_Tank;
movementVec.Set(Utils.RandCircle(), speed);
frame1 = (frame1 + 0.02);
graphicID1 = objectDef.GetAnimIDFromName("turret");
renderFunction = RenderEnemy_Tank;
height = 0;
rotVel = Utils.RandBetweenFloat(objectDef.NumParamA, objectDef.NumParamB);
speed = Utils.RandBetweenFloat(objectDef.NumParamC, objectDef.NumParamD);
_local1 = Game.GetRandomEdge(32);
xpos = _local1.x;
ypos = _local1.y;
toOffsetX = Utils.RandBetweenFloat(-100, 100);
toOffsetY = Utils.RandBetweenFloat(-100, 100);
toPosX = Game.goPlayer.xpos;
toPosY = Game.goPlayer.ypos;
SetToRequiredRot();
}
public function UpdateEnemy_SplineRoundPlayer_Stepper(){
var _local1:Poly;
var _local2:Point;
timer = (timer + rotVel);
if (timer >= 1){
timer = 0;
};
_local1 = currentPoly;
if (_local1 == null){
return;
};
_local2 = _local1.GetPointOnCatmullRom(timer);
toPosX = (Game.goPlayer.xpos + _local2.x);
toPosY = (Game.goPlayer.ypos + _local2.y);
xpos2 = (xpos2 + ((toPosX - xpos) * 0.005));
ypos2 = (ypos2 + ((toPosY - ypos) * 0.005));
timer1--;
if (timer1 <= 0){
timer1 = 10;
xpos = xpos2;
ypos = ypos2;
dir = Math.atan2((Game.goPlayer.ypos - ypos), (Game.goPlayer.xpos - xpos));
};
}
function IsInWorld(_arg1:Number):Boolean{
if (xpos < (0 - _arg1)){
return (false);
};
if (ypos < (0 - _arg1)){
return (false);
};
if (xpos > (640 + _arg1)){
return (false);
};
if (ypos > (470 + _arg1)){
return (false);
};
return (true);
}
function UpdateBullet_DuckOfDeath():void{
var _local1:Number;
var _local2:Number;
var _local3:GameObj;
var _local4:Number;
_local1 = Game.mouseMapX;
_local2 = Game.mouseMapY;
_local3 = Collision.GetNearestEnemy(_local1, _local2);
if (_local3 != null){
toPosX = _local3.xpos;
toPosY = _local3.ypos;
} else {
active = false;
};
_local4 = 0.3;
xpos = (xpos + ((toPosX - xpos) * _local4));
ypos = (ypos + ((toPosY - ypos) * _local4));
DuckOfDeath_AddTailPiece();
timer--;
if (timer < 0){
active = false;
};
}
function PlayerFire(){
var _local1:int;
if (Game.gunOverheated){
PlayerDontFire();
} else {
if (Game.gunShootDelay > 0){
Game.gunShootDelay--;
};
if (Game.gunShootDelay == 0){
Game.goBattleCopter.controlMode = 1;
Game.gunShootDelay = Game.gunShootDelayPerShot;
Collision.ShootEnemyAtCursor();
Game.gunTemperature = (Game.gunTemperature + Game.gunShootAdder);
if (Game.gunTemperature >= 1){
Game.gunTemperature = 1;
Game.gunOverheated = true;
};
_local1 = SoundPlayer.sfx_shot1;
SoundPlayer.Play(_local1);
};
};
}
function UpdateFireAtPlayer(){
if (fire_mode == 0){
fire_timer--;
if (fire_timer <= 0){
fire_mode = 1;
fire_timer = fire_groupDelay;
};
};
if (fire_mode == 1){
fire_timer--;
if (fire_timer <= 0){
FireAtPlayer();
fire_numBulletsFired++;
if (fire_numBulletsFired >= fire_maxBullets){
fire_timer = fire_maxDelay;
fire_mode = 0;
fire_numBulletsFired = 0;
} else {
fire_timer = fire_groupDelay;
};
};
};
}
function UpdateEnemy_Missile():void{
if (controlMode == 0){
xflip = false;
xvel = (xvel + xacc);
if (xvel > 7){
xvel = 7;
};
xpos = (xpos + xvel);
if (xpos > (640 + 100)){
active = false;
};
} else {
if (controlMode == 1){
xflip = false;
timer--;
if (Game.goPlayer.isDead){
timer = 100;
};
if (timer < 0){
Game.goPlayer.controlMode = 3;
Game.goPlayer.frame = 0;
Game.goPlayer.graphicID = GraphicObjects.gfx_playerfall;
controlMode = 2;
xvel = 1;
xacc = 1;
};
} else {
if (controlMode == 2){
xvel = (xvel + xacc);
if (xvel > 20){
xvel = 20;
};
xpos = (xpos + xvel);
if (xpos > (640 + 200)){
active = false;
};
} else {
if (controlMode == 3){
};
};
};
};
CycleAnimation();
}
public function Update():void{
oldxpos = xpos;
oldypos = ypos;
if (updateFunction != null){
updateFunction();
};
zpos2 = (zpos - height);
if (flashTimer > 0){
flashTimer--;
};
}
function RenderInstantBullet_FixedTarget():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:int;
var _local10:int;
_local1 = Math.floor(Game.scrollX);
_local2 = Math.floor(Game.scrollY);
_local3 = (Math.floor(xpos) - _local1);
_local4 = (Math.floor(ypos) - _local2);
_local5 = 64;
_local6 = Utils.DistBetweenPoints(xpos, ypos, toPosX, toPosY);
_local7 = (_local6 / _local5);
_local7++;
_local8 = (movementVec.rot + (Math.PI * 0.5));
_local9 = int(_local7);
_local10 = 0;
while (_local10 < _local9) {
GraphicObjects.RenderAtRotScaled(graphicID, frame, main.screenBD, _local3, _local4, false, 1, _local8);
_local3 = (_local3 + (movementVec.GetUnitXComponent() * _local5));
_local4 = (_local4 + (movementVec.GetUnitYComponent() * _local5));
_local10++;
};
}
public function Action_Shoot(_arg1:Number){
if (_arg1 == 0){
shootingFlag = false;
};
if (_arg1 == 1){
shootingFlag = true;
};
}
function InitOverlay(_arg1:int){
updateFunction = UpdateOverlay;
graphicID = (GraphicObjects.gfx_overlay_warning + _arg1);
frame = 0;
frameVel = 1;
}
function InitTailPieces(_arg1:int, _arg2:int){
var _local3:int;
var _local4:TailPiece;
tailPieces = new Array();
_local3 = 0;
while (_local3 < _arg1) {
_local4 = new TailPiece();
_local4.xpos = (xpos + (_local3 * 10));
_local4.ypos = ypos;
_local4.dir = dir;
_local4.frame = 0;
_local4.graphicID = _arg2;
tailPieces.push(_local4);
_local3++;
};
}
public function UpdateEnemy_Snake(){
var _local1:Number;
var _local2:Vec;
movementVec.speed = speed;
toPosX = Game.goPlayer.xpos;
toPosY = Game.goPlayer.ypos;
RotateToRequiredRot(rotVel);
dir = movementVec.rot;
oscillator = (oscillator + objectDef.NumParamG);
_local1 = (Math.sin(oscillator) * objectDef.NumParamH);
_local2 = new Vec();
_local2.FromVec(movementVec);
_local2.AddRot(_local1);
dir = _local2.rot;
xpos = (xpos + _local2.GetXComponent());
ypos = (ypos + _local2.GetYComponent());
UpdateExternalVel();
UpdateTailPieces();
}
public function RenderEnemy_SnakeShadow(){
RenderShadowPreRotated();
RenderTailPiecesShadow();
}
public function InitEnemy_SplineRoundPlayer(){
var _local1:Array;
var _local2:Number;
var _local3:Number;
var _local4:int;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Point;
EnemyUpdateFunctionCallback = UpdateEnemy_SplineRoundPlayer;
rotVel = 0.025;
controlMode = 0;
_local1 = new Array();
_local2 = 50;
_local3 = 0;
while (_local3 < (Math.PI * 2)) {
_local5 = Utils.RandBetweenFloat(objectDef.NumParamA, objectDef.NumParamB);
_local6 = (Math.cos(_local3) * _local5);
_local7 = (Math.sin(_local3) * _local5);
_local6 = (_local6 + Utils.RandBetweenFloat(-(_local2), _local2));
_local7 = (_local7 + Utils.RandBetweenFloat(-(_local2), _local2));
_local8 = new Point(_local6, _local7);
_local1.push(_local8);
_local3 = (_local3 + 0.6);
};
_local4 = 0;
currentPoly = new Poly("", 0, _local1[_local4].x, _local1[_local4].y);
_local4 = 1;
while (_local4 < _local1.length) {
currentPoly.AddLine(_local1[_local4].x, _local1[_local4].y, _local1[_local4].x, _local1[_local4].y);
_local4++;
};
currentPoly.Finish(false);
timer = Utils.RandBetweenFloat(0, 1);
rotVel = Utils.RandBetweenFloat(objectDef.NumParamC, objectDef.NumParamD);
}
function UpdateEnemy_LandMine():void{
xpos = (xpos - Game.scrollSpeed);
if (xpos < -50){
active = false;
};
CycleAnimation();
UpdateEnemyStuff();
}
public function UpdateEnemy_BallsFromEdges(){
dir = 0;
if (height == 0){
if (Utils.RandBetweenInt(0, 1000) < 50){
zvel = 7;
height = 0.1;
};
} else {
zvel = (zvel + -0.1);
height = (height + zvel);
if (height <= 0){
height = 0;
};
};
xpos = (xpos + movementVec.GetXComponent());
ypos = (ypos + movementVec.GetYComponent());
UpdateExternalVel();
if (IsInWorld(64) == false){
active = false;
};
CycleAnimation();
}
function UpdateInstantBullet_FixedTarget():void{
var _local1:GameObj;
xpos = parentObj.xpos;
ypos = parentObj.ypos;
_local1 = instantBullet_TrackedObject;
if ((((_local1.active == false)) || ((_local1.beingTracked == false)))){
active = false;
instantBullet_TrackedObject = null;
return;
};
toPosX = _local1.xpos;
toPosY = _local1.ypos;
movementVec.Set(Math.atan2((toPosY - ypos), (toPosX - xpos)), 1);
if (PlayAnimation()){
_local1.EnemyHitByBullet(this, true);
active = false;
};
}
public function InitEnemy_LandMine():void{
enemyType = WaveDefs.et_landmine;
objectDef = ObjectDefs.GetObjectDefByExportName("LandMine");
health = objectDef.maxHealth;
radius = 30;
colFlag_isEnemy = true;
graphicID = GraphicObjects.gfx_enemy_landmine;
frame = 0;
frameVel = 1;
updateFunction = UpdateEnemy_LandMine;
yvel = 0;
xvel = 0;
ypos = Game.floorYpos;
xpos = (640 + 30);
}
function RenderEnemy_ShadowCopter():void{
var _local1:Number;
var _local2:Number;
_local1 = Math.floor(xpos);
_local2 = Math.floor(ypos);
GraphicObjects.RenderAtAlpha(graphicID, frame, main.screenBD, _local1, _local2, 0.3);
}
function UpdateGravity(){
yvel = (yvel + Game.gravity);
if (yvel > 6){
yvel = Game.maxFallSpeed;
};
ypos = (ypos + yvel);
}
function UpdateEnemyStuff(){
if (flashTimer > 0){
flashTimer--;
};
if (healthBarTimer > 0){
healthBarTimer--;
};
}
public function Init(_arg1:int):void{
var _local2:int;
var _local3:Number;
_local2 = 0;
_local3 = 0;
type = _arg1;
controlMode = _local2;
xvel = _local3;
yvel = _local3;
frame = _local3;
frameVel = _local3;
timer = _local3;
hitTimer = _local3;
flashTimer = _local2;
flashFlag = false;
dir = 0;
todir = 0;
health = 1;
zvel = 0;
name = "";
scale = 1;
objectDef = null;
xflip = false;
updateFunction = null;
renderFunction = null;
shadowRenderFunction = null;
visible = true;
ClearColFlags();
isBoss = false;
hasShadow = false;
beingTracked = false;
instantBullet_TrackedObject = null;
isPlayer = false;
height = 0;
usesBulletTime = false;
collisionPoly = null;
hitEnemyFunction = null;
healthBarTimer = 0;
fireOffsetDir = 0;
dodgeBullets = false;
isDead = false;
bulletTestCollisionExtraFunction = null;
isRedJetpack = false;
isBlueJetpack = false;
isEnemyCopter = false;
isEnemyMissile = false;
canBekilledByMissile = false;
}
function UpdatePlayer():void{
var _local1:Particle;
var _local2:Number;
var _local3:GameObj;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Boolean;
var _local9:int;
oldxpos = xpos;
oldypos = ypos;
doublePressedLeft = false;
doublePressedRight = false;
pressedLeft = false;
pressedRight = false;
pressedUp = false;
pressedDown = false;
pressedJump = false;
pressedFire = false;
pressedFire1 = false;
pressedCycle = false;
pressedCyclePrev = false;
pressedExtraWeapon = false;
if (KeyReader.Pressed(KeyReader.KEY_LEFT)){
doublePressedLeft = true;
};
if (KeyReader.Pressed(KeyReader.KEY_RIGHT)){
doublePressedRight = true;
};
if (KeyReader.Down(KeyReader.KEY_LEFT)){
pressedLeft = true;
};
if (KeyReader.Down(KeyReader.KEY_RIGHT)){
pressedRight = true;
};
if (KeyReader.Down(KeyReader.KEY_UP)){
pressedJump = true;
};
if (KeyReader.Down(KeyReader.KEY_UP)){
pressedUp = true;
};
if (KeyReader.Down(KeyReader.KEY_DOWN)){
pressedDown = true;
};
if (KeyReader.Down(KeyReader.KEY_A)){
pressedLeft = true;
};
if (KeyReader.Down(KeyReader.KEY_D)){
pressedRight = true;
};
if (KeyReader.Down(KeyReader.KEY_W)){
pressedUp = true;
};
if (KeyReader.Down(KeyReader.KEY_W)){
pressedJump = true;
};
if (KeyReader.Down(KeyReader.KEY_S)){
pressedDown = true;
};
if (MouseControl.buttonPressed){
PlayerFire();
} else {
PlayerDontFire();
};
_local2 = 5;
if (controlMode == -1){
if (PlayAnimation()){
TitleScreenState.InitGameOver();
Game.pause = true;
};
} else {
if (controlMode == 0){
if (pressedLeft){
xpos = (xpos - _local2);
};
if (pressedRight){
xpos = (xpos + _local2);
};
xpos = Utils.LimitNumber(10, (640 - 10), xpos);
CycleAnimation();
if (pressedJump){
controlMode = 1;
graphicID = GraphicObjects.gfx_playerjump;
frame = 0;
frameVel = 1;
yvel = -12;
};
PlayerTrail();
} else {
if (controlMode == 1){
if (pressedLeft){
xpos = (xpos - _local2);
};
if (pressedRight){
xpos = (xpos + _local2);
};
xpos = Utils.LimitNumber(10, (640 - 10), xpos);
yvel = (yvel + Game.gravity);
if (yvel >= Game.maxFallSpeed){
yvel = Game.maxFallSpeed;
};
ypos = (ypos + yvel);
CycleAnimation();
if (yvel > -2){
controlMode = 2;
frame = 0;
graphicID = GraphicObjects.gfx_playerflip;
};
} else {
if (controlMode == 2){
if (pressedLeft){
xpos = (xpos - _local2);
};
if (pressedRight){
xpos = (xpos + _local2);
};
xpos = Utils.LimitNumber(10, (640 - 10), xpos);
yvel = (yvel + Game.gravity);
if (yvel >= Game.maxFallSpeed){
yvel = Game.maxFallSpeed;
};
ypos = (ypos + yvel);
if (PlayAnimation()){
controlMode = 3;
frame = 0;
graphicID = GraphicObjects.gfx_playerfall;
};
} else {
if (controlMode == 3){
_local2 = 0;
if (pressedLeft){
_local2 = -5;
};
if (pressedRight){
_local2 = 5;
};
xpos = (xpos + _local2);
xpos = Utils.LimitNumber(10, (640 - 10), xpos);
yvel = (yvel + Game.gravity);
if (yvel >= Game.maxFallSpeed){
yvel = Game.maxFallSpeed;
};
ypos = (ypos + yvel);
CycleAnimation();
if (ypos > Game.floorYpos){
ypos = Game.floorYpos;
controlMode = 4;
frame = 0;
graphicID = GraphicObjects.gfx_playerslide;
frameVel = 1;
xvel = _local2;
timer = (Defs.fps * 1);
};
if (TestLandingOnMissile()){
frame = 0;
graphicID = GraphicObjects.gfx_playerslide;
controlMode = 5;
movementVec.Set(0, 0);
_local3 = Game.GetEnemyMissile();
_local3.controlMode = 1;
_local3.timer = (Defs.fps * 3);
};
} else {
if (controlMode == 4){
_local2 = 0;
if (pressedLeft){
_local2 = -5;
};
if (pressedRight){
_local2 = 5;
};
xpos = (xpos + _local2);
xpos = Utils.LimitNumber(10, (640 - 10), xpos);
CycleAnimation();
timer--;
if (timer <= 0){
xvel = 0;
controlMode = 0;
frame = 0;
graphicID = GraphicObjects.gfx_playerrun;
frameVel = 1;
};
PlayerTrail();
} else {
if (controlMode == 5){
_local3 = Game.GetEnemyMissile();
if (_local3 == null){
controlMode = 3;
frame = 0;
graphicID = GraphicObjects.gfx_playerfall;
};
tempVec.Set(0, 0);
_local4 = 2;
_local5 = 7;
_local6 = 2;
_local7 = ((Math.PI * 2) / 8);
_local8 = false;
_local9 = -1;
if (pressedRight){
_local9 = 0;
if (pressedUp){
_local9 = 7;
};
if (pressedDown){
_local9 = 1;
};
} else {
if (pressedLeft){
_local9 = 4;
if (pressedUp){
_local9 = 5;
};
if (pressedDown){
_local9 = 3;
};
} else {
if (pressedUp){
_local9 = 6;
} else {
if (pressedDown){
_local9 = 2;
};
};
};
};
if (_local9 != -1){
tempVec.Set((_local7 * _local9), _local4);
movementVec.Add(tempVec);
if (movementVec.speed > _local5){
movementVec.speed = _local5;
};
} else {
movementVec.speed = (movementVec.speed - _local6);
if (movementVec.speed < 0){
movementVec.speed = 0;
};
};
xpos = (xpos + movementVec.GetXComponent());
ypos = (ypos + movementVec.GetYComponent());
if (xpos < 30){
xpos = 30;
};
if (ypos < 30){
ypos = 30;
};
if (xpos > (640 - 30)){
xpos = (640 - 30);
};
if (ypos > (480 - 30)){
ypos = (480 - 30);
};
_local3.xpos = xpos;
_local3.ypos = ypos;
CycleAnimation();
};
};
};
};
};
};
};
}
function UpdateInstantBullet_Streaky():void{
var _local1:GameObj;
var _local2:int;
xpos = parentObj.xpos;
ypos = parentObj.ypos;
dir = parentObj.dir;
movementVec.Set(((parentObj.dir + bulletPlayerWeapon.GetFireAngle()) - (Math.PI * 0.5)), bulletPlayerWeapon.GetSpeed());
_local1 = instantBullet_TrackedObject;
if ((((_local1.active == false)) || ((_local1.beingTracked == false)))){
active = false;
instantBullet_TrackedObject = null;
};
instantBullet_numObjects = 0;
_local2 = 0;
do {
toPosX = _local1.xpos;
toPosY = _local1.ypos;
RotateToRequiredRot(0.1);
dir = movementVec.rot;
xpos = (xpos + movementVec.GetXComponent());
ypos = (ypos + movementVec.GetYComponent());
instantPositions[_local2] = new Point(xpos, ypos);
instantAngles[_local2] = dir;
_local2++;
instantBullet_numObjects++;
if (Utils.Dist2BetweenPoints(xpos, ypos, _local1.xpos, _local1.ypos) < (30 * 30)){
_local2 = 9999;
};
} while (_local2 < 100);
timer--;
if (timer <= 0){
active = false;
};
}
public function InitEnemy_FollowPlayer_AdjustRotvelByDist(){
EnemyUpdateFunctionCallback = FollowPlayer_AdjustRotvelByDist;
rotVel = Utils.RandBetweenFloat(objectDef.NumParamA, objectDef.NumParamB);
rotVelMax = Utils.RandBetweenFloat(objectDef.NumParamE, objectDef.NumParamF);
speed = Utils.RandBetweenFloat(objectDef.NumParamC, objectDef.NumParamD);
InitEnemyRot_TakeFromPortalDef();
InitBob();
}
public function UpdateEnemy_Tank(){
var _local1:GameObj;
movementVec.speed = speed;
toPosX = (Game.goPlayer.xpos + toOffsetX);
toPosY = (Game.goPlayer.ypos + toOffsetY);
RotateToRequiredRot(rotVel);
dir = movementVec.rot;
xpos = (xpos + movementVec.GetXComponent());
ypos = (ypos + movementVec.GetYComponent());
UpdateExternalVel();
_local1 = Game.goPlayer;
dir1 = Math.atan2((_local1.ypos - ypos), (_local1.xpos - xpos));
fireOffsetDir = (dir1 - (Math.PI * 0.5));
}
public function FollowPlayer_AdjustRotvelByDist(){
var _local1:GameObj;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local1 = Game.goPlayer;
movementVec.speed = speed;
toPosX = _local1.xpos;
toPosY = _local1.ypos;
_local2 = rotVel;
_local3 = rotVelMax;
_local4 = objectDef.NumParamG;
_local5 = objectDef.NumParamH;
_local6 = Utils.DistBetweenPoints(xpos, ypos, toPosX, toPosY);
_local6 = Utils.LimitNumber(_local4, _local5, _local6);
_local7 = Utils.ScaleTo(_local2, _local3, _local4, _local5, _local6);
RotateToRequiredRot(_local7);
dir = movementVec.rot;
xpos = (xpos + movementVec.GetXComponent());
ypos = (ypos + movementVec.GetYComponent());
UpdateExternalVel();
UpdateBob();
}
public function UpdateEnemy_SplineRoundPlayer(){
var _local1:Poly;
var _local2:Point;
timer = (timer + rotVel);
if (timer >= 1){
timer = 0;
};
_local1 = currentPoly;
if (_local1 == null){
return;
};
_local2 = _local1.GetPointOnCatmullRom(timer);
toPosX = (Game.goPlayer.xpos + _local2.x);
toPosY = (Game.goPlayer.ypos + _local2.y);
xpos = (xpos + ((toPosX - xpos) * 0.005));
ypos = (ypos + ((toPosY - ypos) * 0.005));
dir = Math.atan2((Game.goPlayer.ypos - ypos), (Game.goPlayer.xpos - xpos));
}
function RenderShadowNormally(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:int;
_local1 = Math.floor(Game.scrollX);
_local2 = Math.floor(Game.scrollY);
_local3 = (Math.floor(xpos) - _local1);
_local4 = (Math.floor(ypos) - _local2);
_local5 = GraphicObjects.idList[graphicID];
GraphicObjects.graphicobjs[_local5].frames[int(frame)].RenderAtShadow(Game.main.screenBD, _local3, (_local4 + 3), false);
}
function SetStartEdgePosFrom8Way(_arg1:int){
var _local2:Array;
var _local3:int;
var _local4:int;
var _local5:Number;
var _local6:Number;
_local2 = new Array();
if (_arg1 == 0){
_local2.push(0);
};
if (_arg1 == 1){
_local2.push(0);
_local2.push(1);
};
if (_arg1 == 2){
_local2.push(1);
};
if (_arg1 == 3){
_local2.push(1);
_local2.push(2);
};
if (_arg1 == 4){
_local2.push(2);
};
if (_arg1 == 5){
_local2.push(2);
_local2.push(3);
};
if (_arg1 == 6){
_local2.push(3);
};
if (_arg1 == 7){
_local2.push(3);
_local2.push(0);
};
_local3 = Utils.RandBetweenInt(0, (_local2.length - 1));
_local4 = _local2[_local3];
_local5 = Utils.RandBetweenFloat(0, 1000);
_local6 = 32;
if (_local4 == 0){
xpos = _local5;
ypos = -(_local6);
};
if (_local4 == 1){
xpos = -(_local6);
ypos = _local5;
};
if (_local4 == 2){
xpos = _local5;
ypos = (1000 + _local6);
};
if (_local4 == 3){
xpos = (1000 + _local6);
ypos = _local5;
};
}
public function CycleAnimation():void{
var _local1:Number;
var _local2:int;
_local1 = frameVel;
_local2 = GraphicObjects.GetNumFrames(graphicID);
frame = (frame + _local1);
if (frame >= _local2){
frame = (frame - _local2);
};
if (frame < 0){
frame = (frame + _local2);
};
}
function RenderShadowPreRotated(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:int;
var _local8:int;
_local1 = Math.floor(Game.scrollX);
_local2 = Math.floor(Game.scrollY);
_local3 = (Math.floor(xpos) - _local1);
_local4 = (Math.floor(ypos) - _local2);
_local5 = GraphicObjects.GetNumFrames(graphicID);
_local6 = dir;
_local6 = (Math.PI - _local6);
if (isPlayer){
_local6 = (_local6 + (Math.PI * 0.5));
};
_local6 = (_local6 - (Math.PI / 2));
while (_local6 < 0) {
_local6 = (_local6 + (Math.PI * 2));
};
while (_local6 > (Math.PI * 2)) {
_local6 = (_local6 - (Math.PI * 2));
};
_local7 = ((_local5 / (Math.PI * 2)) * _local6);
_local8 = GraphicObjects.idList[graphicID];
GraphicObjects.graphicobjs[_local8].frames[_local7].RenderAtShadow(Game.main.screenBD, _local3, (_local4 + 3), false);
}
function FireAtPlayer():void{
var _local1:GameObj;
_local1 = GameObjects.AddObj(xpos, ypos, 700);
_local1.InitEnemyBullet(fire_radOffset);
}
function SetAnim(_arg1:int){
var _local2:int;
graphicID = _arg1;
_local2 = (GraphicObjects.GetNumFrames(graphicID) - 1);
if (frame >= _local2){
frame = 0;
};
}
public function UpdateEnemy_FollowPlayer_FlyLike(){
var _local1:Number;
timer--;
if (timer <= 0){
UpdateEnemy_FollowPlayer_FlyLike_GetNewToPos();
};
_local1 = 0.1;
xpos = (xpos + ((toPosX - xpos) * _local1));
ypos = (ypos + ((toPosY - ypos) * _local1));
height = (height + ((toHeight - height) * 0.1));
dir = movementVec.rot;
UpdateExternalVel();
}
function UpdateTailPieces():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
var _local4:TailPiece;
var _local5:int;
var _local6:Number;
var _local7:Number;
_local1 = xpos;
_local2 = ypos;
_local3 = tailPieces.length;
_local5 = 0;
while (_local5 < _local3) {
_local4 = tailPieces[_local5];
_local6 = Math.atan2((_local2 - _local4.ypos), (_local1 - _local4.xpos));
_local7 = 20;
_local4.xpos = (_local1 - (Math.cos(_local6) * _local7));
_local4.ypos = (_local2 - (Math.sin(_local6) * _local7));
_local6 = Math.atan2((_local2 - _local4.ypos), (_local1 - _local4.xpos));
_local4.dir = _local6;
_local1 = _local4.xpos;
_local2 = _local4.ypos;
_local5++;
};
}
function UpdateHomingBullet():void{
var _local1:Number;
var _local2:Number;
var _local3:GameObj;
_local1 = Game.mouseMapX;
_local2 = Game.mouseMapY;
_local3 = Collision.GetNearestEnemy(_local1, _local2);
if (_local3 != null){
if (timer1 <= 0){
toPosX = _local3.xpos;
toPosY = _local3.ypos;
RotateToRequiredRot(0.1);
} else {
timer1--;
};
};
dir = (movementVec.rot + (Math.PI * 0.5));
xpos = (xpos + movementVec.GetXComponent());
ypos = (ypos + movementVec.GetYComponent());
if (IsInWorld(64) == false){
active = false;
};
timer--;
if (timer <= 0){
active = false;
};
}
function BossCopter_InitMode(_arg1:int){
controlMode = _arg1;
if (controlMode == 0){
canBekilledByMissile = false;
InitFireAtPlayer(999999, 0, 0, 0);
zpos = 3000;
xpos = (640 + 100);
ypos = 150;
scale = 0.25;
xvel = -20;
xflip = true;
} else {
if (controlMode == 1){
canBekilledByMissile = false;
timer = 40;
} else {
if (controlMode == 2){
canBekilledByMissile = true;
scale = 1;
xpos = -100;
ypos = 100;
xflip = false;
xvel = 10;
} else {
if (controlMode == 3){
canBekilledByMissile = true;
InitBossFireAtPlayer();
count = 10;
timer = 0;
} else {
if (controlMode == 4){
canBekilledByMissile = true;
InitFireAtPlayer(999999, 0, 0, 0);
xvel = -20;
} else {
if (controlMode == 5){
canBekilledByMissile = false;
scale = 0.25;
xvel = 20;
ypos = 100;
xpos = -100;
} else {
if (controlMode == 6){
canBekilledByMissile = true;
scale = 1;
xpos = (640 + 200);
ypos = 200;
xflip = true;
xvel = -10;
} else {
if (controlMode == 7){
canBekilledByMissile = true;
InitBossFireAtPlayer();
timer = 400;
timer1 = 0;
} else {
if (controlMode == 8){
canBekilledByMissile = true;
InitFireAtPlayer(999999, 0, 0, 0);
xvel = 20;
};
};
};
};
};
};
};
};
};
}
function UpdateBullet_BFG():void{
PlayAnimation();
xpos = (xpos + xvel);
ypos = (ypos + yvel);
if (IsInWorld(32) == false){
active = false;
};
}
function DuckOfDeath_AddTailPiece():void{
var _local1:Particle;
_local1 = Particles.Add(xpos, ypos);
_local1.InitDuckTrail();
}
function UpdateEnemy_ShadowCopter():void{
xpos = (xpos + xvel);
ypos = (starty + (Math.sin((timer * xacc)) * yacc));
timer++;
if (xpos > (640 + 50)){
active = false;
};
CycleAnimation();
}
function UpdateCursor():void{
xpos = MouseControl.mousePosX;
ypos = MouseControl.mousePosY;
CycleAnimation();
}
public function GetObjectDef():ObjectDef{
return (objectDef);
}
function RenderEnemy_Copter(){
var _local1:Number;
var _local2:Number;
RenderNormally();
_local1 = Math.floor(xpos);
_local2 = Math.floor(ypos);
GraphicObjects.RenderAtRotScaled(graphicID1, frame1, main.screenBD, _local1, _local2, false, 1, dir1);
}
function UpdateEnemy_FollowPlayer_FlyLike_GetNewToPos(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = Math.atan2((Game.goPlayer.ypos - ypos), (Game.goPlayer.xpos - xpos));
_local2 = Utils.RandBetweenFloat(objectDef.NumParamA, objectDef.NumParamB);
if (Utils.RandBool()){
_local2 = -(_local2);
};
_local1 = (_local1 + _local2);
_local3 = Utils.RandBetweenFloat(objectDef.NumParamC, objectDef.NumParamD);
movementVec.Set(_local1, _local3);
toPosX = (xpos + movementVec.GetXComponent());
toPosY = (ypos + movementVec.GetYComponent());
timer = (Utils.RandBetweenFloat(objectDef.NumParamE, objectDef.NumParamF) * Defs.fps2);
toHeight = Utils.RandBetweenFloat(20, 170);
}
public function Render():void{
if (visible == false){
return;
};
if (renderFunction != null){
renderFunction();
} else {
RenderNormally();
};
}
public function RenderEnemy_Tank(){
var _local1:Number;
RenderEnemy();
_local1 = dir1;
dir1 = (Math.PI - dir1);
RenderPreRotated1();
dir1 = _local1;
}
public function InitPortal(_arg1:int){
subtype = _arg1;
usesBulletTime = false;
height = 0;
hasShadow = false;
shotControllers = new Array();
updateFunction = UpdatePortal;
renderFunction = RenderNormally;
if (subtype == 0){
objectDef = ObjectDefs.GetObjectDefByExportName("Portal");
colFlag_isEnemy = true;
colFlag_isInstallation = true;
health = objectDef.maxHealth;
};
if (subtype == 1){
objectDef = ObjectDefs.GetObjectDefByExportName("Portal1");
visible = false;
hasShadow = false;
};
graphicID = objectDef.GetAnimIDFromName("idle");
timer = Game.portalDef.GetRandomTime();
controlMode = 0;
frame = 0;
frameVel = 1;
}
public function UpdateInstallation(){
if (healthBarTimer > 0){
healthBarTimer--;
};
}
function UpdateEnemy_BouncingBomb():void{
var _local1:GameObj;
xpos = (xpos + xvel);
yvel = (yvel + Game.gravity);
if (yvel > Game.maxFallSpeed){
yvel = Game.maxFallSpeed;
};
ypos = (ypos + yvel);
if (ypos > Game.floorYpos){
ypos = Game.floorYpos;
numBounces++;
if (numBounces >= maxBounces){
_local1 = GameObjects.AddObj(xpos, ypos, 100);
_local1.InitExplosion(0);
active = false;
} else {
if (numBounces == 1){
yvel = -15;
};
if (numBounces == 2){
yvel = -14;
};
if (numBounces == 3){
yvel = -13;
};
if (numBounces == 4){
yvel = -12;
};
};
};
CycleAnimation();
UpdateEnemyStuff();
}
function UpdateBullet_Ricochet():void{
xvel = movementVec.GetXComponent();
yvel = movementVec.GetYComponent();
xpos = (xpos + xvel);
ypos = (ypos + yvel);
dir = (dir + rotVel);
dir = Utils.NormalizeRot(dir);
timer--;
if (timer < 0){
active = false;
};
}
function UpdateBullet_Reverse():void{
xpos = (xpos + movementVec.GetXComponent());
ypos = (ypos + movementVec.GetYComponent());
if (Utils.Dist2BetweenPoints(xpos, ypos, toPosX, toPosY) < (30 * 30)){
active = false;
};
}
public function UpdateEnemy_FollowPlayerVels(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = speed;
_local2 = -(acc);
if (xpos < Game.goPlayer.xpos){
_local2 = acc;
};
xvel = (xvel + _local2);
if (xvel >= _local1){
xvel = _local1;
};
if (xvel <= -(_local1)){
xvel = -(_local1);
};
_local3 = -(acc);
if (ypos < Game.goPlayer.ypos){
_local3 = acc;
};
yvel = (yvel + _local3);
if (yvel >= _local1){
yvel = _local1;
};
if (yvel <= -(_local1)){
yvel = -(_local1);
};
xpos = (xpos + xvel);
ypos = (ypos + yvel);
dir = (dir + 0.1);
dir = Utils.NormalizeRot(dir);
heightVar0 = (heightVar0 + heightVar1);
height = (Game.normalHeight + (Math.sin(heightVar0) * 30));
}
public function InitEnemy_TurnAndMoveToPoint(){
var _local1:Point;
EnemyUpdateFunctionCallback = UpdateEnemy_TurnAndMoveToPoint;
rotVel = Utils.RandBetweenFloat(objectDef.NumParamA, objectDef.NumParamB);
accel = 0.1;
maxSpeed = Utils.RandBetweenFloat(objectDef.NumParamC, objectDef.NumParamD);
minSpeed = 1;
controlMode = 0;
UpdateEnemy_TurnAndMoveToPoint_GetPosNearPlayer();
if (enemyGenMode == 0){
UpdateEnemy_TurnAndMoveToPoint_GetPosNearPlayer();
SetToRequiredRot();
} else {
movementVec.rot = Utils.RandCircle();
_local1 = Utils.RandPointInCircle(200);
toPosX = (xpos + _local1.x);
toPosY = (ypos + _local1.y);
};
controlMode = 1;
speed = 0;
InitBob();
}
function TimerIncrement(_arg1:Number):Boolean{
timer++;
if (timer > _arg1){
return (true);
};
return (false);
}
public function PlayerHitEnemy(_arg1:GameObj){
health = (health - 20);
if (health <= 0){
graphicID = GraphicObjects.gfx_playerdie;
frame = 0;
controlMode = -1;
isDead = true;
} else {
flashTimer = (flashTimerMax = (Defs.fps * 2));
};
_arg1.health--;
if (_arg1.health <= 0){
_arg1.EnemyKilled();
};
}
function UpdateBullet_Boomerang():void{
var _local1:Vec;
xvel = movementVec.GetXComponent();
yvel = movementVec.GetYComponent();
xpos = (xpos + xvel);
ypos = (ypos + yvel);
timer--;
if (timer < 0){
toPosX = Game.goPlayer.xpos;
toPosY = Game.goPlayer.ypos;
_local1 = new Vec();
_local1.Set(Math.atan2((toPosY - ypos), (toPosX - xpos)), 0.1);
movementVec.Add(_local1);
if (movementVec.speed > 10){
movementVec.speed = 10;
};
timer = 0;
};
timer1--;
if (timer1 < 0){
active = false;
};
if (IsInWorld(100) == false){
active = false;
};
dir = (dir + 0.05);
}
public function InitEnemy_JetpackRobotRed():void{
enemyType = WaveDefs.et_jetpackred;
objectDef = ObjectDefs.GetObjectDefByExportName("JetPackRed");
health = objectDef.maxHealth;
radius = 50;
isRedJetpack = true;
colFlag_isEnemy = true;
graphicID = GraphicObjects.gfx_enemy_jetpackrobotred;
frame = 0;
frameVel = 1;
updateFunction = UpdateEnemy_JetpackRobotRed;
yvel = 0;
xvel = 0;
xpos = -50;
ypos = Utils.RandBetweenFloat(100, 300);
toPosX = Utils.RandBetweenFloat(450, 550);
toPosY = Utils.RandBetweenFloat(100, 300);
timer = 100;
xacc = 0;
yacc = 0;
speed = 5;
acc = 0.3;
InitFireAtPlayer(3, 1, 0.1, 10);
}
public function GetVelFromDir(_arg1:Number){
xvel = (Math.cos(dir) * _arg1);
yvel = (Math.sin(dir) * _arg1);
}
function UpdateEnemyBullet():void{
xpos = (xpos + xvel);
ypos = (ypos + yvel);
if (ypos > Game.floorYpos){
active = false;
};
CycleAnimation();
timer++;
if (timer > 3){
timer = 0;
};
if (IsInWorld(50) == false){
active = false;
};
}
function EnemyKilled(){
var _local1:GameObj;
Game.AddScore(objectDef.score);
_local1 = GameObjects.AddObj(xpos, ypos, 100);
_local1.InitExplosion(0);
active = false;
}
function RenderTailPieces():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
var _local4:TailPiece;
var _local5:int;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:int;
_local1 = Math.floor(Game.scrollX);
_local2 = Math.floor(Game.scrollY);
_local3 = tailPieces.length;
_local5 = 0;
while (_local5 < _local3) {
_local4 = tailPieces[_local5];
_local6 = (Math.floor(_local4.xpos) - _local1);
_local7 = (Math.floor(_local4.ypos) - _local2);
_local8 = GraphicObjects.GetNumFrames(_local4.graphicID);
_local9 = _local4.dir;
_local9 = (_local9 + (Math.PI / 2));
_local9 = (Math.PI - _local9);
while (_local9 < 0) {
_local9 = (_local9 + (Math.PI * 2));
};
while (_local9 > (Math.PI * 2)) {
_local9 = (_local9 - (Math.PI * 2));
};
_local10 = ((_local8 / (Math.PI * 2)) * _local9);
GraphicObjects.RenderAt(_local4.graphicID, _local10, main.screenBD, _local6, (_local7 - (height * 0.1)), false);
_local5++;
};
}
public function UpdatePortal_Type1(){
}
function UpdateEnemy_JetpackRobotBlue():void{
xpos = (xpos + ((toPosX - xpos) * 0.1));
ypos = (ypos + ((toPosY - ypos) * 0.1));
timer--;
if (timer < 0){
timer = Utils.RandBetweenInt(20, 30);
toPosX = Utils.RandBetweenFloat(100, 540);
toPosY = Utils.RandBetweenFloat(100, 300);
};
UpdateFireAtPlayer();
CycleAnimation();
UpdateEnemyStuff();
}
public function RenderEnemy_Snake(){
var _local1:Number;
_local1 = dir;
dir = (Math.PI - dir);
RenderPreRotated();
dir = _local1;
RenderTailPieces();
}
public function UpdatePortal_Type0(){
}
public function InitEnemy_ShadowCopter():void{
graphicID = GraphicObjects.gfx_enemy_shadowcopter;
frame = 0;
frameVel = 1;
updateFunction = UpdateEnemy_ShadowCopter;
renderFunction = RenderEnemy_ShadowCopter;
yvel = 0;
xvel = Utils.RandBetweenFloat(4, 6);
ypos = Utils.RandBetweenFloat(100, 200);
xpos = -50;
starty = ypos;
timer = Utils.RandBetweenFloat(0, 1000);
yacc = Utils.RandBetweenFloat(10, 30);
xacc = Utils.RandBetweenFloat(0.05, 0.1);
}
public function InitEnemy_BossHelicopter(_arg1:int):void{
bossDifficulty = _arg1;
if (bossDifficulty > 4){
bossDifficulty = 4;
};
isBoss = true;
canBekilledByMissile = true;
Game.isBossLevel = true;
enemyType = WaveDefs.et_boss;
objectDef = ObjectDefs.GetObjectDefByExportName("Boss");
health = objectDef.maxHealth;
radius = 20;
colFlag_isEnemy = true;
graphicID = GraphicObjects.gfx_enemy_bosscopter;
frame = 0;
frameVel = 1;
updateFunction = UpdateEnemy_BossHelicopter;
yvel = 0;
xvel = 0;
ypos = -30;
xpos = Utils.RandBetweenFloat(0, 640);
BossCopter_InitMode(0);
}
public function InitEnemy_Copter():void{
canBekilledByMissile = true;
enemyType = WaveDefs.et_copter;
objectDef = ObjectDefs.GetObjectDefByExportName("Copter");
health = objectDef.maxHealth;
radius = 120;
isEnemyCopter = true;
colFlag_isEnemy = true;
graphicID = GraphicObjects.gfx_enemy_copter;
frame = 0;
frameVel = 1;
updateFunction = UpdateEnemy_Copter;
renderFunction = RenderEnemy_Copter;
yvel = 0;
xvel = 0;
xpos = -50;
ypos = Utils.RandBetweenFloat(100, 300);
toPosX = Utils.RandBetweenFloat(450, 550);
toPosY = Utils.RandBetweenFloat(100, 300);
timer = 50;
xacc = 0;
yacc = 0;
speed = 5;
acc = 0.3;
InitFireAtPlayer(1, 4, 0.05, 40);
dir1 = 0;
xpos = (startx = (640 + 100));
ypos = (starty = 200);
timer = 0;
timer1 = 0;
controlMode = 0;
}
public function EnemyHitByPlayer(_arg1:GameObj){
}
public function GetOffsetObjectRectangle():Rectangle{
var _local1:ObjectDef;
var _local2:Rectangle;
_local1 = GetObjectDef();
_local2 = _local1.colRects[0].clone();
_local2.x = (_local2.x + xpos);
_local2.y = (_local2.y + ypos);
return (_local2);
}
public function EnemyHitByBulletShielded(_arg1:GameObj){
var _local2:int;
var _local3:Particle;
_arg1.active = false;
_local2 = 0;
while (_local2 < 3) {
_local3 = Particles.Add(_arg1.xpos, _arg1.ypos);
_local3.InitEnemyHitShield();
_local2++;
};
}
public function InitEnemy_BouncingBomb():void{
enemyType = WaveDefs.et_bouncingbomb;
objectDef = ObjectDefs.GetObjectDefByExportName("BouncingBomb");
health = objectDef.maxHealth;
radius = 20;
colFlag_isEnemy = true;
graphicID = GraphicObjects.gfx_enemy_bouncingbomb;
frame = 0;
frameVel = 1;
updateFunction = UpdateEnemy_BouncingBomb;
yvel = 0;
xvel = -(Utils.RandBetweenFloat(2, 4));
ypos = Utils.RandBetweenFloat(-30, -50);
xpos = (640 + 40);
numBounces = 0;
maxBounces = 4;
}
function RenderBullet(){
var _local1:Number;
_local1 = dir;
dir = (Math.PI - dir);
dir = (dir - (Math.PI * 0.5));
RenderPreRotated();
dir = _local1;
}
public function InitEnemy_Snake(){
var _local1:int;
bulletTestCollisionExtraFunction = BulletCollision_SnakeTail;
EnemyUpdateFunctionCallback = UpdateEnemy_Snake;
rotVel = Utils.RandBetweenFloat(objectDef.NumParamA, objectDef.NumParamB);
speed = Utils.RandBetweenFloat(objectDef.NumParamC, objectDef.NumParamD);
toPosX = Game.goPlayer.xpos;
toPosY = Game.goPlayer.ypos;
SetToRequiredRot();
_local1 = Utils.RandBetweenInt(objectDef.NumParamE, objectDef.NumParamF);
InitTailPieces(_local1, objectDef.GetAnimIDFromName("tail"));
renderFunction = RenderEnemy_Snake;
shadowRenderFunction = RenderEnemy_SnakeShadow;
oscillator = 0;
}
function UpdateShipAppearTube(){
}
function InitShipAppearTube(){
}
public function InitBob(){
bobTimer = 0;
bobAdder = Utils.RandBetweenFloat(0.02, 0.05);
bobDistance = Utils.RandBetweenFloat(20, 40);
bobInitialHeight = height;
}
public function InitEnemy_Helicopter(){
InitEnemy_SplineRoundPlayer();
renderFunction = RenderEnemy_Helicopter;
EnemyUpdateFunctionCallback = UpdateEnemy_Helicopter;
dir1 = 0;
frame1 = 0;
graphicID1 = objectDef.GetAnimIDFromName("turret");
timer = Utils.RandCircle();
timer1 = Utils.RandCircle();
xvel = Utils.RandBetweenFloat(0.0005, 0.002);
yvel = Utils.RandBetweenFloat(0.0005, 0.002);
}
function RenderWallCollision():void{
var _local1:int;
var _local2:Number;
var _local3:Number;
var _local4:Number;
if ((Debug.debugMode & 8) == 0){
return;
};
if (objectDef == null){
return;
};
if (objectDef.collisionCircleOffsets.length == 0){
return;
};
_local1 = 0;
while (_local1 < objectDef.collisionCircleOffsets.length) {
_local2 = objectDef.collisionCircleOffsets[_local1].x;
_local3 = objectDef.collisionCircleOffsets[_local1].y;
_local4 = objectDef.collisionCircleRadii[_local1];
_local2 = (_local2 + xpos);
_local2 = (_local2 - Game.scrollX);
_local3 = (_local3 + ypos);
_local3 = (_local3 - Game.scrollY);
Utils.RenderCircle(main.screenBD, _local2, _local3, _local4, 4294967295);
_local1++;
};
}
public function InitEnemy_Portal(){
EnemyUpdateFunctionCallback = UpdatePortal_Type0;
renderFunction = RenderNormally;
controlMode = 0;
colFlag_isInstallation = true;
trace("InitEnemy_PORTAL");
graphicID = objectDef.GetAnimIDFromName("idle");
timer = Game.portalDef.GetRandomTime();
controlMode = 0;
frame = 0;
frameVel = 1;
height = 0;
}
public function PlayerHitEnemyBullet(_arg1:GameObj){
}
function ClearColFlags(){
colFlag_jumpon = false;
colFlag_killPlayer = false;
colFlag_playercanbekilled = false;
colFlag_canBePickedUp = false;
colFlag_canBeShot = false;
colFlag_isBullet = false;
colFlag_isPlatform = false;
colFlag_isPowerup = false;
colFlag_isBouncyPad = false;
colFlag_isCheckpoint = false;
colFlag_isShop = false;
colFlag_isEnemyBullet = false;
colFlag_isEnemy = false;
colFlag_isInstallation = false;
colFlag_UseRadius = false;
}
function RenderShadow(){
if (shadowRenderFunction != null){
shadowRenderFunction();
return;
};
RenderShadowPreRotated();
}
public function InitBackground(_arg1:int, _arg2:Number, _arg3:int=1150){
bgWidth = _arg3;
graphicID = _arg1;
frame = 0;
speed = _arg2;
updateFunction = UpdateBackground;
renderFunction = RenderBackground;
}
function UpdateBullet_Spiral():void{
xpos = (startx + (Math.cos(xacc) * yacc));
ypos = (starty + (Math.sin(xacc) * yacc));
yacc = (yacc + speed);
timer--;
if (timer < 0){
timer = 0;
};
if (timer == 0){
xacc = (xacc + rotVel);
};
if (yacc > 500){
active = false;
};
}
function RenderInstantBullet_Streaky():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
var _local4:Point;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local1 = Math.floor(Game.scrollX);
_local2 = Math.floor(Game.scrollY);
_local3 = 0;
while (_local3 < instantBullet_numObjects) {
_local4 = instantPositions[_local3];
_local5 = instantAngles[_local3];
_local6 = (Math.floor(_local4.x) - _local1);
_local7 = (Math.floor(_local4.y) - _local2);
GraphicObjects.RenderAt(graphicID, frame, main.screenBD, _local6, _local7, false);
_local3++;
};
}
function UpdateBattleCopter():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
if (Game.isBossLevel){
startx = (startx - 5);
if (startx < -200){
startx = -200;
};
} else {
startx = (startx + 10);
if (startx >= 60){
startx = 60;
};
};
xpos = (startx + (Math.cos((timer * 0.01)) * 20));
ypos = (starty + (Math.sin((timer * 0.03)) * 50));
CycleAnimation();
timer++;
dir1 = (dir1 + 0.02);
if (controlMode == 0){
graphicID1 = GraphicObjects.gfx_cannonnotfiring;
timer1 = 3;
} else {
if (controlMode == 1){
graphicID1 = GraphicObjects.gfx_cannonfiring;
timer1--;
if (timer1 <= 0){
controlMode = 0;
};
};
};
_local1 = xpos;
_local2 = ypos;
_local3 = (MouseControl.mousePosX - _local1);
_local4 = (MouseControl.mousePosY - _local2);
dir1 = Math.atan2(_local4, _local3);
dir1 = (dir1 - (Math.PI * 0.5));
}
public function PlayAnimation():Boolean{
var _local1:int;
_local1 = (GraphicObjects.GetNumFrames(graphicID) - 1);
frame = (frame + frameVel);
if (frame >= _local1){
frame = _local1;
return (true);
};
return (false);
}
public function EnemyShot():void{
var _local1:Number;
var _local2:Number;
var _local3:GameObj;
_local1 = MouseControl.mousePosX;
_local2 = MouseControl.mousePosY;
health--;
if (health <= 0){
EnemyKilled();
} else {
healthBarTimer = 50;
_local3 = GameObjects.AddObj(_local1, _local2, 100);
_local3.InitExplosion(1);
};
}
public function GetDirBetween(_arg1, _arg2, _arg3, _arg4):Number{
var _local5:*;
_local5 = Math.atan2((_arg4 - _arg2), (_arg3 - _arg1));
return (_local5);
}
function InitFireAtPlayer(_arg1:Number, _arg2:int, _arg3:Number, _arg4:Number){
fire_maxDelay = (Defs.fps * _arg1);
fire_maxBullets = _arg2;
fire_groupDelay = (Defs.fps * _arg3);
fire_timer = fire_maxDelay;
fire_numBulletsFired = 0;
fire_mode = 0;
fire_radOffset = _arg4;
}
public function UpdateEnemy_RandomlyFlyRoundMap(){
timer--;
if (timer <= 0){
timer = Utils.RandBetweenInt(50, 100);
toPosX = Utils.RandBetweenFloat(0, 1000);
toPosY = Utils.RandBetweenFloat(0, 1000);
toSpeed = Utils.RandBetweenFloat(objectDef.NumParamC, objectDef.NumParamD);
};
speed = (speed + ((toSpeed - speed) * 0.005));
movementVec.speed = speed;
RotateToRequiredRot(rotVel);
dir = movementVec.rot;
xpos = (xpos + movementVec.GetXComponent());
ypos = (ypos + movementVec.GetYComponent());
UpdateExternalVel();
if (Utils.Dist2BetweenPoints(xpos, ypos, toPosX, toPosY) <= (30 * 30)){
timer = 0;
};
UpdateBob();
}
public function UpdateEnemy_TurnAndMoveToPoint(){
var _local1:Number;
if (controlMode == 0){
if (RotateToRequiredRot(rotVel)){
controlMode = 1;
speed = 0;
};
} else {
if (controlMode == 1){
_local1 = Utils.Dist2BetweenPoints(xpos, ypos, toPosX, toPosY);
if (_local1 < (60 * 60)){
speed = (speed - accel);
if (speed < minSpeed){
speed = minSpeed;
};
} else {
speed = (speed + accel);
if (speed > maxSpeed){
speed = maxSpeed;
};
};
movementVec.speed = speed;
RotateToRequiredRot(rotVel);
xpos = (xpos + movementVec.GetXComponent());
ypos = (ypos + movementVec.GetYComponent());
if (_local1 < (20 * 20)){
UpdateEnemy_TurnAndMoveToPoint_GetPosNearPlayer();
controlMode = 0;
};
};
};
dir = movementVec.rot;
UpdateExternalVel();
UpdateBob();
}
function RotateToRequiredRot(_arg1:Number):Boolean{
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = Math.atan2((toPosY - ypos), (toPosX - xpos));
_local3 = (_local2 + (Math.PI / 2));
_local4 = Utils.DotProduct(Math.cos(movementVec.rot), Math.sin(movementVec.rot), Math.cos(_local3), Math.sin(_local3));
if (movementVec.NearRot(_local2, _arg1)){
movementVec.rot = _local2;
return (true);
};
if (_local4 < 0){
movementVec.AddRot(_arg1);
} else {
movementVec.AddRot(-(_arg1));
};
return (false);
}
function InitBossFireAtPlayer(){
if (bossDifficulty == 0){
InitFireAtPlayer(3, 3, 0.1, 10);
};
if (bossDifficulty == 1){
InitFireAtPlayer(2, 4, 0.1, 10);
};
if (bossDifficulty == 2){
InitFireAtPlayer(1, 5, 0.1, 10);
};
if (bossDifficulty == 3){
InitFireAtPlayer(1, 6, 0.1, 10);
};
if (bossDifficulty == 4){
InitFireAtPlayer(1, 7, 0.1, 10);
};
}
function MakeCollisionPoly(){
var _local1:Array;
var _local2:Matrix;
var _local3:Point;
_local1 = new Array();
_local2 = new Matrix();
_local2.rotate(movementVec.rot);
_local2.translate(xpos, ypos);
for each (_local3 in bulletPlayerWeapon.collisionPoly) {
_local1.push(_local2.transformPoint(_local3));
};
collisionPoly = Poly.PolyFromPointList(_local1);
}
public function CycleAnimationEx():Boolean{
var _local1:Boolean;
_local1 = false;
frame = (frame + frameVel);
if (frame > maxFrame){
frame = minFrame;
_local1 = true;
};
if (frame < minFrame){
frame = maxFrame;
_local1 = true;
};
return (_local1);
}
public function Action_Pause(_arg1:Number){
timer = _arg1;
controlMode = 1;
}
public function UpdatePortal(){
if (subtype == 0){
UpdatePortal_Type0();
};
if (subtype == 1){
UpdatePortal_Type1();
};
if (healthBarTimer > 0){
healthBarTimer--;
};
}
function InitInstantBullet_FixedTarget(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
_arg1.bulletPlayerWeapon = _arg3;
_arg1.health = 99999;
_arg1.updateFunction = _arg1.UpdateInstantBullet_FixedTarget;
_arg1.renderFunction = _arg1.RenderInstantBullet_FixedTarget;
_arg1.graphicID = _arg3.graphicID;
_arg1.parentObj = _arg2;
_arg1.frame = 0;
_arg1.frameVel = 1;
_arg1.xpos = _arg1.parentObj.xpos;
_arg1.ypos = _arg1.parentObj.ypos;
_arg1.movementVec.Set((_arg1.parentObj.dir + _arg3.GetFireAngle()), 0);
_arg1.dir = _arg1.movementVec.rot;
_arg1.instantBullet_TrackedObject = Collision.GetNearestEnemy(Game.mouseMapX, Game.mouseMapY);
if (_arg1.instantBullet_TrackedObject == null){
_arg1.active = false;
return;
};
_arg1.instantBullet_TrackedObject.beingTracked = true;
}
function InitInstantBullet_Spline(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
_arg1.bulletPlayerWeapon = _arg3;
_arg1.health = 99999;
_arg1.updateFunction = _arg1.UpdateInstantBullet_Spline;
_arg1.renderFunction = _arg1.RenderInstantBullet_Spline;
_arg1.graphicID = _arg3.graphicID;
_arg1.parentObj = _arg2;
_arg1.frame = 0;
_arg1.frameVel = 1;
_arg1.xpos = _arg1.parentObj.xpos;
_arg1.ypos = _arg1.parentObj.ypos;
_arg1.movementVec.Set((_arg1.parentObj.dir + _arg3.GetFireAngle()), 0);
_arg1.dir = _arg1.movementVec.rot;
_arg1.timer = 80;
_arg1.instantPositions = new Array(100);
_arg1.instantAngles = new Array(100);
instantBullet_numObjects = 0;
}
public function InitEnemy_FollowPlayer(){
EnemyUpdateFunctionCallback = UpdateEnemy_RotateToPlayer;
rotVel = Utils.RandBetweenFloat(objectDef.NumParamA, objectDef.NumParamB);
speed = Utils.RandBetweenFloat(objectDef.NumParamC, objectDef.NumParamD);
InitEnemyRot_TakeFromPortalDef();
InitBob();
}
function TestLandingOnMissile():Boolean{
var _local1:GameObj;
_local1 = Game.GetEnemyMissile();
if (_local1 == null){
return (false);
};
if ((((ypos > _local1.ypos)) && ((ypos < (_local1.ypos + 12))))){
if ((((xpos > (_local1.xpos - 50))) && ((xpos < (_local1.xpos + 50))))){
return (true);
};
};
return (false);
}
public function InitEnemy_FollowPlayerVels(){
EnemyUpdateFunctionCallback = UpdateEnemy_FollowPlayerVels;
acc = Utils.RandBetweenFloat(objectDef.NumParamA, objectDef.NumParamB);
speed = Utils.RandBetweenFloat(objectDef.NumParamC, objectDef.NumParamD);
heightVar0 = 0;
heightVar1 = Utils.RandBetweenFloat(0.02, 0.1);
}
function RenderToBackground(){
}
public function GetObjectRectangle():Rectangle{
var _local1:ObjectDef;
_local1 = GetObjectDef();
return (_local1.colRects[0]);
}
public function RenderEnemy_Helicopter(){
var _local1:Number;
RenderEnemy();
_local1 = dir1;
dir1 = (Math.PI - dir1);
RenderPreRotated1();
dir1 = _local1;
}
function TimerDecrement():Boolean{
timer--;
if (timer <= 0){
return (true);
};
return (false);
}
function UpdateBackground():void{
var _local1:Number;
_local1 = Game.scrollSpeed;
xpos = (xpos - (_local1 * speed));
if (xpos < -(bgWidth)){
xpos = (xpos + bgWidth);
};
}
function Path_GetToPos():Boolean{
var _local1:Boolean;
var _local2:Point;
var _local3:Point;
var _local4:Number;
var _local5:Number;
_local1 = false;
if (pathPos >= currentPoly.GetCatmullRomLength()){
_local1 = true;
};
_local4 = ((1 / currentPoly.GetCatmullRomLength()) * pathPos);
_local3 = currentPoly.GetPointOnCatmullRom(_local4);
_local5 = (_local4 - 0.01);
if (_local5 < 0){
_local5 = 0;
};
_local2 = currentPoly.GetPointOnCatmullRom(_local5);
toPosX = _local3.x;
toPosY = _local3.y;
prevToPosX = _local2.x;
prevToPosY = _local2.y;
return (_local1);
}
function RenderHealthBar(_arg1:Boolean=false){
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Point;
var _local7:Number;
var _local8:Number;
var _local9:*;
var _local10:Rectangle;
if (_arg1 == false){
if (healthBarTimer <= 0){
return;
};
} else {
if (health > 20){
if (healthBarTimer <= 0){
return;
};
};
};
_local2 = Math.floor(Game.scrollX);
_local3 = Math.floor(Game.scrollY);
_local4 = (Math.floor(xpos) - _local2);
_local5 = (Math.floor(ypos) - _local3);
_local6 = new Point(0, -50);
_local4 = (_local4 + _local6.x);
_local5 = (_local5 + _local6.y);
_local7 = 20;
_local8 = 3;
_local9 = (_local7 * 0.5);
_local4 = (_local4 - _local9);
_local10 = new Rectangle();
_local10.x = _local4;
_local10.y = _local5;
_local10.width = _local7;
_local10.height = _local8;
if (_arg1){
main.screenBD.fillRect(_local10, 4280295520);
} else {
main.screenBD.fillRect(_local10, 4286578688);
};
_local10.x = _local4;
_local10.y = _local5;
_local10.width = ((_local7 / objectDef.maxHealth) * health);
_local10.height = _local8;
if (_arg1){
main.screenBD.fillRect(_local10, 4282401023);
} else {
main.screenBD.fillRect(_local10, 4294901760);
};
}
public function InitEnemy_FollowPlayer_FlyLike(){
EnemyUpdateFunctionCallback = UpdateEnemy_FollowPlayer_FlyLike;
UpdateEnemy_FollowPlayer_FlyLike_GetNewToPos();
}
function RenderEnemyBullet(){
RenderNormally();
}
function UpdateBullet_ShockwaveBit():void{
xpos = (xpos + xvel);
ypos = (ypos + yvel);
timer--;
if (timer < 0){
active = false;
};
CycleAnimation();
}
public function InitEnemy_JetpackRobotBlue():void{
enemyType = WaveDefs.et_jetpackblue;
objectDef = ObjectDefs.GetObjectDefByExportName("JetPackBlue");
health = objectDef.maxHealth;
radius = 50;
isBlueJetpack = true;
colFlag_isEnemy = true;
graphicID = GraphicObjects.gfx_enemy_jetpackrobotblue;
frame = 0;
frameVel = 1;
updateFunction = UpdateEnemy_JetpackRobotBlue;
yvel = 0;
xvel = 0;
xpos = -50;
ypos = Utils.RandBetweenFloat(100, 300);
toPosX = Utils.RandBetweenFloat(450, 550);
toPosY = Utils.RandBetweenFloat(100, 300);
timer = 50;
xacc = 0;
yacc = 0;
speed = 5;
acc = 0.3;
InitFireAtPlayer(2, 3, 0.2, 10);
}
public function UpdateEnemy_RotateToPlayer2(){
var _local1:Point;
timer--;
if (timer <= 0){
_local1 = Utils.RandPointInCircle(objectDef.NumParamG);
toOffsetX = _local1.x;
toOffsetY = _local1.y;
timer = (Utils.RandBetweenFloat(objectDef.NumParamE, objectDef.NumParamF) * Defs.fps2);
};
movementVec.speed = speed;
toPosX = (Game.goPlayer.xpos + toOffsetX);
toPosY = (Game.goPlayer.ypos + toOffsetY);
RotateToRequiredRot(rotVel);
dir = movementVec.rot;
xpos = (xpos + movementVec.GetXComponent());
ypos = (ypos + movementVec.GetYComponent());
UpdateExternalVel();
UpdateBob();
}
function RenderWithAlpha(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local1 = Math.floor(Game.scrollX);
_local2 = Math.floor(Game.scrollY);
_local3 = (Math.floor(xpos) - _local1);
_local4 = (Math.floor(ypos) - _local2);
GraphicObjects.RenderAtAlpha(graphicID, frame, main.screenBD, _local3, (_local4 - (height * 0.1)), alpha);
}
public function InitEnemy_Installation(){
height = 0;
hasShadow = true;
EnemyUpdateFunctionCallback = UpdateInstallation;
renderFunction = RenderNormally;
colFlag_isEnemy = true;
colFlag_isInstallation = true;
graphicID = objectDef.GetAnimIDFromName("idle");
}
function RenderPreRotated1(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:int;
_local1 = Math.floor(Game.scrollX);
_local2 = Math.floor(Game.scrollY);
_local3 = (Math.floor(xpos) - _local1);
_local4 = (Math.floor(ypos) - _local2);
_local5 = GraphicObjects.GetNumFrames(graphicID1);
_local6 = dir1;
_local6 = (_local6 - (Math.PI / 2));
while (_local6 < 0) {
_local6 = (_local6 + (Math.PI * 2));
};
while (_local6 > (Math.PI * 2)) {
_local6 = (_local6 - (Math.PI * 2));
};
_local7 = ((_local5 / (Math.PI * 2)) * _local6);
GraphicObjects.RenderAt(graphicID1, _local7, main.screenBD, _local3, (_local4 - (height * 0.1)), false);
}
function UpdateOverlay(){
if (PlayAnimation()){
active = false;
};
}
public function InitEnemy_Edge8Way(){
var _local1:int;
var _local2:Number;
EnemyUpdateFunctionCallback = UpdateEnemy_Edge8Way;
speed = Utils.RandBetweenFloat(objectDef.NumParamA, objectDef.NumParamB);
renderFunction = RenderNormally;
shadowRenderFunction = RenderShadowNormally;
frameVel = 0.2;
height = 0;
_local1 = Utils.RandBetweenInt(0, 7);
_local2 = (-(((Math.PI / 4) * Number(_local1))) + (Math.PI / 2));
movementVec.Set(_local2, speed);
SetStartEdgePosFrom8Way(_local1);
minFrame = (frame = (_local1 * 10));
maxFrame = (minFrame + 9);
}
public function UpdateEnemy_Edge8Way(){
xpos = (xpos + movementVec.GetXComponent());
ypos = (ypos + movementVec.GetYComponent());
UpdateExternalVel();
if (IsInWorld(64) == false){
active = false;
};
CycleAnimationEx();
}
function RenderTailPiecesShadow():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
var _local4:TailPiece;
var _local5:int;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:int;
var _local11:int;
_local1 = Math.floor(Game.scrollX);
_local2 = Math.floor(Game.scrollY);
_local3 = tailPieces.length;
_local5 = 0;
while (_local5 < _local3) {
_local4 = tailPieces[_local5];
_local6 = (Math.floor(_local4.xpos) - _local1);
_local7 = (Math.floor(_local4.ypos) - _local2);
_local8 = GraphicObjects.GetNumFrames(_local4.graphicID);
_local9 = _local4.dir;
_local9 = (_local9 + (Math.PI / 2));
_local9 = (Math.PI - _local9);
while (_local9 < 0) {
_local9 = (_local9 + (Math.PI * 2));
};
while (_local9 > (Math.PI * 2)) {
_local9 = (_local9 - (Math.PI * 2));
};
_local10 = ((_local8 / (Math.PI * 2)) * _local9);
_local11 = GraphicObjects.idList[_local4.graphicID];
GraphicObjects.graphicobjs[_local11].frames[_local10].RenderAtShadow(Game.main.screenBD, _local6, (_local7 + 3), false);
_local5++;
};
}
public function InitEnemy9(){
var _local1:int;
var _local2:Number;
EnemyUpdateFunctionCallback = UpdateEnemy9;
speed = Utils.RandBetweenFloat(0.5, 1);
renderFunction = RenderNormally;
frameVel = 0.2;
height = 0;
_local1 = Utils.RandBetweenInt(0, 7);
_local2 = (-(((Math.PI / 4) * Number(_local1))) + (Math.PI / 2));
movementVec.Set(_local2, speed);
SetStartEdgePosFrom8Way(_local1);
minFrame = (frame = (_local1 * 10));
maxFrame = (minFrame + 9);
}
function UpdateExternalVel(){
xpos = (xpos + externalVec.GetXComponent());
ypos = (ypos + externalVec.GetYComponent());
externalVec.speed = (externalVec.speed - 0.25);
if (externalVec.speed <= 0){
externalVec.speed = 0;
};
}
function SetToRequiredRot():void{
var _local1:Number;
_local1 = Math.atan2((toPosY - ypos), (toPosX - xpos));
movementVec.rot = _local1;
}
function InitInstantBullet_Streaky(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
var _local4:Number;
var _local5:Number;
_arg1.bulletPlayerWeapon = _arg3;
_arg1.updateFunction = _arg1.UpdateInstantBullet_Streaky;
_arg1.renderFunction = _arg1.RenderInstantBullet_Streaky;
_arg1.graphicID = _arg3.graphicID;
_arg1.parentObj = _arg2;
_arg1.frame = 0;
_arg1.frameVel = 1;
_arg1.xpos = _arg1.parentObj.xpos;
_arg1.ypos = _arg1.parentObj.ypos;
_arg1.movementVec.Set((_arg1.parentObj.dir + _arg3.GetFireAngle()), 0);
_arg1.dir = _arg1.movementVec.rot;
_arg1.timer = 50;
_arg1.instantPositions = new Array(100);
_arg1.instantAngles = new Array(100);
instantBullet_numObjects = 0;
_local4 = Game.mouseMapX;
_local5 = Game.mouseMapY;
_arg1.instantBullet_TrackedObject = Collision.GetNearestEnemy(_local4, _local5);
if (_arg1.instantBullet_TrackedObject == null){
_arg1.active = false;
return;
};
_arg1.instantBullet_TrackedObject.beingTracked = true;
_arg1.UpdateInstantBullet_Streaky();
}
function InitEnemyBullet(_arg1:Number=0):void{
var _local2:GameObj;
var _local3:Number;
var _local4:Number;
var _local5:Number;
objectDef = ObjectDefs.GetObjectDefByExportName("Bullet");
usesBulletTime = true;
SoundPlayer.Play(SoundPlayer.sfx_shot2);
colFlag_isEnemyBullet = true;
updateFunction = UpdateEnemyBullet;
graphicID = GraphicObjects.gfx_enemy_bullet;
_local2 = Game.goPlayer;
_local3 = (_local2.xpos - xpos);
_local4 = (_local2.ypos - ypos);
_local5 = Math.atan2(_local4, _local3);
movementVec.Set(_local5, 5);
frame = 0;
frameVel = 0.5;
timer = Utils.RandBetweenInt(0, 4);
xvel = movementVec.GetXComponent();
yvel = movementVec.GetYComponent();
xpos = (xpos + (movementVec.GetUnitXComponent() * _arg1));
ypos = (ypos + (movementVec.GetUnitYComponent() * _arg1));
}
function InitBullet_ShockwaveBit(_arg1:GameObj, _arg2:Number):void{
bulletPlayerWeapon = _arg1.bulletPlayerWeapon;
colFlag_isBullet = true;
updateFunction = UpdateBullet_ShockwaveBit;
graphicID = _arg1.graphicID;
frame = 0;
frameVel = 1;
xpos = _arg1.xpos;
ypos = _arg1.ypos;
movementVec.Set(_arg2, bulletPlayerWeapon.GetSpeed());
dir = movementVec.rot;
xvel = movementVec.GetXComponent();
yvel = movementVec.GetYComponent();
timer = 10;
}
public function PlayAnimationEx():Boolean{
var _local1:Boolean;
_local1 = false;
frame = (frame + frameVel);
if (frame > maxFrame){
frame = maxFrame;
_local1 = true;
};
if (frame < minFrame){
frame = minFrame;
_local1 = true;
};
return (_local1);
}
function UpdateEnemy_BossHelicopter():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:GameObj;
if (controlMode == 0){
xpos = (xpos + xvel);
if (xpos < -100){
BossCopter_InitMode(1);
};
} else {
if (controlMode == 1){
if (TimerDecrement()){
BossCopter_InitMode(2);
};
} else {
if (controlMode == 2){
xpos = (xpos + xvel);
if (xpos >= 100){
BossCopter_InitMode(3);
};
} else {
if (controlMode == 3){
if (TimerDecrement()){
count--;
if (count == 0){
BossCopter_InitMode(4);
} else {
timer = Utils.RandBetweenInt(20, 40);
toPosX = Utils.RandBetweenFloat(0, 500);
toPosY = Utils.RandBetweenFloat(100, 200);
};
} else {
acc = 1;
_local1 = 10;
_local2 = -(acc);
if (xpos < toPosX){
_local2 = acc;
};
xvel = (xvel + _local2);
if (xvel >= _local1){
xvel = _local1;
};
if (xvel <= -(_local1)){
xvel = -(_local1);
};
_local3 = -(acc);
if (ypos < toPosY){
_local3 = acc;
};
yvel = (yvel + _local3);
if (yvel >= _local1){
yvel = _local1;
};
if (yvel <= -(_local1)){
yvel = -(_local1);
};
xpos = (xpos + xvel);
ypos = (ypos + yvel);
};
};
};
};
};
if (controlMode == 4){
xpos = (xpos + xvel);
if (xpos < -100){
BossCopter_InitMode(5);
};
};
if (controlMode == 5){
xpos = (xpos + xvel);
if (xpos > (640 + 100)){
BossCopter_InitMode(6);
};
};
if (controlMode == 6){
xpos = (xpos + xvel);
if (xpos < (640 - 100)){
BossCopter_InitMode(7);
};
};
if (controlMode == 7){
timer1--;
if (timer1 < 0){
timer1 = Utils.RandBetweenInt(20, 40);
toPosX = Utils.RandBetweenFloat((640 - 100), (640 - 50));
toPosY = Utils.RandBetweenFloat(100, 300);
} else {
acc = 3;
_local1 = 20;
_local2 = -(acc);
if (xpos < toPosX){
_local2 = acc;
};
xvel = (xvel + _local2);
if (xvel >= _local1){
xvel = _local1;
};
if (xvel <= -(_local1)){
xvel = -(_local1);
};
_local3 = -(acc);
if (ypos < toPosY){
_local3 = acc;
};
yvel = (yvel + _local3);
if (yvel >= _local1){
yvel = _local1;
};
if (yvel <= -(_local1)){
yvel = -(_local1);
};
xpos = (xpos + xvel);
ypos = (ypos + yvel);
};
if (TimerDecrement()){
BossCopter_InitMode(8);
};
if (timer < 300){
if (Game.CountEnemyMissiles() == 0){
_local4 = GameObjects.AddObj(-100, 400, 1010);
_local4.InitEnemy_Missile();
};
};
};
if (controlMode == 8){
xpos = (xpos + xvel);
if (xpos > (640 + 200)){
BossCopter_InitMode(0);
};
};
UpdateFireAtPlayer();
CycleAnimation();
UpdateEnemyStuff();
}
function Anim_FromVel():void{
var _local1:int;
var _local2:Number;
var _local3:Number;
var _local4:*;
_local1 = GraphicObjects.GetNumFrames(graphicID);
_local2 = xvel;
_local3 = yvel;
_local4 = Math.atan2(_local3, _local2);
frame = ((_local1 / (Math.PI * 2)) * -(_local4));
if (frame < 0){
frame = (frame + _local1);
};
if (frame > _local1){
frame = (frame - _local1);
};
frame = (frame + (_local1 / 2));
if (frame > _local1){
frame = (frame - _local1);
};
}
function UpdateEnemy_CannonBullet2():void{
var _local1:GameObj;
xpos = (xpos + xvel);
yvel = (yvel + Game.gravity);
if (yvel > Game.maxFallSpeed){
yvel = Game.maxFallSpeed;
};
ypos = (ypos + yvel);
if (ypos > Game.floorYpos){
ypos = Game.floorYpos;
_local1 = GameObjects.AddObj(xpos, ypos, 100);
_local1.InitExplosion(0);
active = false;
};
CycleAnimation();
UpdateEnemyStuff();
}
function UpdateShop():void{
ypos = (ypos + yvel);
xpos = (xpos + xvel);
if (ypos >= (Defs.displayarea_h + 32)){
active = false;
};
}
function RenderEnemy(){
var _local1:Number;
_local1 = dir;
dir = (Math.PI - dir);
RenderPreRotated();
dir = _local1;
RenderHealthBar();
}
function RenderBackground():void{
var _local1:Number;
var _local2:Number;
_local1 = Math.floor(xpos);
_local2 = Math.floor(ypos);
GraphicObjects.RenderAt(graphicID, frame, main.screenBD, _local1, _local2, false);
GraphicObjects.RenderAt(graphicID, frame, main.screenBD, (_local1 + bgWidth), _local2, false);
}
function PlayerTrail(){
var _local1:Particle;
_local1 = Particles.Add((xpos - 10), ypos);
_local1.InitPlayerTrail();
}
function PlayerDontFire(){
if (Game.gunShootDelay > 0){
Game.gunShootDelay--;
};
if (Game.gunOverheated){
Game.gunTemperature = (Game.gunTemperature + Game.gunOverheatAdder);
} else {
Game.gunTemperature = (Game.gunTemperature + Game.gunNoShootAdder);
};
if (Game.gunTemperature <= 0){
Game.gunTemperature = 0;
Game.gunOverheated = false;
};
}
function UpdateMoon():void{
var _local1:Number;
var _local2:Number;
timer = (timer + 0.0005);
_local1 = Math.PI;
if (timer > _local1){
timer = (timer - _local1);
timer = (timer - 0.01);
};
_local2 = timer;
xpos = (320 - (Math.cos(_local2) * 350));
ypos = (410 - (Math.sin(_local2) * 150));
}
function UpdateFatHomingBullet():void{
var _local1:Number;
var _local2:Number;
var _local3:GameObj;
_local1 = Game.mouseMapX;
_local2 = Game.mouseMapY;
_local3 = Collision.GetNearestEnemy(_local1, _local2);
if (_local3 != null){
if (timer1 <= 0){
toPosX = _local3.xpos;
toPosY = _local3.ypos;
RotateToRequiredRot(0.1);
} else {
timer1--;
};
};
dir = (movementVec.rot + (Math.PI * 0.5));
xpos = (xpos + movementVec.GetXComponent());
ypos = (ypos + movementVec.GetYComponent());
if (IsInWorld(64) == false){
active = false;
};
timer--;
if (timer <= 0){
active = false;
};
}
public function InitEnemy_SplineRoundPlayer_Stepper(){
var _local1:Array;
var _local2:Number;
var _local3:Number;
var _local4:int;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Point;
EnemyUpdateFunctionCallback = UpdateEnemy_SplineRoundPlayer_Stepper;
rotVel = 0.025;
controlMode = 0;
_local1 = new Array();
_local2 = 50;
_local3 = 0;
while (_local3 < (Math.PI * 2)) {
_local5 = Utils.RandBetweenFloat(objectDef.NumParamA, objectDef.NumParamB);
_local6 = (Math.cos(_local3) * _local5);
_local7 = (Math.sin(_local3) * _local5);
_local6 = (_local6 + Utils.RandBetweenFloat(-(_local2), _local2));
_local7 = (_local7 + Utils.RandBetweenFloat(-(_local2), _local2));
_local8 = new Point(_local6, _local7);
_local1.push(_local8);
_local3 = (_local3 + 0.6);
};
_local4 = 0;
currentPoly = new Poly("", 0, _local1[_local4].x, _local1[_local4].y);
_local4 = 1;
while (_local4 < _local1.length) {
currentPoly.AddLine(_local1[_local4].x, _local1[_local4].y, _local1[_local4].x, _local1[_local4].y);
_local4++;
};
currentPoly.Finish(false);
timer = Utils.RandBetweenFloat(0, 1);
rotVel = Utils.RandBetweenFloat(objectDef.NumParamC, objectDef.NumParamD);
timer1 = 0;
xpos2 = xpos;
ypos2 = ypos;
}
public function DodgeBullet(_arg1:GameObj){
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Vec;
_local2 = (_arg1.xpos - xpos);
_local3 = (_arg1.ypos - ypos);
_local4 = Utils.DistBetweenPoints(xpos, ypos, _arg1.xpos, _arg1.ypos);
if (_local4 < objectDef.dodgeDist){
_local5 = Utils.ScaleTo(objectDef.dodgeMax, objectDef.dodgeMin, 0, objectDef.dodgeDist, _local4);
_local6 = new Vec();
_local6.SetAngFromDxDy(_local2, _local3);
_local6.speed = _local5;
xpos = (xpos - _local6.GetXComponent());
ypos = (ypos - _local6.GetYComponent());
};
}
function UpdateEnemy_CannonBullet1():void{
var _local1:GameObj;
yvel = (yvel + Game.gravity);
if (yvel > Game.maxFallSpeed){
yvel = Game.maxFallSpeed;
};
ypos = (ypos + yvel);
if (ypos > Game.floorYpos){
_local1 = GameObjects.AddObj(xpos, ypos, 100);
_local1.InitExplosion(0);
ypos = Game.floorYpos;
active = false;
};
CycleAnimation();
UpdateEnemyStuff();
}
function UpdateBullet_SteppedSquare():void{
var _local1:int;
var _local2:Number;
timer--;
if (timer <= 0){
xpos = (xpos + movementVec.GetXComponent());
ypos = (ypos + movementVec.GetYComponent());
timer = 3;
timer1++;
if (timer1 > 3){
_local1 = Utils.RandBetweenInt(0, 100);
_local2 = (Math.PI * 0.5);
if (squareBullet_offCentre == 0){
if (_local1 < 25){
squareBullet_offCentre = 1;
movementVec.AddRot(_local2);
} else {
if (_local1 < 50){
squareBullet_offCentre = -1;
movementVec.AddRot(-(_local2));
};
};
} else {
if (squareBullet_offCentre == 1){
if (_local1 < 50){
squareBullet_offCentre = 0;
movementVec.AddRot(-(_local2));
};
} else {
if (squareBullet_offCentre == -1){
if (_local1 < 50){
squareBullet_offCentre = 0;
movementVec.AddRot(_local2);
};
};
};
};
};
};
dir = (movementVec.rot + (Math.PI * 0.5));
if (IsInWorld(64) == false){
active = false;
};
}
public function UpdateEnemy_AccelStraight(){
movementVec.speed = (movementVec.speed + accel);
xpos = (xpos + movementVec.GetXComponent());
ypos = (ypos + movementVec.GetYComponent());
dir = movementVec.rot;
UpdateExternalVel();
}
function InitExplosion(_arg1:int=0):void{
var _local2:int;
_local2 = Utils.RandBetweenInt(SoundPlayer.sfx_explosion1, SoundPlayer.sfx_explosion2);
SoundPlayer.Play(_local2);
objectDef = ObjectDefs.GetObjectDefByExportName("Player");
graphicID = (GraphicObjects.gfx_explosion1 + _arg1);
frame = 0;
frameVel = 1;
updateFunction = UpdateExplosion;
if (_arg1 == 0){
Game.shake = Game.shakeMax;
};
}
function RenderBattleCopter(){
var _local1:Number;
var _local2:Number;
RenderNormally();
_local1 = Math.floor(xpos);
_local2 = Math.floor(ypos);
GraphicObjects.RenderAtRotScaled(graphicID1, frame1, main.screenBD, _local1, _local2, false, 1, dir1);
}
public function InitEnemy_CannonBullet2():void{
enemyType = WaveDefs.et_cannon2;
objectDef = ObjectDefs.GetObjectDefByExportName("Cannon2");
health = objectDef.maxHealth;
radius = 20;
colFlag_isEnemy = true;
graphicID = GraphicObjects.gfx_enemy_cannonbullet2;
frame = 0;
frameVel = 1;
updateFunction = UpdateEnemy_CannonBullet2;
yvel = 0;
xvel = Utils.RandBetweenFloat(1, 2);
if (Utils.RandBool()){
xvel = -(xvel);
};
ypos = Utils.RandBetweenFloat(-30, -50);
xpos = Utils.RandBetweenFloat(0, 640);
}
function UpdateBullet_Ricochet_HitEnemy(_arg1:GameObj):void{
movementVec.Set(Utils.RandCircle(), bulletPlayerWeapon.GetSpeed());
rotVel = Utils.RandBetweenFloat(-0.2, 0.2);
}
public function InitEnemy_CannonBullet1():void{
enemyType = WaveDefs.et_cannon1;
objectDef = ObjectDefs.GetObjectDefByExportName("Cannon1");
health = objectDef.maxHealth;
radius = 20;
colFlag_isEnemy = true;
graphicID = GraphicObjects.gfx_enemy_cannonbullet1;
frame = 0;
frameVel = 1;
updateFunction = UpdateEnemy_CannonBullet1;
yvel = 0;
xvel = 0;
ypos = Utils.RandBetweenFloat(-30, -50);
xpos = Utils.RandBetweenFloat(0, 640);
}
function RenderRotated(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local1 = Math.floor(Game.scrollX);
_local2 = Math.floor(Game.scrollY);
_local3 = (Math.floor(xpos) - _local1);
_local4 = (Math.floor(ypos) - _local2);
GraphicObjects.RenderAtRotScaled(graphicID, frame, main.screenBD, _local3, (_local4 - (height * 0.1)), false, scale, dir);
}
function UpdateActions(){
var _local1:ObjAction;
for each (_local1 in actionList) {
if ((((_local1.done == false)) && ((actionTimer == _local1.time)))){
trace("Action_Pause");
_local1.actionFunction(_local1.param0);
};
};
actionTimer++;
}
function UpdateEnemy_JetpackRobotRed():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = speed;
_local2 = -(acc);
if (xpos < toPosX){
_local2 = acc;
};
xvel = (xvel + _local2);
if (xvel >= _local1){
xvel = _local1;
};
if (xvel <= -(_local1)){
xvel = -(_local1);
};
_local3 = -(acc);
if (ypos < toPosY){
_local3 = acc;
};
yvel = (yvel + _local3);
if (yvel >= _local1){
yvel = _local1;
};
if (yvel <= -(_local1)){
yvel = -(_local1);
};
xpos = (xpos + xvel);
ypos = (ypos + yvel);
timer--;
if (timer < 0){
timer = Utils.RandBetweenInt(50, 100);
toPosX = Utils.RandBetweenFloat(100, 540);
toPosY = Utils.RandBetweenFloat(100, 300);
};
UpdateFireAtPlayer();
CycleAnimation();
UpdateEnemyStuff();
}
public function InitEnemy_BallsFromEdges(){
var _local1:Number;
var _local2:int;
EnemyUpdateFunctionCallback = UpdateEnemy_BallsFromEdges;
speed = Utils.RandBetweenFloat(objectDef.NumParamA, objectDef.NumParamB);
renderFunction = RenderNormally;
frame = 0;
frameVel = 1;
height = 0;
_local2 = int(objectDef.NumParamC);
if (_local2 == 0){
_local1 = Utils.RandBetweenFloat(0.2, 0.3);
if (Utils.RandBetweenInt(0, 1000) < 500){
xpos = -20;
ypos = Game.RandWorldY();
} else {
ypos = (0 - 20);
xpos = Game.RandWorldX();
};
} else {
if (_local2 == 1){
_local1 = Utils.RandBetweenFloat(0.6, 0.7);
if (Utils.RandBetweenInt(0, 1000) < 500){
xpos = (1000 + 20);
ypos = Game.RandWorldY();
} else {
ypos = (0 - 20);
xpos = Game.RandWorldX();
};
} else {
if (_local2 == 2){
frameVel = -1;
_local1 = Utils.RandBetweenFloat(1.3, 1.4);
if (Utils.RandBetweenInt(0, 1000) < 500){
xpos = (1000 + 20);
ypos = Game.RandWorldY();
} else {
ypos = (1000 + 20);
xpos = Game.RandWorldX();
};
} else {
if (_local2 == 3){
frameVel = -1;
_local1 = Utils.RandBetweenFloat(1.7, 1.8);
if (Utils.RandBetweenInt(0, 1000) < 500){
xpos = -20;
ypos = Game.RandWorldY();
} else {
ypos = (1000 + 20);
xpos = Game.RandWorldX();
};
};
};
};
};
movementVec.Set((Math.PI * _local1), speed);
}
public function InitEnemy_Path(){
pathSpeed = 5;
pathPos = 0;
}
function UpdateInstantBullet_RandomFlicker():void{
xpos = parentObj.xpos;
ypos = parentObj.ypos;
MakeCollisionPoly();
Collision.EnemyPointInPolyCollision(collisionPoly, this);
if (PlayAnimation()){
timer--;
if (timer < 0){
active = false;
} else {
movementVec.Set(Utils.RandCircle(), 0);
dir = movementVec.rot;
frame = 0;
};
};
}
function UpdateBullet_ShortShield():void{
xpos = (xpos + movementVec.GetXComponent());
ypos = (ypos + movementVec.GetYComponent());
timer--;
if (timer < 0){
active = false;
};
}
function UpdateInstantBullet_Spline():void{
var _local1:Number;
var _local2:Number;
var _local3:Array;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:Number;
var _local10:Number;
var _local11:Array;
var _local12:Matrix;
xpos = parentObj.xpos;
ypos = parentObj.ypos;
_local1 = (MouseControl.mousePosX + Game.scrollX);
_local2 = (MouseControl.mousePosY + Game.scrollY);
toPosX = _local1;
toPosY = _local2;
movementVec.Set((Math.atan2((toPosY - ypos), (toPosX - xpos)) + (Math.PI * 0.5)), 1);
_local3 = new Array();
_local4 = ((toPosX - xpos) / 3);
_local5 = ((toPosY - ypos) / 3);
_local6 = xpos;
_local7 = ypos;
_local3.push(new Point(_local6, _local7));
_local8 = 0;
while (_local8 < 3) {
_local6 = (_local6 + _local4);
_local7 = (_local7 + _local5);
_local3.push(new Point(_local6, _local7));
_local8++;
};
_local9 = Utils.DistBetweenPoints(xpos, ypos, toPosX, toPosY);
_local10 = (_local9 * 0.1);
_local3[1].x = (_local3[1].x + Utils.RandBetweenFloat(-(_local10), _local10));
_local3[1].y = (_local3[1].y + Utils.RandBetweenFloat(-(_local10), _local10));
_local3[2].x = (_local3[2].x + Utils.RandBetweenFloat(-(_local10), _local10));
_local3[2].y = (_local3[2].y + Utils.RandBetweenFloat(-(_local10), _local10));
_local8 = 0;
currentPoly = new Poly("", 0, _local3[_local8].x, _local3[_local8].y);
_local8++;
currentPoly.AddLine(_local3[_local8].x, _local3[_local8].y, _local3[_local8].x, _local3[_local8].y);
_local8++;
currentPoly.AddLine(_local3[_local8].x, _local3[_local8].y, _local3[_local8].x, _local3[_local8].y);
_local8++;
currentPoly.AddLine(_local3[_local8].x, _local3[_local8].y, _local3[_local8].x, _local3[_local8].y);
currentPoly.Finish(false);
_local11 = new Array();
_local12 = new Matrix();
_local12.rotate(movementVec.rot);
_local12.translate(xpos, ypos);
_local11.push(_local12.transformPoint(new Point(-30, 0)));
_local11.push(_local12.transformPoint(new Point(-30, -(_local9))));
_local11.push(_local12.transformPoint(new Point(30, -(_local9))));
_local11.push(_local12.transformPoint(new Point(30, 0)));
collisionPoly = Poly.PolyFromPointList(_local11);
Collision.EnemyPointInPolyCollision(collisionPoly, this);
timer--;
if (timer <= 0){
active = false;
};
}
public function UpdateEnemy_RotateToPlayer(){
movementVec.speed = speed;
toPosX = Game.goPlayer.xpos;
toPosY = Game.goPlayer.ypos;
RotateToRequiredRot(rotVel);
dir = movementVec.rot;
xpos = (xpos + movementVec.GetXComponent());
ypos = (ypos + movementVec.GetYComponent());
UpdateExternalVel();
UpdateBob();
}
public function UpdateEnemy9(){
xpos = (xpos + movementVec.GetXComponent());
ypos = (ypos + movementVec.GetYComponent());
UpdateExternalVel();
if (IsInWorld(64) == false){
active = false;
};
CycleAnimationEx();
}
public function InitEnemy_Missile():void{
objectDef = ObjectDefs.GetObjectDefByExportName("Missile");
radius = 120;
isEnemyMissile = true;
health = 100;
graphicID = GraphicObjects.gfx_enemy_missile;
frame = 0;
frameVel = 1;
updateFunction = UpdateEnemy_Missile;
xvel = 0;
xacc = 0.1;
controlMode = 0;
xpos = -100;
}
static function InitBullet_Ricochet(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
_arg1.bulletPlayerWeapon = _arg3;
_arg1.health = 5;
_arg1.colFlag_isBullet = true;
_arg1.updateFunction = _arg1.UpdateBullet_Ricochet;
_arg1.renderFunction = _arg1.RenderBullet;
_arg1.graphicID = _arg3.graphicID;
_arg1.parentObj = _arg2;
_arg1.frame = 0;
_arg1.frameVel = 1;
_arg1.xpos = _arg1.parentObj.xpos;
_arg1.ypos = _arg1.parentObj.ypos;
_arg1.toPosX = Game.mouseMapX;
_arg1.toPosY = Game.mouseMapY;
_arg1.movementVec.Set(Math.atan2((_arg1.toPosY - _arg1.ypos), (_arg1.toPosX - _arg1.xpos)), _arg3.GetSpeed());
_arg1.dir = 0;
_arg1.timer = 300;
_arg1.hitEnemyFunction = _arg1.UpdateBullet_Ricochet_HitEnemy;
_arg1.rotVel = Utils.RandBetweenFloat(-0.2, 0.2);
}
static function InitFatHomingBullet(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
_arg1.bulletPlayerWeapon = _arg3;
_arg1.graphicID = _arg3.graphicID;
_arg1.colFlag_isBullet = true;
_arg1.updateFunction = _arg1.UpdateFatHomingBullet;
_arg1.renderFunction = _arg1.RenderBullet;
_arg1.parentObj = _arg2;
_arg1.frame = 0;
_arg1.scale = 1;
_arg1.xpos = _arg1.parentObj.xpos;
_arg1.ypos = _arg1.parentObj.ypos;
_arg1.timer = 300;
_arg1.timer1 = 10;
_arg1.movementVec.Set(((_arg1.parentObj.dir + _arg3.GetFireAngle()) - (Math.PI * 0.5)), _arg3.GetSpeed());
}
static function InitInstantBullet_RandomFlicker(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
_arg1.bulletPlayerWeapon = _arg3;
_arg1.renderFunction = _arg1.RenderRotated;
_arg1.updateFunction = _arg1.UpdateInstantBullet_RandomFlicker;
_arg1.graphicID = _arg3.graphicID;
_arg1.parentObj = _arg2;
_arg1.frame = 0;
_arg1.frameVel = 1;
_arg1.health = 999999;
_arg1.xpos = _arg1.parentObj.xpos;
_arg1.ypos = _arg1.parentObj.ypos;
_arg1.movementVec.Set(Utils.RandCircle(), 0);
_arg1.dir = _arg1.movementVec.rot;
_arg1.timer = 5;
}
static function InitBullet_Reverse(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
_arg1.bulletPlayerWeapon = _arg3;
_arg1.colFlag_isBullet = true;
_arg1.updateFunction = _arg1.UpdateBullet_Reverse;
_arg1.renderFunction = _arg1.RenderBullet;
_arg1.graphicID = _arg3.graphicID;
_arg1.parentObj = _arg2;
_arg1.frame = 0;
_arg1.xpos = Game.mouseMapX;
_arg1.ypos = Game.mouseMapY;
_arg1.toPosX = _arg1.xpos;
_arg1.toPosY = _arg1.ypos;
_arg1.movementVec.Set(((_arg1.parentObj.dir + _arg3.GetFireAngle()) - (Math.PI * 0.5)), -(_arg3.GetSpeed()));
_arg1.dir = _arg1.parentObj.dir;
_arg1.xpos = (_arg1.xpos + (_arg1.movementVec.GetUnitXComponent() * 400));
_arg1.ypos = (_arg1.ypos + (_arg1.movementVec.GetUnitYComponent() * 400));
}
static function InitBullet_Shockwave(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
var _local4:Number;
var _local5:Number;
_arg1.bulletPlayerWeapon = _arg3;
_arg1.updateFunction = _arg1.UpdateBullet_Shockwave;
_arg1.graphicID = _arg3.graphicID;
_arg1.parentObj = _arg2;
_arg1.frame = 0;
_arg1.frameVel = 1;
_local4 = Game.mouseMapX;
_local5 = Game.mouseMapY;
_arg1.toPosX = _local4;
_arg1.toPosY = _local5;
_arg1.xpos = _arg1.parentObj.xpos;
_arg1.ypos = _arg1.parentObj.ypos;
_arg1.movementVec.Set(((_arg1.parentObj.dir + _arg3.GetFireAngle()) - (Math.PI * 0.5)), _arg3.GetSpeed());
_arg1.dir = _arg1.parentObj.dir;
_arg1.xvel = _arg1.movementVec.GetXComponent();
_arg1.yvel = _arg1.movementVec.GetYComponent();
}
static function InitBullet_SteppedSquare(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
_arg1.bulletPlayerWeapon = _arg3;
_arg1.colFlag_isBullet = true;
_arg1.updateFunction = _arg1.UpdateBullet_SteppedSquare;
_arg1.renderFunction = _arg1.RenderBullet;
_arg1.graphicID = _arg3.graphicID;
_arg1.parentObj = _arg2;
_arg1.frame = 0;
_arg1.xpos = _arg1.parentObj.xpos;
_arg1.ypos = _arg1.parentObj.ypos;
_arg1.movementVec.Set((_arg1.parentObj.dir - (Math.PI * 0.5)), 40);
_arg1.dir = _arg1.parentObj.dir;
_arg1.timer = 3;
_arg1.timer1 = 0;
_arg1.squareBullet_offCentre = 0;
}
static function InitBullet_Boomerang(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
_arg1.bulletPlayerWeapon = _arg3;
_arg1.colFlag_isBullet = true;
_arg1.updateFunction = _arg1.UpdateBullet_Boomerang;
_arg1.renderFunction = _arg1.RenderBullet;
_arg1.graphicID = _arg3.graphicID;
_arg1.parentObj = _arg2;
_arg1.frame = 0;
_arg1.xpos = _arg1.parentObj.xpos;
_arg1.ypos = _arg1.parentObj.ypos;
_arg1.movementVec.Set(((_arg1.parentObj.dir + _arg3.GetFireAngle()) - (Math.PI * 0.5)), _arg3.GetSpeed());
_arg1.dir = _arg1.parentObj.dir;
_arg1.timer = 30;
_arg1.timer1 = 200;
}
static function InitBullet_BFG(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
_arg1.bulletPlayerWeapon = _arg3;
_arg1.colFlag_UseRadius = true;
_arg1.radius = 100;
_arg1.colFlag_isBullet = true;
_arg1.updateFunction = _arg1.UpdateBullet_BFG;
_arg1.graphicID = _arg3.graphicID;
_arg1.parentObj = _arg2;
_arg1.frame = 0;
_arg1.health = 1000;
_arg1.timer = 200;
_arg1.frameVel = 0.5;
_arg1.renderFunction = _arg1.RenderNormally;
_arg1.xpos = _arg1.parentObj.xpos;
_arg1.ypos = _arg1.parentObj.ypos;
_arg1.movementVec.Set(((_arg1.parentObj.dir + _arg3.GetFireAngle()) - (Math.PI * 0.5)), _arg3.GetSpeed());
_arg1.dir = 0;
_arg1.xvel = _arg1.movementVec.GetXComponent();
_arg1.yvel = _arg1.movementVec.GetYComponent();
}
static function InitBullet_DuckOfDeath(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
_arg1.bulletPlayerWeapon = _arg3;
_arg1.health = 200;
_arg1.colFlag_isBullet = true;
_arg1.updateFunction = _arg1.UpdateBullet_DuckOfDeath;
_arg1.graphicID = _arg3.graphicID;
_arg1.parentObj = _arg2;
_arg1.frame = 0;
_arg1.frameVel = 1;
_arg1.xpos = _arg1.parentObj.xpos;
_arg1.ypos = _arg1.parentObj.ypos;
_arg1.toPosX = Game.mouseMapX;
_arg1.toPosY = Game.mouseMapY;
_arg1.movementVec.Set(Math.atan2((_arg1.toPosY - _arg1.ypos), (_arg1.toPosX - _arg1.xpos)), _arg3.GetSpeed());
_arg1.dir = 0;
_arg1.timer = 300;
}
static function InitBullet_ShortShield(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
var _local4:Number;
_arg1.bulletPlayerWeapon = _arg3;
_arg1.colFlag_isBullet = true;
_arg1.graphicID = _arg3.graphicID;
_arg1.parentObj = _arg2;
_arg1.frame = 0;
_arg1.xpos = _arg1.parentObj.xpos;
_arg1.ypos = _arg1.parentObj.ypos;
_arg1.updateFunction = _arg1.UpdateBullet_ShortShield;
_arg1.renderFunction = _arg1.RenderBullet;
_arg1.timer = Utils.RandBetweenInt(6, 6);
_local4 = Utils.RandCircle();
_arg1.movementVec.Set(_local4, Utils.RandBetweenFloat(20, 20));
_arg1.dir = (_arg1.movementVec.rot + (Math.PI * 0.5));
}
static function InitInstantBullet(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
_arg1.bulletPlayerWeapon = _arg3;
_arg1.renderFunction = _arg1.RenderRotated;
_arg1.updateFunction = _arg1.UpdateInstantBullet;
_arg1.graphicID = _arg3.graphicID;
_arg1.parentObj = _arg2;
_arg1.frame = 0;
_arg1.frameVel = 1;
_arg1.health = 999999;
_arg1.xpos = _arg1.parentObj.xpos;
_arg1.ypos = _arg1.parentObj.ypos;
_arg1.movementVec.Set((_arg1.parentObj.dir + _arg3.GetFireAngle()), 0);
_arg1.dir = _arg1.movementVec.rot;
}
static function InitBullet_Vortex(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
_arg1.bulletPlayerWeapon = _arg3;
_arg1.colFlag_isBullet = false;
_arg1.updateFunction = _arg1.UpdateBullet_Vortex;
_arg1.graphicID = _arg3.graphicID;
_arg1.parentObj = _arg2;
_arg1.frame = 0;
_arg1.frameVel = 5;
_arg1.xpos = _arg1.parentObj.xpos;
_arg1.ypos = _arg1.parentObj.ypos;
_arg1.toPosX = Game.mouseMapX;
_arg1.toPosY = Game.mouseMapY;
_arg1.movementVec.Set(Math.atan2((_arg1.toPosY - _arg1.ypos), (_arg1.toPosX - _arg1.xpos)), _arg3.GetSpeed());
_arg1.dir = 0;
_arg1.timer = 300;
_arg1.controlMode = 0;
}
static function InitBullet_BulletTime(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
_arg1.visible = false;
_arg1.bulletPlayerWeapon = _arg3;
_arg1.colFlag_isBullet = true;
_arg1.updateFunction = _arg1.UpdateBullet_BulletTime;
_arg1.timer = 200;
Game.bulletTime = 150;
}
static function InitHomingBullet(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
_arg1.bulletPlayerWeapon = _arg3;
_arg1.graphicID = _arg3.graphicID;
_arg1.colFlag_isBullet = true;
_arg1.updateFunction = _arg1.UpdateHomingBullet;
_arg1.renderFunction = _arg1.RenderBullet;
_arg1.parentObj = _arg2;
_arg1.frame = 0;
_arg1.scale = 1;
_arg1.xpos = _arg1.parentObj.xpos;
_arg1.ypos = _arg1.parentObj.ypos;
_arg1.timer = 300;
_arg1.timer1 = 10;
_arg1.movementVec.Set(((_arg1.parentObj.dir + _arg3.GetFireAngle()) - (Math.PI * 0.5)), _arg3.GetSpeed());
}
static function InitBullet_Spiral(_arg1:GameObj, _arg2:GameObj, _arg3:PlayerWeapon):void{
_arg1.bulletPlayerWeapon = _arg3;
_arg1.colFlag_isBullet = true;
_arg1.updateFunction = _arg1.UpdateBullet_Spiral;
_arg1.renderFunction = _arg1.RenderBullet;
_arg1.graphicID = _arg3.graphicID;
_arg1.parentObj = _arg2;
_arg1.frame = 0;
_arg1.xpos = _arg1.parentObj.xpos;
_arg1.ypos = _arg1.parentObj.ypos;
_arg1.dir = _arg1.parentObj.dir;
_arg1.xvel = _arg1.movementVec.GetXComponent();
_arg1.yvel = _arg1.movementVec.GetYComponent();
_arg1.rotVel = _arg3.angle;
_arg1.speed = 4;
_arg1.yacc = 0;
_arg1.xacc = (_arg1.parentObj.dir - (Math.PI * 0.5));
_arg1.startx = _arg1.xpos;
_arg1.starty = _arg1.ypos;
_arg1.timer = 10;
}
}
}//package
Section 36
//GameObjects (GameObjects)
package {
import flash.events.*;
class GameObjects {
public static var numobjs;
static var m:Main;
public static var dummyObj:GameObj;
public static var objs1:Array;
public static var objs2:Array;
public static var objs:Array;
public function GameObjGroup(){
}
public static function Update():void{
var _local1:Boolean;
var _local2:int;
var _local3:GameObj;
_local1 = !((Game.bulletTime == 0));
_local2 = 0;
while (_local2 < objs.length) {
_local3 = objs[_local2];
if (_local3.active){
_local3.Update();
if (!_local1){
if (((_local3.active) && (_local3.usesBulletTime))){
_local3.Update();
};
};
};
_local2++;
};
}
public static function Render():void{
var _local1:GameObj;
var _local2:Array;
_local2 = new Array();
for each (_local1 in objs) {
if (((_local1.active) && (_local1.visible))){
_local2.push(_local1);
};
};
_local2.sortOn("zpos2", (Array.NUMERIC | Array.DESCENDING));
for each (_local1 in _local2) {
if (_local1.hasShadow){
_local1.RenderShadow();
};
};
for each (_local1 in _local2) {
_local1.Render();
};
}
public static function ForEachActive(_arg1:Function):void{
var _local2:GameObj;
var _local3:Array;
_local3 = new Array();
for each (_local2 in objs) {
if (_local2.active){
_arg1(_local2);
};
};
}
public static function InitOnce(_arg1:Main, _arg2:int){
var _local3:*;
numobjs = _arg2;
m = _arg1;
objs = new Array();
_local3 = 0;
while (_local3 < numobjs) {
objs.push(new GameObj(m, 0, 0, _local3));
_local3++;
};
dummyObj = new GameObj(m, 0, 0, 0);
}
public static function ClearAll(){
var _local1:int;
_local1 = 0;
while (_local1 < numobjs) {
objs[_local1].active = false;
_local1++;
};
}
public static function AddObj(_arg1:Number, _arg2:Number, _arg3:Number):GameObj{
var _local4:int;
var _local5:GameObj;
_local4 = 0;
while (_local4 < numobjs) {
if (objs[_local4].active == false){
_local5 = objs[_local4];
_local5.active = true;
_local5.zpos = _arg3;
_local5.xpos = _arg1;
_local5.ypos = _arg2;
_local5.startx = _arg1;
_local5.starty = _arg2;
_local5.startz = _arg3;
_local5.Init(0);
return (objs[_local4]);
};
_local4++;
};
trace("ERROR! NO FREE OBJECTS");
return (dummyObj);
}
public static function CountActiveObjects():int{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = 0;
while (_local2 < objs.length) {
if (objs[_local2].active == true){
_local1++;
};
_local2++;
};
return (_local1);
}
}
}//package
Section 37
//GameOverScreen (GameOverScreen)
package {
import flash.display.*;
public dynamic class GameOverScreen extends MovieClip {
public var buttonGamesLunatic:MovieClip;
public var buttonOK:SimpleButton;
}
}//package
Section 38
//GamesLunaticIntro (GamesLunaticIntro)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.filters.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.xml.*;
public dynamic class GamesLunaticIntro extends MovieClip {
public var mc_spiral1:MovieClip;
public var mc_spiral:MovieClip;
public function GamesLunaticIntro(){
addFrameScript(0, frame1, 135, frame136, 136, frame137);
}
public function updateFunc(_arg1:Event){
mc_spiral.m_gr.rotation = (mc_spiral.m_gr.rotation + 70);
mc_spiral1.m_gr.rotation = (mc_spiral1.m_gr.rotation + 70);
}
function frame1(){
addEventListener(Event.ENTER_FRAME, updateFunc);
}
function frame136(){
removeEventListener(Event.ENTER_FRAME, updateFunc);
}
function frame137(){
stop();
TitleScreenState.GamesLunaticIntroMovieFinished();
}
}
}//package
Section 39
//GraphicObjects (GraphicObjects)
package {
import flash.display.*;
import flash.text.*;
import flash.geom.*;
import flash.utils.*;
public class GraphicObjects {
public static const gfx_bg_farbackground = 100;
public static const gfx_playerjump = 14;
public static const gfx_enemy_shadowcopter = 29;
public static const gfx_enemy_landmine = 23;
public static const gfx_enemy_jetpackrobotred = 24;
public static const gfx_particle1 = 180;
public static const gfx_particle2 = 181;
public static const gfx_particle3 = 182;
public static const gfx_particle4 = 183;
public static const gfx_enemy_missile = 28;
public static const gfx_enemy_jetpackrobotblue = 25;
public static const gfx_bg_grass2 = 106;
public static const gfx_explosion1 = 54;
public static const gfx_explosion2 = 55;
public static const gfx_enemy_bouncingbomb = 20;
public static const gfx_bg_grass1 = 105;
public static const gfx_bg_grass = 104;
public static const gfx_playerflip = 12;
public static const gfx_playerfall = 13;
public static const gfx_font1 = 190;
public static const gfx_font2 = 191;
public static const gfx_font3 = 192;
public static const gfx_enemy_cannonbullet1 = 21;
public static const gfx_enemy_cannonbullet2 = 22;
public static const gfx_enemy_bullet = 26;
public static const gfx_bg_clouds1 = 102;
public static const gfx_playerslide = 15;
public static const gfx_cannonfiring = 52;
public static const gfx_playerdie = 16;
public static const gfx_enemy_copter = 27;
public static const gfx_trail = 56;
public static const gfx_fontblack = 193;
public static const gfx_playerrun = 11;
public static const gfx_playerstand = 10;
public static const gfx_bg_clouds = 101;
public static const gfx_overheat_meter = 81;
public static const gfx_battlecopter = 50;
public static const gfx_cursor = 51;
public static const gfx_cannonnotfiring = 53;
public static const gfx_enemy_bosscopter = 30;
public static const gfx_bg_overlay = 107;
public static const gfx_health_meter = 82;
public static const gfx_overlay_warning = 80;
public static const gfx_bg_moon = 103;
static var count:int;
public static var stringCharBitmap:Bitmap;
public static var stringCharY:Number;
public static var stringCharX:Number;
static var graphicobjs:Array;
static var idList:Array;
static var totalFramesToDo:int = 1000;
static var totalFramesDone:int = 0;
static var main:Main;
static var nameList:Array;
static var everythingDone:Boolean = false;
public static function RenderStringAt(_arg1:BitmapData, _arg2:int, _arg3:Number, _arg4:Number, _arg5:String, _arg6:int=0){
var _local7:int;
var _local8:int;
stringCharX = _arg3;
stringCharY = _arg4;
_local7 = 0;
while (_local7 < _arg5.length) {
_local8 = int(_arg5.charCodeAt(_local7));
if (_local8 < 0){
_local8 = 0;
};
if (_local8 > 127){
_local8 = 127;
};
RenderAt(_arg2, _local8, _arg1, stringCharX, stringCharY);
stringCharBitmap = GetBitmap(_arg2, _local8);
stringCharX = (stringCharX + stringCharBitmap.width);
stringCharX = (stringCharX + _arg6);
_local7++;
};
}
public static function GetXoffset(_arg1:int, _arg2:int):int{
var _local3:int;
_local3 = idList[_arg1];
return (graphicobjs[_local3].frames[_arg2].xoffsets[0]);
}
public static function GetBitmap(_arg1:int, _arg2:int):Bitmap{
var _local3:int;
_local3 = idList[_arg1];
return (graphicobjs[_local3].frames[_arg2].bitmaps[0]);
}
public static function RenderAtSplit(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number){
var _local6:int;
_local6 = idList[_arg1];
graphicobjs[_local6].frames[_arg2].RenderAtSplit(_arg3, _arg4, _arg5);
}
public static function RenderNumberAt(_arg1:BitmapData, _arg2:int, _arg3:Number, _arg4:Number, _arg5:int){
var _local6:Array;
var _local7:int;
var _local8:int;
var _local9:Boolean;
var _local10:int;
var _local11:int;
var _local12:Bitmap;
_local6 = new Array();
_local7 = _arg5;
_local8 = 0;
while (_local8 < 11) {
_local10 = (_local7 % 10);
_local6.push(_local10);
_local7 = (_local7 / 10);
_local8++;
};
_local9 = false;
_local8 = (_local6.length - 1);
while (_local8--) {
_local11 = _local6[_local8];
if ((((_local9 == false)) && (!((_local11 == 0))))){
_local9 = true;
};
if (_local9){
RenderAt(_arg2, (_local11 + 48), _arg1, _arg3, _arg4);
_local12 = GetBitmap(_arg2, (_local11 + 48));
_arg3 = (_arg3 + _local12.width);
};
(_local8 >= 0);
};
return (_arg3);
}
public static function GetWidth(_arg1:int, _arg2:int):int{
var _local3:int;
_local3 = idList[_arg1];
return (graphicobjs[_local3].frames[_arg2].bitmaps[0].width);
}
public static function GetYoffset(_arg1:int, _arg2:int):int{
var _local3:int;
_local3 = idList[_arg1];
return (graphicobjs[_local3].frames[_arg2].yoffsets[0]);
}
public static function RenderAtAlpha(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Number){
var _local7:int;
_local7 = idList[_arg1];
graphicobjs[_local7].frames[_arg2].RenderAtAlpha(_arg3, _arg4, _arg5, _arg6);
}
public static function GetNumFrames(_arg1:int):int{
var _local2:int;
_local2 = idList[_arg1];
return (graphicobjs[_local2].frames.length);
}
public static function GetIdFromName(_arg1:String):int{
var _local2:int;
var _local3:String;
_local2 = 0;
while (_local2 < nameList.length) {
_local3 = nameList[_local2];
if (_local3 == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
}
public static function AddFont(_arg1:int, _arg2:TextFormat):void{
var _local3:DisplayObj;
_local3 = new DisplayObj(null, 0, 0);
_local3.CreateFont(_arg2);
idList[_arg1] = count;
graphicobjs.push(_local3);
count++;
}
public static function RenderAtAdditive(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Number){
var _local7:int;
_local7 = idList[_arg1];
graphicobjs[_local7].frames[_arg2].RenderAtAdditive(_arg3, _arg4, _arg5, _arg6);
}
public static function UpdateOncePerFrame():Boolean{
var _local1:DisplayObj;
var _local2:int;
var _local3:int;
return (true);
everythingDone = true;
return (true);
}
public static function Add(_arg1:int, _arg2:DisplayObj, _arg3:String=""):void{
idList[_arg1] = count;
nameList[_arg1] = _arg3;
graphicobjs.push(_arg2);
count++;
}
public static function RenderAt(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Boolean=false){
var _local7:int;
_local7 = idList[_arg1];
graphicobjs[_local7].frames[_arg2].RenderAt(_arg3, _arg4, _arg5, _arg6);
}
public static function RenderAtRot(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean){
var _local8:int;
_local8 = idList[_arg1];
if (_arg7){
graphicobjs[_local8].frames[_arg2].RenderAtRotBurned(_arg3, _arg4, _arg5, _arg6);
} else {
graphicobjs[_local8].frames[_arg2].RenderAtRot(_arg3, _arg4, _arg5, _arg6);
};
}
public static function RenderAtFunction(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:String){
var _local8:int;
_local8 = idList[_arg1];
graphicobjs[_local8].frames[_arg2].RenderAtFunction(_arg3, _arg4, _arg5, _arg6, _arg7);
}
public static function RenderAtRotScaled(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Boolean=false, _arg7:Number=1, _arg8:Number=0){
var _local9:int;
_local9 = idList[_arg1];
graphicobjs[_local9].frames[_arg2].RenderAtRotScaled(_arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
}
public static function RenderAtRotScaledColTrans(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Boolean=false, _arg7:Number=1, _arg8:Number=0, _arg9:ColorTransform=null){
var _local10:int;
_local10 = idList[_arg1];
graphicobjs[_local10].frames[_arg2].RenderAtRotScaledColTrans(_arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9);
}
public static function RenderAtScaled(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Boolean=false, _arg7:Number=1){
var _local8:int;
_local8 = idList[_arg1];
graphicobjs[_local8].frames[_arg2].RenderAtScaled(_arg3, _arg4, _arg5, _arg6, _arg7);
}
public static function InitOnce(_arg1:Main):void{
main = _arg1;
graphicobjs = new Array();
idList = new Array(200);
nameList = new Array(200);
count = 0;
totalFramesDone = 0;
AddFont(gfx_font1, main.tf_scorespr);
AddFont(gfx_fontblack, main.tf_scoresprblack);
Add(gfx_bg_farbackground, new DisplayObj(new FarBackground(), 1, 0, true));
Add(gfx_bg_clouds, new DisplayObj(new Clouds(), 1, 0, true));
Add(gfx_bg_clouds1, new DisplayObj(new Clouds1(), 1, 0, true));
Add(gfx_bg_grass, new DisplayObj(new Grass(), 1, 0, true));
Add(gfx_bg_grass1, new DisplayObj(new Grass1(), 1, 0, true));
Add(gfx_bg_grass2, new DisplayObj(new Grass2(), 1, 0, true));
Add(gfx_bg_moon, new DisplayObj(new Moon(), 1, 0, true));
Add(gfx_bg_overlay, new DisplayObj(new Overlay(), 1, 0, true));
Add(gfx_playerstand, new DisplayObj(new PlayerStand(), 1, 0, true));
Add(gfx_playerrun, new DisplayObj(new PlayerRun(), 1, 0, true));
Add(gfx_playerflip, new DisplayObj(new PlayerFlip(), 1, 0, true));
Add(gfx_playerfall, new DisplayObj(new PlayerFall(), 1, 0, true));
Add(gfx_playerjump, new DisplayObj(new PlayerJump(), 1, 0, true));
Add(gfx_playerslide, new DisplayObj(new PlayerSlide(), 1, 0, true));
Add(gfx_playerdie, new DisplayObj(new PlayerDie(), 1, 0, true));
Add(gfx_battlecopter, new DisplayObj(new BattleCopter(), 1, 0, true));
Add(gfx_cursor, new DisplayObj(new Cursor(), 1, 0, true));
Add(gfx_cannonfiring, new DisplayObj(new CannonFiring(), 1, 0, true));
Add(gfx_cannonnotfiring, new DisplayObj(new CannonNotFiring(), 1, 5, true));
Add(gfx_explosion1, new DisplayObj(new Explosion1(), 1, 0, true));
Add(gfx_explosion2, new DisplayObj(new Explosion2(), 1, 0, true));
Add(gfx_trail, new DisplayObj(new Trail(), 1, 0, true));
Add(gfx_overlay_warning, new DisplayObj(new WarningOverlay(), 1, 0, true));
Add(gfx_health_meter, new DisplayObj(new HealthMeter(), 1, 0, true));
Add(gfx_overheat_meter, new DisplayObj(new OverheatMeter(), 1, 0, true));
Add(gfx_enemy_bouncingbomb, new DisplayObj(new BouncingBomb(), 1, 0, true));
Add(gfx_enemy_cannonbullet1, new DisplayObj(new CannonBullet1(), 1, 0, true));
Add(gfx_enemy_cannonbullet2, new DisplayObj(new CannonBullet2(), 1, 0, true));
Add(gfx_enemy_landmine, new DisplayObj(new LandMine(), 1, 0, true));
Add(gfx_enemy_jetpackrobotred, new DisplayObj(new JetpackRobotRed(), 1, 0, true));
Add(gfx_enemy_jetpackrobotblue, new DisplayObj(new JetpackRobotBlue(), 1, 0, true));
Add(gfx_enemy_bullet, new DisplayObj(new EnemyBullet(), 1, 0, true));
Add(gfx_enemy_copter, new DisplayObj(new EnemyCopter(), 1, 0, true));
Add(gfx_enemy_missile, new DisplayObj(new EnemyMissile(), 1, 0, true));
Add(gfx_enemy_shadowcopter, new DisplayObj(new ShadowCopter(), 1, 0, true));
Add(gfx_enemy_bosscopter, new DisplayObj(new Bosscopter(), 1, 5, true));
CaclulateTotalFrames();
}
public static function RenderAtColTrans(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Boolean=false, _arg7:ColorTransform=null, _arg8:String=null){
var _local9:int;
_local9 = idList[_arg1];
graphicobjs[_local9].frames[_arg2].RenderAtColTrans(_arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
}
public static function CaclulateTotalFrames(){
var _local1:int;
var _local2:DisplayObj;
_local1 = 0;
for each (_local2 in graphicobjs) {
if (_local2.mc != null){
_local1 = (_local1 + _local2.mc.totalFrames);
};
};
totalFramesToDo = _local1;
}
public static function GetPixelAt(_arg1:int, _arg2:int, _arg3:int, _arg4:int):uint{
var _local5:int;
var _local6:Bitmap;
var _local7:uint;
_local5 = idList[_arg1];
_local6 = graphicobjs[_local5].frames[_arg2].bitmaps[0];
_local7 = _local6.bitmapData.getPixel32(_arg3, _arg4);
return (_local7);
}
public static function CompleteBitmapCreation(){
var _local1:DisplayObj;
if (everythingDone){
return (true);
};
for each (_local1 in graphicobjs) {
if (_local1.ready == false){
if (_local1.mc != null){
_local1.CreateBitmapsFromMovieClip(_local1.mc, _local1.flags);
_local1.mc = null;
_local1.ready = true;
};
};
};
everythingDone = true;
}
public static function GetHeight(_arg1:int, _arg2:int):int{
var _local3:int;
_local3 = idList[_arg1];
return (graphicobjs[_local3].frames[_arg2].bitmaps[0].height);
}
}
}//package
Section 40
//Grass (Grass)
package {
import flash.display.*;
public dynamic class Grass extends MovieClip {
}
}//package
Section 41
//Grass1 (Grass1)
package {
import flash.display.*;
public dynamic class Grass1 extends MovieClip {
}
}//package
Section 42
//Grass2 (Grass2)
package {
import flash.display.*;
public dynamic class Grass2 extends MovieClip {
}
}//package
Section 43
//HealthMeter (HealthMeter)
package {
import flash.display.*;
public dynamic class HealthMeter extends MovieClip {
}
}//package
Section 44
//InstructionsScreen (InstructionsScreen)
package {
import flash.display.*;
public dynamic class InstructionsScreen extends MovieClip {
public var buttonOK:SimpleButton;
}
}//package
Section 45
//IntroMovie (IntroMovie)
package {
import flash.display.*;
public dynamic class IntroMovie extends MovieClip {
public function IntroMovie(){
addFrameScript(230, frame231);
}
function frame231(){
stop();
TitleScreenState.IntroMovieFinished();
}
}
}//package
Section 46
//JetpackRobotBlue (JetpackRobotBlue)
package {
import flash.display.*;
public dynamic class JetpackRobotBlue extends MovieClip {
}
}//package
Section 47
//JetpackRobotRed (JetpackRobotRed)
package {
import flash.display.*;
public dynamic class JetpackRobotRed extends MovieClip {
}
}//package
Section 48
//KeyReader (KeyReader)
package {
import flash.events.*;
import flash.display.*;
public class KeyReader {
static const KEY_LEFT = 37;
static const KEY_UP = 38;
static const KEY_DOWN = 40;
static const KEY_3 = 51;
static const KEY_5 = 53;
static const KEY_7 = 55;
static const KEY_1 = 49;
static const KEY_2 = 50;
static const KEY_4 = 52;
static const KEY_6 = 54;
static const KEY_8 = 56;
static const KEY_9 = 57;
static const KEY_A = 65;
static const KEY_B = 66;
static const KEY_C = 67;
static const KEY_E = 69;
static const KEY_F = 70;
static const KEY_G = 71;
static const KEY_H = 72;
static const KEY_I = 73;
static const KEY_J = 74;
static const KEY_D = 68;
static const KEY_M = 77;
static const KEY_N = 78;
static const KEY_O = 79;
static const KEY_P = 80;
static const KEY_Q = 81;
static const KEY_R = 82;
static const KEY_L = 76;
static const KEY_T = 84;
static const KEY_U = 85;
static const KEY_V = 86;
static const KEY_W = 87;
static const KEY_X = 88;
static const KEY_Y = 89;
static const KEY_K = 75;
static const KEY_0 = 58;
static const KEY_Z = 90;
static const KEY_S = 83;
static const KEY_SPACE = 32;
static const KEY_RIGHT = 39;
static var keysPressed:Array;
static var keysDown:Array;
public static function Pressed(_arg1:int):Boolean{
return (keysPressed[_arg1]);
}
public static function Reset(){
var _local1:int;
_local1 = 0;
while (_local1 < 0x0100) {
keysDown[_local1] = int(0);
keysPressed[_local1] = Boolean(false);
_local1++;
};
}
static function keyUpListener(_arg1:KeyboardEvent):void{
var _local2:int;
_local2 = _arg1.keyCode;
keysDown[_local2] = 0;
}
public static function Down(_arg1:int):Boolean{
return (!((keysDown[_arg1] == 0)));
}
static function keyDownListener(_arg1:KeyboardEvent):void{
var _local2:int;
_local2 = _arg1.keyCode;
var _local3 = keysDown;
var _local4 = _local2;
var _local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
}
public static function UpdateOncePerFrame():void{
var _local1:int;
_local1 = 0;
while (_local1 < 0x0100) {
if (keysDown[_local1] == 1){
keysPressed[_local1] = true;
var _local2 = keysDown;
var _local3 = _local1;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
} else {
keysPressed[_local1] = false;
};
_local1++;
};
}
public static function InitOnce(_arg1:Stage){
var _local2:int;
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, keyDownListener);
_arg1.addEventListener(KeyboardEvent.KEY_UP, keyUpListener);
_arg1.focus = _arg1;
keysDown = new Array(0x0100);
keysPressed = new Array(0x0100);
_local2 = 0;
while (_local2 < 0x0100) {
keysDown[_local2] = int(0);
keysPressed[_local2] = Boolean(false);
_local2++;
};
}
}
}//package
Section 49
//LandMine (LandMine)
package {
import flash.display.*;
public dynamic class LandMine extends MovieClip {
}
}//package
Section 50
//Level (Level)
package {
public class Level {
public var numKillsNeeded:int;
public var backgroundID:int;
public var name:String;
public var numKills:int;
public var maxEnemiesActive:int;
public function Level(){
numKillsNeeded = 100;
numKills = 0;
name = "";
maxEnemiesActive = 50;
backgroundID = -1;
}
}
}//package
Section 51
//LevelDef_Level1 (LevelDef_Level1)
package {
public class LevelDef_Level1 {
public static function Init(){
SetupScript.LineStart("l_loop", 1, 15, 0, "Path", "", "", "");
SetupScript.LineAdd(136, 72, 0);
SetupScript.LineAdd(244, 112, 0);
SetupScript.LineAdd(299, 106, 0);
SetupScript.LineAdd(350, 87, 0);
SetupScript.LineAdd(357, 44, 0);
SetupScript.LineAdd(339, 8, 0);
SetupScript.LineAdd(0x0101, 2, 0);
SetupScript.LineAdd(213, 23, 0);
SetupScript.LineAdd(150, 61, 0);
SetupScript.LineAdd(77, 113, 0);
SetupScript.LineAdd(-57, 148, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("l_j", 7, 281, 0, "Path", "", "", "");
SetupScript.LineAdd(43, 287, 0);
SetupScript.LineAdd(94, 322, 0);
SetupScript.LineAdd(152, 346, 0);
SetupScript.LineAdd(208, 337, 0);
SetupScript.LineAdd(224, 313, 0);
SetupScript.LineAdd(226, 259, 0);
SetupScript.LineAdd(226, 175, 0);
SetupScript.LineAdd(220, -228, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("t_straight", 15, 413, 0, "Path", "", "", "");
SetupScript.LineAdd(15, 581, 0);
SetupScript.LineAdd(15, 815, 0);
SetupScript.LineAdd(15, 1147, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("t_zigzag0", 117, 409, 0, "Path", "", "", "");
SetupScript.LineAdd(197, 500, 0);
SetupScript.LineAdd(67, 577, 0);
SetupScript.LineAdd(192, 670, 0);
SetupScript.LineAdd(81, 793, 0);
SetupScript.LineAdd(193, 887, 0);
SetupScript.LineAdd(94, 1001, 0);
SetupScript.LineAdd(184, 1147, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("t_tooth0", 304, 409, 0, "Path", "", "", "");
SetupScript.LineAdd(340, 524, 0);
SetupScript.LineAdd(283, 490, 0);
SetupScript.LineAdd(285, 659, 0);
SetupScript.LineAdd(344, 598, 0);
SetupScript.LineAdd(346, 781, 0);
SetupScript.LineAdd(285, 744, 0);
SetupScript.LineAdd(272, 912, 0);
SetupScript.LineAdd(330, 868, 0);
SetupScript.LineAdd(327, 1033, 0);
SetupScript.LineAdd(267, 1000, 0);
SetupScript.LineAdd(262, 1151, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("t_zigzag1", 444, 408, 0, "Path", "", "", "");
SetupScript.LineAdd(598, 476, 0);
SetupScript.LineAdd(417, 566, 0);
SetupScript.LineAdd(622, 641, 0);
SetupScript.LineAdd(405, 690, 0);
SetupScript.LineAdd(610, 754, 0);
SetupScript.LineAdd(384, 846, 0);
SetupScript.LineAdd(618, 910, 0);
SetupScript.LineAdd(391, 997, 0);
SetupScript.LineAdd(599, 1075, 0);
SetupScript.LineAdd(401, 1156, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("t_loops0", 755, 405, 0, "Path", "", "", "");
SetupScript.LineAdd(753, 562, 0);
SetupScript.LineAdd(759, 609, 0);
SetupScript.LineAdd(783, 610, 0);
SetupScript.LineAdd(824, 572, 0);
SetupScript.LineAdd(806, 543, 0);
SetupScript.LineAdd(739, 578, 0);
SetupScript.LineAdd(742, 697, 0);
SetupScript.LineAdd(0x0303, 765, 0);
SetupScript.LineAdd(812, 752, 0);
SetupScript.LineAdd(812, 710, 0);
SetupScript.LineAdd(777, 702, 0);
SetupScript.LineAdd(747, 774, 0);
SetupScript.LineAdd(750, 880, 0);
SetupScript.LineAdd(798, 889, 0);
SetupScript.LineAdd(807, 858, 0);
SetupScript.LineAdd(770, 845, 0);
SetupScript.LineAdd(752, 892, 0);
SetupScript.LineAdd(749, 957, 0);
SetupScript.LineAdd(762, 1005, 0);
SetupScript.LineAdd(801, 1010, 0);
SetupScript.LineAdd(816, 977, 0);
SetupScript.LineAdd(785, 953, 0);
SetupScript.LineAdd(744, 988, 0);
SetupScript.LineAdd(744, 1060, 0);
SetupScript.LineAdd(745, 1168, 0);
SetupScript.LineAdd(750, 1204, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("l_across1", 341, -63, 0, "Path", "", "", "");
SetupScript.LineAdd(422, -50, 0);
SetupScript.LineAdd(492, -61, 0);
SetupScript.LineAdd(561, -52, 0);
SetupScript.LineAdd(632, -62, 0);
SetupScript.LineAdd(693, -53, 0);
SetupScript.LineAdd(765, -66, 0);
SetupScript.LineAdd(819, -52, 0);
SetupScript.LineAdd(883, -71, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("l_across0", 329, -168, 0, "Path", "", "", "");
SetupScript.LineAdd(497, -172, 0);
SetupScript.LineAdd(698, -173, 0);
SetupScript.LineAdd(917, -176, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("l_across2", 399, 30, 0, "Path", "", "", "");
SetupScript.LineAdd(475, 13, 0);
SetupScript.LineAdd(497, 56, 0);
SetupScript.LineAdd(607, 8, 0);
SetupScript.LineAdd(633, 47, 0);
SetupScript.LineAdd(682, 26, 0);
SetupScript.LineAdd(744, 48, 0);
SetupScript.LineAdd(817, -7, 0);
SetupScript.LineAdd(891, 56, 0);
SetupScript.LineAdd(925, 42, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("l_across_d0", 403, 165, 0, "Path", "", "", "");
SetupScript.LineAdd(520, 191, 0);
SetupScript.LineAdd(684, 229, 0);
SetupScript.LineAdd(845, 266, 0);
SetupScript.LineAdd(953, 287, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("l_across_d1", 1004, -176, 0, "Path", "", "", "");
SetupScript.LineAdd(1160, -110, 0);
SetupScript.LineAdd(1271, -54, 0);
SetupScript.LineAdd(1397, 1, 0);
SetupScript.LineAdd(1507, 51, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("l_across_u0", 1026, 235, 0, "Path", "", "", "");
SetupScript.LineAdd(1192, 218, 0);
SetupScript.LineAdd(1354, 188, 0);
SetupScript.LineAdd(1496, 161, 0);
SetupScript.LineAdd(1594, 133, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("l_across_u1", 1038, 432, 0, "Path", "", "", "");
SetupScript.LineAdd(1189, 361, 0);
SetupScript.LineAdd(1338, 282, 0);
SetupScript.LineAdd(1474, 204, 0);
SetupScript.LineAdd(1614, 119, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("l_u0", 1748, -121, 0, "Path", "", "", "");
SetupScript.LineAdd(1778.947, -123.5445, 0);
SetupScript.LineAdd(1800, -115, 0);
SetupScript.LineAdd(1821, -52, 0);
SetupScript.LineAdd(1823.765, 100.9681, 0);
SetupScript.LineAdd(1827, 280, 0);
SetupScript.LineAdd(1928, 349, 0);
SetupScript.LineAdd(2020, 352, 0);
SetupScript.LineAdd(2097, 299, 0);
SetupScript.LineAdd(2124, 194, 0);
SetupScript.LineAdd(2124, 42, 0);
SetupScript.LineAdd(2128, -38, 0);
SetupScript.LineAdd(2167, -97, 0);
SetupScript.LineAdd(2456, -112, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("l_u1", 1750, -28, 0, "Path", "", "", "");
SetupScript.LineAdd(1782, -30, 0);
SetupScript.LineAdd(1809, 1, 0);
SetupScript.LineAdd(1836, 105, 0);
SetupScript.LineAdd(1889, 242, 0);
SetupScript.LineAdd(1976, 277, 0);
SetupScript.LineAdd(2054, 246, 0);
SetupScript.LineAdd(2096, 151, 0);
SetupScript.LineAdd(2135, 12, 0);
SetupScript.LineAdd(2169, -42, 0);
SetupScript.LineAdd(2219, -56, 0);
SetupScript.LineAdd(2295, -60, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("b_up0", 1031, 1245, 0, "Path", "", "", "");
SetupScript.LineAdd(0x0400, 880, 0);
SetupScript.LineAdd(1025, 559, 0);
SetupScript.LineAdd(1027, 516, 0);
SetupScript.LineAdd(0x0404, 481, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("b_up1", 1144, 1245, 0, "Path", "", "", "");
SetupScript.LineAdd(1144.986, 1102, 0);
SetupScript.LineAdd(1146, 955, 0);
SetupScript.LineAdd(1234, 887, 0);
SetupScript.LineAdd(1339, 887, 0);
SetupScript.LineAdd(1421, 825, 0);
SetupScript.LineAdd(1424.163, 680.0254, 0);
SetupScript.LineAdd(1427, 550, 0);
SetupScript.LineEnd(false);
SetupScript.LineStart("b_up_n0", 0x0600, 1240, 0, "Path", "", "", "");
SetupScript.LineAdd(1539.785, 1134.028, 0);
SetupScript.LineAdd(1545.748, 967.0624, 0);
SetupScript.LineAdd(1551, 820, 0);
SetupScript.LineAdd(1639, 752, 0);
SetupScript.LineAdd(1745, 751, 0);
SetupScript.LineAdd(1819, 805, 0);
SetupScript.LineAdd(1826.831, 970.1029, 0);
SetupScript.LineAdd(1836.167, 1166.945, 0);
SetupScript.LineAdd(1843, 1311, 0);
SetupScript.LineEnd(false);
}
}
}//package
Section 52
//LevelDef1 (LevelDef1)
package {
public class LevelDef1 {
static var main:Main;
public static function Init(_arg1:Main){
var _local2:GameObj;
main = _arg1;
LevelDef_Level1.Init();
}
}
}//package
Section 53
//Licensors (Licensors)
package {
import flash.display.*;
public class Licensors {
public static const LICENSOR_BIGFISH = 6;
public static const LICENSOR_SIKIDS = 12;
public static const LICENSOR_SHOCKWAVE = 11;
public static const LICENSOR_ANDKON = 5;
public static const LICENSOR_KING = 10;
public static const LICENSOR_KONGREGATE = 1;
public static const LICENSOR_MINDJOLT = 4;
public static const LICENSOR_ARMORGAMES = 8;
public static const LICENSOR_GAMESLUNATIC_VIRAL = 14;
public static const LICENSOR_MINICLIP = 2;
public static const LICENSOR_DOOF = 3;
public static const LICENSOR_BUBBLEBOX = 7;
public static const LICENSOR_GAMEZHERO = 9;
public static const LICENSOR_GAMESLUNATIC_LOCKED = 13;
public static const LICENSOR_NONE = 0;
public static var sikids_nid:int;
public static var sikids_sid:int;
static var licensor:int = 14;
public static function InitOnce(_arg1:Main):void{
var _local2:Object;
if (licensor == LICENSOR_SIKIDS){
_local2 = LoaderInfo(_arg1.root.loaderInfo).parameters;
sikids_sid = _local2.sid;
sikids_nid = _local2.nid;
};
if (licensor == LICENSOR_KING){
};
if (licensor == LICENSOR_MINDJOLT){
};
}
public static function GetLicensor():int{
return (licensor);
}
public static function GetHighScoreType():int{
return (0);
}
public static function CanUseMochiAds():Boolean{
if (licensor == LICENSOR_NONE){
return (true);
};
if (licensor == LICENSOR_KONGREGATE){
return (true);
};
if (licensor == LICENSOR_MINICLIP){
return (false);
};
if (licensor == LICENSOR_DOOF){
return (false);
};
if (licensor == LICENSOR_MINDJOLT){
return (true);
};
if (licensor == LICENSOR_ANDKON){
return (false);
};
if (licensor == LICENSOR_BIGFISH){
return (false);
};
if (licensor == LICENSOR_ARMORGAMES){
return (false);
};
if (licensor == LICENSOR_GAMEZHERO){
return (false);
};
if (licensor == LICENSOR_KING){
return (false);
};
if (licensor == LICENSOR_SHOCKWAVE){
return (false);
};
return (true);
}
public static function IsHosted():Boolean{
if (licensor == LICENSOR_NONE){
return (false);
};
if (licensor == LICENSOR_ANDKON){
return (true);
};
if (licensor == LICENSOR_BIGFISH){
return (true);
};
if (licensor == LICENSOR_KONGREGATE){
if (SiteLock.GetDomain() == "kongregate.com"){
return (true);
};
return (false);
};
if (licensor == LICENSOR_MINICLIP){
if (SiteLock.GetDomain() == "miniclip.com"){
return (true);
};
return (false);
};
if (licensor == LICENSOR_DOOF){
if (SiteLock.GetDomain() == "doof.com"){
return (true);
};
return (false);
};
if (licensor == LICENSOR_MINDJOLT){
return (false);
};
return (false);
}
public static function SetLicensor(_arg1:int):void{
licensor = _arg1;
}
public static function IsAtKongregate():Boolean{
if (licensor != LICENSOR_KONGREGATE){
return (false);
};
if (SiteLock.GetDomain() == "kongregate.com"){
return (true);
};
return (false);
}
public static function CanUseMochiBot():Boolean{
if (licensor == LICENSOR_ARMORGAMES){
return (false);
};
if (licensor == LICENSOR_SHOCKWAVE){
return (false);
};
return (true);
}
}
}//package
Section 54
//Line (Line)
package {
import flash.geom.*;
public class Line {
public var udx:Number;
public var nx:Number;
public var ny:Number;
public var dir:Number;
public var udy:Number;
public var dy:Number;
public var y0:Number;
public var y1:Number;
public var dx:Number;
public var normalDir:Number;
public var length:Number;
public var boundingRect:Rectangle;
public var x0:Number;
public var x1:Number;
public function Line(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
x0 = _arg1;
y0 = _arg2;
x1 = _arg3;
y1 = _arg4;
CalcNormal();
CalcBoundingRect();
}
function CalcNormal():void{
dir = Math.atan2((y1 - y0), (x1 - x0));
normalDir = (dir - (Math.PI * 0.5));
nx = Math.cos(normalDir);
ny = Math.sin(normalDir);
dx = (x1 - x0);
dy = (y1 - y0);
length = Math.sqrt(((dx * dx) + (dy * dy)));
udx = Math.cos(dir);
udy = Math.sin(dir);
}
function CalcBoundingRect():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local1 = x0;
_local2 = x1;
if (_local1 > _local2){
_local1 = x1;
_local2 = x0;
};
_local3 = y0;
_local4 = y1;
if (_local3 > _local4){
_local3 = y1;
_local4 = y0;
};
boundingRect = new Rectangle(_local1, _local3, ((_local2 - _local1) + 1), ((_local4 - _local3) + 1));
}
}
}//package
Section 55
//Main (Main)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.utils.*;
import flash.ui.*;
public class Main extends MovieClip {
public var tf_scorespr:TextFormat;
var cheatMode:Boolean;
public var tf_scorespr2:TextFormat;
var levelTimer:Number;
var ftime:Number;
var framecounter:int;// = 0
var scrollY:Number;// = 0
public var tf_scorespr1:TextFormat;
private var screenB:Bitmap;
public var effectScreenBD:BitmapData;
public var backgroundMC:MovieClip;
private var backScreenB:Bitmap;
var levelTimerMax:Number;
public var mochiScores;
private var effectScreenB:Bitmap;
public var screenBD:BitmapData;
public var backScreenBD:BitmapData;
var gameState:int;// = 0
var currentTime:Number;// = 0
var secondCounter:Number;// = 0
public var fps:Number;
public var tf_scoresprblack:TextFormat;
static const gameState_HIGHSCORES = 5;
static const gameState_TITLE = 0;
static const gameState_LEVEL_PLAY = 2;
public static var theStage:Stage;
static var theRoot:MovieClip;
public function Main(){
currentTime = 0;
gameState = gameState_TITLE;
scrollY = 0;
framecounter = 0;
secondCounter = 0;
super();
theRoot = this;
theStage = this.root.stage;
SetEverythingUpOnce();
}
function calcFrameTime(){
var _local1:Number;
_local1 = currentTime;
currentTime = getTimer();
if (currentTime < _local1){
_local1 = (currentTime - 100);
};
if (currentTime > (_local1 + (100 * 10))){
_local1 = (100 * 10);
};
ftime = ((1 / (1000 / Defs.fps)) * (currentTime - _local1));
framecounter++;
secondCounter = (secondCounter + (currentTime - _local1));
if (secondCounter > 1000){
fps = ((Number(framecounter) / secondCounter) * 1000);
framecounter = 0;
secondCounter = 0;
};
ftime = 1;
}
function appDeactivateHandler(_arg1:Event):void{
KeyReader.Reset();
}
function AddMovieClip(_arg1:Number, _arg2:Number, _arg3:MovieClip):MovieClip{
_arg3.x = _arg1;
_arg3.y = _arg2;
addChild(_arg3);
return (_arg3);
}
private function CreateTextField(_arg1:TextFormat, _arg2:Number, _arg3:Number, _arg4:String):TextField{
var _local5:TextField;
_local5 = new TextField();
_local5.selectable = false;
_local5.embedFonts = true;
_local5.autoSize = TextFieldAutoSize.CENTER;
_local5.x = _arg2;
_local5.y = _arg3;
_local5.text = _arg4;
_local5.setTextFormat(_arg1);
addChild(_local5);
return (_local5);
}
function InitLevel(){
InitStageForGame();
Particles.Reset();
MouseControl.Reset();
Particles.Reset();
GameObjects.ClearAll();
Game.InitLevel();
}
function run(_arg1:Event):void{
KeyReader.UpdateOncePerFrame();
GraphicObjects.UpdateOncePerFrame();
if (SiteLock.IsLocked()){
return;
};
calcFrameTime();
switch (gameState){
case gameState_TITLE:
TitleScreenState.Update(this);
break;
case gameState_HIGHSCORES:
break;
case gameState_LEVEL_PLAY:
RunLevel();
break;
};
}
function SetEverythingUpOnce1():void{
theRoot = this;
theStage = this.root.stage;
addEventListener(Event.ENTER_FRAME, run);
MusicPlayer.InitOnce();
KeyReader.InitOnce(theStage);
MouseControl.InitOnce(theStage);
theStage.addEventListener(Event.DEACTIVATE, appDeactivateHandler);
SoundPlayer.InitOnce(this);
PauseMenu.InitOnce(this);
Particles.InitOnce(this, 50);
GameObjects.InitOnce(this, 200);
InitDrawScreen();
InitFonts();
GraphicObjects.InitOnce(this);
InitStage();
Game.Init(this);
SetGameState(gameState_TITLE);
}
function RunTitle(){
}
function SetEverythingUpOnce():void{
ExternalData.InitOnce(SetEverythingUpOnce1);
}
function InitFonts():void{
var _local1:Font;
_local1 = new Font1();
tf_scorespr = new TextFormat();
tf_scorespr1 = new TextFormat();
tf_scorespr2 = new TextFormat();
tf_scoresprblack = new TextFormat();
tf_scorespr.font = _local1.fontName;
tf_scorespr.size = 30;
tf_scorespr.color = 4294967295;
tf_scorespr1.font = _local1.fontName;
tf_scorespr1.size = 10;
tf_scorespr1.color = 4294967295;
tf_scorespr2.font = _local1.fontName;
tf_scorespr2.size = 10;
tf_scorespr2.color = 4294967295;
tf_scoresprblack.font = _local1.fontName;
tf_scoresprblack.size = 30;
tf_scoresprblack.color = 0;
}
function InitStage(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
addChild(screenB);
screenB.x = 0;
screenB.y = 0;
}
function Render(){
var _local1:Number;
var _local2:Number;
this.x = 0;
this.y = 0;
_local1 = 4;
_local2 = 4;
Game.Render();
}
function InitDrawScreen():void{
screenBD = new BitmapData(Defs.displayarea_w, Defs.displayarea_h, true, 0);
screenB = new Bitmap(screenBD);
effectScreenBD = new BitmapData(Defs.displayarea_w, Defs.displayarea_h, true, 0);
effectScreenB = new Bitmap(effectScreenBD);
backScreenBD = new BitmapData(Defs.displayarea_w, Defs.displayarea_h, false, 0);
backScreenB = new Bitmap(backScreenBD);
}
function InitStageNoBackground(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
}
function InitStageForGame(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
addChild(backScreenB);
screenB.x = 0;
screenB.y = 0;
}
function SetGameState(_arg1:int):void{
gameState = _arg1;
Mouse.show();
switch (gameState){
case gameState_TITLE:
TitleScreenState.Init(this);
break;
case gameState_HIGHSCORES:
break;
case gameState_LEVEL_PLAY:
InitLevel();
break;
};
}
function RunLevel(){
if (PauseMenu.IsPaused() == false){
Game.UpdateGameplay();
};
Render();
}
}
}//package
Section 56
//Moon (Moon)
package {
import flash.display.*;
public dynamic class Moon extends MovieClip {
}
}//package
Section 57
//MouseControl (MouseControl)
package {
import flash.events.*;
import flash.display.*;
public class MouseControl {
public static var mouseVelX:Number = 0;
public static var mouseVelY:Number = 0;
public static var mouseOldPosX:Number = 0;
public static var mouseOldPosY:Number = 0;
public static var mousePosX:Number = 0;
public static var mousePosY:Number = 0;
public static var buttonPressed:Boolean = false;
public static var buttonReleased:Boolean = false;
public static function MouseHandler(_arg1:MouseEvent):void{
mousePosX = _arg1.stageX;
mousePosY = _arg1.stageY;
mouseVelX = (mousePosX - mouseOldPosX);
mouseVelY = (mousePosY - mouseOldPosY);
mouseOldPosX = mousePosX;
mouseOldPosY = mousePosY;
}
public static function InitOnce(_arg1:Stage):void{
_arg1.addEventListener(MouseEvent.MOUSE_MOVE, MouseHandler);
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, MouseClickHandler);
_arg1.addEventListener(MouseEvent.MOUSE_UP, MouseUpHandler);
_arg1.addEventListener(MouseEvent.MOUSE_WHEEL, MouseWheelHandler);
}
public static function MouseUpHandler(_arg1:MouseEvent):void{
buttonPressed = false;
buttonReleased = true;
}
public static function MouseWheelHandler(_arg1:MouseEvent):void{
Game.HandleMouseWheel(_arg1.delta);
}
public static function Reset():void{
buttonPressed = false;
buttonReleased = false;
}
public static function MouseClickHandler(_arg1:MouseEvent):void{
buttonPressed = true;
buttonReleased = false;
}
}
}//package
Section 58
//Music1 (Music1)
package {
import flash.media.*;
public dynamic class Music1 extends Sound {
}
}//package
Section 59
//Music2 (Music2)
package {
import flash.media.*;
public dynamic class Music2 extends Sound {
}
}//package
Section 60
//Music3 (Music3)
package {
import flash.media.*;
public dynamic class Music3 extends Sound {
}
}//package
Section 61
//MusicPlayer (MusicPlayer)
package {
import flash.media.*;
public class MusicPlayer {
static var musicChannel:SoundChannel = null;
static var musicSound1:Sound;
static var musicSoundTransform:SoundTransform;
static var musicSound:Sound;
static var musicSoundTransform1:SoundTransform;
static var lastMusicID = -1;
static var musicChannel1:SoundChannel = null;
static var currentMusicID:int = -1;
static var doMusic:Boolean = true;
public static function PauseMusic(){
if (musicChannel != null){
musicChannel.stop();
};
}
public static function StartMusic(_arg1:int){
if (doMusic == false){
return;
};
if (musicChannel != null){
musicChannel.stop();
};
if (musicChannel1 != null){
musicChannel1.stop();
};
if (_arg1 == 0){
musicSoundTransform = new SoundTransform(0.75, 0);
musicSound = new Music1();
musicChannel = musicSound.play(0, 999999, musicSoundTransform);
};
if (_arg1 == 1){
musicSoundTransform = new SoundTransform(0.75, 0);
musicSound = new Music2();
musicChannel = musicSound.play(0, 999999, musicSoundTransform);
};
if (_arg1 == 2){
musicSoundTransform = new SoundTransform(0.75, 0);
musicSound = new Music3();
musicChannel = musicSound.play(0, 999999, musicSoundTransform);
};
if (_arg1 == 3){
musicSoundTransform = new SoundTransform(0.75, 0);
musicChannel = musicSound.play(0, 999999, musicSoundTransform);
};
lastMusicID = _arg1;
}
public static function InitOnce():void{
doMusic = true;
lastMusicID = -1;
currentMusicID = -1;
}
public static function ResumeMusic(){
currentMusicID = (lastMusicID - 1);
StartMusic(lastMusicID);
}
}
}//package
Section 62
//ObjAction (ObjAction)
package {
public class ObjAction {
var done:Boolean;
var param0:Number;
var time:int;
var actionFunction:Function;
public function ObjAction(_arg1:int, _arg2:Function, _arg3:Number){
time = _arg1;
actionFunction = _arg2;
done = false;
param0 = _arg3;
}
}
}//package
Section 63
//ObjectDef (ObjectDef)
package {
import flash.geom.*;
public class ObjectDef {
var dodgeMax:Number;
var animIDs:Array;
var score:int;
var booty_num:int;
var initFuncName:String;
var pathAnimType:int;
var booty_type:int;
var dodgeDist:Number;
var animNames:Array;
var type:int;
var collisionCircleOffsets:Array;
var particleExplodeID:int;
var NumParamA:Number;
var NumParamB:Number;
var NumParamC:Number;
var NumParamD:Number;
var exportName:String;
var NumParamG:Number;
var NumParamH:Number;
var dodgeFlag:Boolean;
var NumParamE:Number;
var NumParamF:Number;
var maxHealth:Number;
var collisionCircleRadii:Array;
var colRects:Array;
var shieldColRects:Array;
var dodgeMin:Number;
var shotControllers:Array;
public function ObjectDef(_arg1:String, _arg2:int, _arg3:Rectangle){
animNames = new Array();
animIDs = new Array();
colRects = new Array();
shieldColRects = new Array();
collisionCircleOffsets = new Array();
collisionCircleRadii = new Array();
exportName = _arg1;
type = _arg2;
colRects.push(_arg3.clone());
maxHealth = 1;
initFuncName = "";
shotControllers = new Array();
particleExplodeID = 0;
NumParamA = 0;
NumParamB = 0;
NumParamC = 0;
NumParamD = 0;
NumParamE = 0;
NumParamF = 0;
NumParamG = 0;
NumParamH = 0;
booty_num = 0;
booty_type = 0;
score = 0;
dodgeFlag = false;
}
public function SetInitFunc(_arg1:String){
initFuncName = _arg1;
}
public function AddShotController(_arg1:String, _arg2:int, _arg3:int, _arg4:Number, _arg5:Number, _arg6:Number):ShotController{
var _local7:ShotController;
_local7 = new ShotController();
_local7.Set(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
shotControllers.push(_local7);
return (_local7);
}
public function SetInitParams(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number){
NumParamA = _arg1;
NumParamB = _arg2;
NumParamC = _arg3;
NumParamD = _arg4;
NumParamE = _arg5;
NumParamF = _arg6;
NumParamG = _arg7;
NumParamH = _arg8;
}
public function SetPathAnimType(_arg1:int){
pathAnimType = _arg1;
}
public function DoesAnimIDExist(_arg1:String):Boolean{
var _local2:int;
var _local3:int;
_local2 = animNames.length;
_local3 = 0;
while (_local3 < _local2) {
if (animNames[_local3] == _arg1){
return (true);
};
_local3++;
};
return (false);
}
public function SetBooty(_arg1:int, _arg2:int, _arg3:int){
booty_num = _arg1;
booty_type = _arg2;
score = _arg3;
}
public function AddAnim(_arg1:String, _arg2:int){
animNames.push(_arg1);
animIDs.push(_arg2);
}
public function AddColRect(_arg1:Rectangle){
colRects.push(_arg1.clone());
}
public function SetDodge(_arg1:Number, _arg2:Number, _arg3:Number){
dodgeFlag = true;
dodgeDist = _arg1;
dodgeMin = _arg2;
dodgeMax = _arg3;
}
public function GetAnimIDFromName(_arg1:String):int{
var _local2:int;
var _local3:int;
_local2 = animNames.length;
_local3 = 0;
while (_local3 < _local2) {
if (animNames[_local3] == _arg1){
return (animIDs[_local3]);
};
_local3++;
};
trace(((("ERROR: Can't find anim name " + _arg1) + " on object ") + exportName));
return (40);
}
public function SetParticle(_arg1:int){
particleExplodeID = _arg1;
}
public function AddShieldColRect(_arg1:Rectangle){
shieldColRects.push(_arg1.clone());
}
public function SetHealth(_arg1:Number){
maxHealth = _arg1;
}
public function AddCollisionCircle(_arg1:Number, _arg2:Number, _arg3:Number){
collisionCircleOffsets.push(new Point(_arg1, _arg2));
collisionCircleRadii.push(_arg3);
}
}
}//package
Section 64
//ObjectDefs (ObjectDefs)
package {
import flash.geom.*;
public class ObjectDefs {
static var list:Array;
public static function Init(){
var _local1:ObjectDef;
list = new Array();
_local1 = new ObjectDef("Player", 0, new Rectangle(-10, -40, 40, 40));
_local1.score = 100;
_local1.SetHealth(100);
list.push(_local1);
_local1 = new ObjectDef("Cannon1", 0, new Rectangle(-20, -25, 40, 60));
_local1.score = 100;
_local1.SetHealth(1);
list.push(_local1);
_local1 = new ObjectDef("Cannon2", 0, new Rectangle(-20, -25, 40, 60));
_local1.score = 100;
_local1.SetHealth(1);
list.push(_local1);
_local1 = new ObjectDef("BouncingBomb", 0, new Rectangle(-20, -20, 40, 40));
_local1.score = 100;
_local1.SetHealth(1);
list.push(_local1);
_local1 = new ObjectDef("LandMine", 0, new Rectangle(-50, -30, 100, 30));
_local1.score = 100;
_local1.SetHealth(1);
list.push(_local1);
_local1 = new ObjectDef("JetPackRed", 0, new Rectangle(-30, -35, 60, 60));
_local1.score = 200;
_local1.SetHealth(10);
list.push(_local1);
_local1 = new ObjectDef("JetPackBlue", 0, new Rectangle(-30, -35, 60, 60));
_local1.score = 200;
_local1.SetHealth(10);
list.push(_local1);
_local1 = new ObjectDef("Copter", 0, new Rectangle(-100, -100, 200, 200));
_local1.score = 500;
_local1.SetHealth(100);
list.push(_local1);
_local1 = new ObjectDef("Boss", 0, new Rectangle(-100, -100, 200, 200));
_local1.score = 1000;
_local1.SetHealth(999999);
list.push(_local1);
_local1 = new ObjectDef("Missile", 0, new Rectangle(-80, -20, 160, 40));
_local1.SetHealth(999999);
list.push(_local1);
_local1 = new ObjectDef("Bullet", 0, new Rectangle(-10, -10, 20, 20));
_local1.SetHealth(100);
list.push(_local1);
}
public static function AddFromXml(){
var _local1:XML;
var _local2:XML;
var _local3:ObjectDef;
var _local4:Rectangle;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:XML;
var _local13:XML;
var _local14:XML;
var _local15:ShotController;
var _local16:XML;
_local1 = ExternalData.xml;
_local5 = 0;
while (_local5 < _local1.objdef.length()) {
_local2 = _local1.objdef[_local5];
_local8 = Number(_local2.collisionrect.@x0);
_local9 = Number(_local2.collisionrect.@y0);
_local10 = (Number(_local2.collisionrect.@x1) - _local8);
_local11 = Number((_local2.collisionrect.@y1 - _local9));
_local4 = new Rectangle(_local8, _local9, _local10, _local11);
_local3 = new ObjectDef(_local2.@name, 0, _local4);
_local3.SetInitFunc(_local2.control.@initfunc);
_local3.SetParticle(int(_local2.control.@particleid));
_local3.SetInitParams(Number(_local2.control.@a), Number(_local2.control.@b), Number(_local2.control.@c), Number(_local2.control.@d), Number(_local2.control.@e), Number(_local2.control.@f), Number(_local2.control.@g), Number(_local2.control.@h));
_local3.SetHealth(Number(_local2.data.@health));
_local6 = 0;
while (_local6 < _local2.anim.length()) {
_local12 = _local2.anim[_local6];
_local3.AddAnim(_local12.@id, GraphicObjects.GetIdFromName(_local12.@graphic));
_local6++;
};
if (_local2.dodge.length() != 0){
_local3.SetDodge(Number(_local2.dodge.@dist), Number(_local2.dodge.@min), Number(_local2.dodge.@max));
};
_local6 = 0;
while (_local6 < _local2.booty.length()) {
_local13 = _local2.booty[_local6];
_local3.SetBooty(int(_local13.@num), int(_local13.@type), int(_local13.@score));
_local6++;
};
_local6 = 0;
while (_local6 < _local2.shotcontroller.length()) {
_local14 = _local2.shotcontroller[_local6];
_local15 = _local3.AddShotController(_local14.@bullettype, (Number(_local14.@minfreq) * Defs.fps2), (Number(_local14.@maxfreq) * Defs.fps2), Number(_local14.@speed), 0, 0);
_local7 = 0;
while (_local7 < _local14.shot.length()) {
_local16 = _local14.shot[_local7];
_local15.AddShot(_local16.@type, Number(_local16.@offset), Number(_local16.@delay));
_local7++;
};
if (_local14.offset.length() != 0){
_local15.SetFireOffset(Number(_local14.offset.@x), Number(_local14.offset.@y));
};
_local6++;
};
list.push(_local3);
_local5++;
};
}
public static function GetObjectDefByExportName(_arg1:String){
var _local2:ObjectDef;
var _local3:int;
var _local4:int;
_local4 = list.length;
_local3 = 0;
while (_local3 < _local4) {
_local2 = list[_local3];
if (_local2.exportName == _arg1){
return (_local2);
};
_local3++;
};
trace(("ERROR: ObjectDefs can't find object exportname " + _arg1));
return (null);
}
}
}//package
Section 65
//OverheatMeter (OverheatMeter)
package {
import flash.display.*;
public dynamic class OverheatMeter extends MovieClip {
}
}//package
Section 66
//Overlay (Overlay)
package {
import flash.display.*;
public dynamic class Overlay extends MovieClip {
}
}//package
Section 67
//Particle (Particle)
package {
class Particle {
var graphicID:int;
public var yvel:Number;
var active:Boolean;
var maxframe:int;
var dir:Number;
public var xvel:Number;
var ypos:Number;
var updateFunction:Function;
var timer:Number;
var speed:Number;
var scale:Number;
var startx:Number;
var starty:Number;
var xpos:Number;
var alpha:Number;
var alphaAdd:Number;
var yacc:Number;
var color:uint;
var frame:Number;
var frameVel:Number;
var visible:Boolean;
var counter:int;
function UpdatePlayerTrail(){
xpos = (xpos + xvel);
if (PlayAnimation()){
active = false;
};
}
function PlayAnimation():Boolean{
frame = (frame + frameVel);
if (frame >= maxframe){
frame = maxframe;
return (true);
};
return (false);
}
public function InitExplode(_arg1:int){
updateFunction = UpdateExplode;
dir = Utils.RandCircle();
speed = Utils.RandBetweenFloat(6, 18);
graphicID = _arg1;
maxframe = (GraphicObjects.GetNumFrames(graphicID) - 1);
alpha = 1;
frame = 0;
frameVel = 1;
alphaAdd = Utils.RandBetweenFloat(-0.01, -0.03);
}
public function InitEnemyHitShield(){
var _local1:Number;
var _local2:int;
updateFunction = UpdateEnemyHitShield;
dir = Utils.RandCircle();
_local1 = dir;
_local1 = ((Math.PI * 2) - _local1);
_local1 = (_local1 + (Math.PI / 2));
while (_local1 > (Math.PI * 2)) {
_local1 = (_local1 - (Math.PI * 2));
};
speed = Utils.RandBetweenFloat(2, 4);
maxframe = (GraphicObjects.GetNumFrames(graphicID) - 1);
frame = Utils.RandBetweenInt(0, maxframe);
_local2 = ((maxframe / (Math.PI * 2)) * _local1);
frame = _local2;
}
function UpdateVelsTimer(){
xpos = (xpos + xvel);
ypos = (ypos + yvel);
timer--;
if (timer <= 0){
active = false;
};
}
function UpdateCharacterFire(){
yvel = (yvel + yacc);
xpos = (xpos + xvel);
ypos = (ypos + yvel);
timer--;
if (timer <= 0){
active = false;
};
}
public function InitPlayerNoWeapon(_arg1:Number){
var _local2:int;
updateFunction = UpdatePlayerNoWeapon;
dir = _arg1;
dir = (dir - (Math.PI * 0.5));
dir = (dir + (Math.PI * 2));
dir = (dir + Utils.RandBetweenFloat(-0.2, 0.2));
speed = Utils.RandBetweenFloat(1, 2);
maxframe = GraphicObjects.GetNumFrames(graphicID);
xpos = (xpos + (Math.cos(dir) * 20));
ypos = (ypos + (Math.sin(dir) * 20));
_local2 = Utils.RandBetweenInt(0, (maxframe - 1));
frame = _local2;
}
function UpdateQuota(){
xpos = (Game.scrollX + startx);
ypos = (Game.scrollY + starty);
scale = (scale + 0.001);
if (Game.levelState != Game.levelState_BonusTime){
active = false;
};
}
function UpdateEnemyHitShield(){
xvel = (Math.cos(dir) * speed);
yvel = (Math.sin(dir) * speed);
xpos = (xpos + xvel);
ypos = (ypos + yvel);
speed = (speed - 0.1);
if (speed <= 0){
speed = 0;
active = false;
};
}
public function InitPlayerThrust(_arg1:Vec){
var _local2:Number;
var _local3:int;
updateFunction = UpdatePlayerThrust;
dir = (_arg1.rot + Math.PI);
dir = (dir + Utils.RandBetweenFloat(-0.5, 0.5));
speed = Utils.RandBetweenFloat(0.5, 1);
speed = (speed * _arg1.speed);
maxframe = GraphicObjects.GetNumFrames(graphicID);
xpos = (xpos + (Math.cos(dir) * 20));
ypos = (ypos + (Math.sin(dir) * 20));
_local2 = dir;
_local2 = ((Math.PI * 2) - _local2);
_local2 = (_local2 + (Math.PI / 2));
while (_local2 > (Math.PI * 2)) {
_local2 = (_local2 - (Math.PI * 2));
};
_local3 = ((maxframe / (Math.PI * 2)) * _local2);
frame = _local3;
}
public function InitQuota(){
startx = xpos;
starty = ypos;
updateFunction = UpdateQuota;
frame = 0;
scale = 1;
}
function UpdatePlayerThrust(){
xvel = (Math.cos(dir) * speed);
yvel = (Math.sin(dir) * speed);
xpos = (xpos + xvel);
ypos = (ypos + yvel);
speed = (speed - 0.3);
if (speed <= 0){
speed = 0;
active = false;
};
}
public function InitDuckTrail(){
updateFunction = UpdateDuckTrail;
frame = 0;
xvel = Utils.RandBetweenFloat(-0.5, 0.5);
yvel = Utils.RandBetweenFloat(-0.5, 0.5);
}
public function InitCharacterFire(_arg1:int, _arg2:uint){
updateFunction = UpdateCharacterFire;
color = _arg2;
yvel = Utils.RandBetweenFloat(0, -0.5);
xvel = Utils.RandBetweenFloat(-0.2, 0.2);
yacc = -0.01;
if (_arg1 == 1){
yvel = Utils.RandBetweenFloat(-2, -3);
xvel = Utils.RandBetweenFloat(-0.2, 0.2);
yacc = -0.05;
};
if (_arg1 == 2){
yvel = Utils.RandBetweenFloat(0, 1);
xvel = Utils.RandBetweenFloat(-0.2, 0.2);
yacc = 0.04;
};
timer = Utils.RandBetweenInt(5, 10);
if (Game.particleMode == 1){
timer = Utils.RandBetweenInt(3, 5);
};
}
public function InitCash(_arg1:int){
updateFunction = UpdateScore;
frame = _arg1;
timer = 20;
}
function UpdateLevelEnds(){
var _local1:int;
xpos = (Game.scrollX + startx);
ypos = (Game.scrollY + starty);
_local1 = (Game.levelStateTimer / Defs.fps);
if (_local1 < 0){
_local1 = 0;
};
if (_local1 > 4){
_local1 = 4;
};
_local1 = (4 - _local1);
frame = (_local1 + 1);
if (Game.levelState != Game.levelState_BonusTime){
active = false;
};
}
function UpdatePlayerNoWeapon(){
xvel = (Math.cos(dir) * speed);
yvel = (Math.sin(dir) * speed);
xpos = (xpos + xvel);
ypos = (ypos + yvel);
speed = (speed - 0.1);
if (speed <= 0){
speed = 0;
active = false;
};
}
function UpdateEnemyShotFired(){
if (PlayAnimation()){
active = false;
};
}
function UpdateBulletHitPlayerNoDie(){
if (PlayAnimation()){
active = false;
};
}
public function InitEnemyExplosion(){
updateFunction = UpdateEnemyExplosion;
maxframe = (GraphicObjects.GetNumFrames(graphicID) - 1);
frame = 0;
frameVel = 1;
}
function UpdateExplode(){
xvel = (Math.cos(dir) * speed);
yvel = (Math.sin(dir) * speed);
xpos = (xpos + xvel);
ypos = (ypos + yvel);
frame = (frame + frameVel);
if (frame >= maxframe){
frame = maxframe;
};
speed = (speed - 0.3);
if (speed <= 0){
speed = 0;
active = false;
};
}
public function InitEnemyExplosionNoDie(){
updateFunction = UpdateEnemyExplosionNoDie;
maxframe = (GraphicObjects.GetNumFrames(graphicID) - 1);
frame = 0;
frameVel = 1;
}
public function InitEnemyShotFired(_arg1:int){
updateFunction = UpdateEnemyShotFired;
maxframe = (GraphicObjects.GetNumFrames(graphicID) - 1);
frame = 0;
frameVel = 1;
}
public function InitScore(_arg1:int){
updateFunction = UpdateScore;
_arg1 = (_arg1 / 100);
_arg1--;
if (_arg1 < 0){
_arg1 = 0;
};
if (_arg1 > 9){
_arg1 = 9;
};
frame = (3 + _arg1);
timer = 60;
}
function UpdateScore(){
timer--;
if (timer < 0){
active = false;
};
}
public function InitLevelEnds(){
startx = xpos;
starty = ypos;
updateFunction = UpdateLevelEnds;
frame = 1;
}
function UpdateEnemyExplosion(){
if (PlayAnimation()){
active = false;
};
}
public function InitCollectedPickup(){
updateFunction = UpdateAnimAndStop;
maxframe = (GraphicObjects.GetNumFrames(graphicID) - 1);
frame = 0;
frameVel = 1;
xvel = 0;
yvel = 0;
}
public function InitEnem1yBulletTrail(){
updateFunction = UpdateVelsTimer;
dir = Utils.RandCircle();
speed = Utils.RandBetweenFloat(3, 6);
xvel = (Math.cos(dir) * speed);
yvel = (Math.sin(dir) * speed);
maxframe = (GraphicObjects.GetNumFrames(graphicID) - 1);
frame = maxframe;
timer = 5;
}
function CycleAnimation():Boolean{
frame = (frame + frameVel);
if (frame >= maxframe){
frame = 0;
return (true);
};
return (false);
}
function UpdateEnemyExplosionNoDie(){
if (PlayAnimation()){
active = false;
};
}
function UpdateDuckTrail(){
xpos = (xpos + xvel);
ypos = (ypos + yvel);
scale = (scale - 0.05);
if (scale <= 0.1){
scale = 0.1;
active = false;
};
}
public function InitPlayerTrail(){
updateFunction = UpdatePlayerTrail;
graphicID = GraphicObjects.gfx_trail;
maxframe = (GraphicObjects.GetNumFrames(graphicID) - 1);
frame = 0;
frameVel = 1;
xvel = Utils.RandBetweenFloat(-10, -5);
}
public function InitBulletHitPlayerNoDie(){
updateFunction = UpdateBulletHitPlayerNoDie;
graphicID = 0;
maxframe = (GraphicObjects.GetNumFrames(graphicID) - 1);
frame = 0;
frameVel = 1;
}
function UpdateAnimAndStop(){
xpos = (xpos + xvel);
ypos = (ypos + yvel);
if (PlayAnimation()){
active = false;
};
}
}
}//package
Section 68
//Particles (Particles)
package {
import flash.display.*;
import flash.geom.*;
public class Particles {
public static const type_dust = 0;
static var max:int;
static var list:Array;
static var main:Main;
static var nextIndex:int;
public function Particles():void{
}
public static function Add(_arg1:Number, _arg2:Number):Particle{
var _local3:Number;
var _local4:Number;
var _local5:Particle;
_local5 = list[nextIndex];
nextIndex++;
if (nextIndex >= max){
nextIndex = 0;
};
_local5.active = true;
_local5.timer = 0;
_local5.alpha = 1;
_local5.alphaAdd = 0;
_local5.visible = true;
_local5.xpos = _arg1;
_local5.ypos = _arg2;
_local5.scale = 1;
return (_local5);
}
public static function GetNextIndex():int{
return (nextIndex);
}
public static function Reset(){
var _local1:int;
nextIndex = 0;
_local1 = 0;
while (_local1 < max) {
list[_local1].active = false;
_local1++;
};
}
public static function Update(_arg1:Number){
var _local2:int;
var _local3:Particle;
_local2 = 0;
while (_local2 < max) {
_local3 = list[_local2];
if (_local3.active == true){
_local3.updateFunction();
};
_local2++;
};
}
public static function InitOnce(_arg1:Main, _arg2:int):void{
var _local3:int;
main = _arg1;
max = _arg2;
nextIndex = 0;
list = new Array(max);
_local3 = 0;
while (_local3 < max) {
list[_local3] = new Particle();
list[_local3].active = false;
_local3++;
};
}
public static function CountActive():int{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = 0;
while (_local2 < max) {
if (list[_local2].active){
_local1++;
};
_local2++;
};
return (_local1);
}
public static function Render(_arg1:Main){
var _local2:Number;
var _local3:Number;
var _local4:BitmapData;
var _local5:int;
var _local6:Particle;
var _local7:Number;
var _local8:Number;
_local2 = Game.scrollX;
_local3 = Game.scrollY;
_local4 = _arg1.screenBD;
_local5 = 0;
while (_local5 < max) {
_local6 = list[_local5];
if (((_local6.active) && (_local6.visible))){
_local7 = _local6.xpos;
_local8 = _local6.ypos;
if (_local6.graphicID != GraphicObjects.gfx_trail){
GraphicObjects.RenderAt(_local6.graphicID, _local6.frame, _local4, _local7, _local8);
} else {
GraphicObjects.RenderAtAlpha(_local6.graphicID, _local6.frame, _local4, _local7, _local8, 0.5);
};
};
_local5++;
};
}
}
}//package
Section 69
//PauseMenu (PauseMenu)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.geom.*;
import flash.net.*;
import flash.ui.*;
public class PauseMenu {
static var active:Boolean;
static var pauseMC:MovieClip;
static var main:Main;
public function PauseMenu():void{
}
public static function buttonQuitPressed(_arg1:MouseEvent){
Unpause();
Game.main.SetGameState(Main.gameState_TITLE);
}
public static function buttonSoundPressed(_arg1:MouseEvent){
var _local2:Boolean;
_local2 = MusicPlayer.doMusic;
if (_local2 == true){
MusicPlayer.PauseMusic();
MusicPlayer.doMusic = false;
} else {
MusicPlayer.doMusic = true;
MusicPlayer.ResumeMusic();
};
_local2 = SoundPlayer.doSFX;
SoundPlayer.doSFX = (_local2 == false);
if (MusicPlayer.doMusic){
pauseMC.selectedSound.gotoAndStop(2);
} else {
pauseMC.selectedSound.gotoAndStop(1);
};
}
public static function buttonContinuePressed(_arg1:MouseEvent){
Unpause();
}
public static function buttonHelpPressed(_arg1:MouseEvent){
TitleScreenState.InitHelpText1();
}
public static function InitOnce(_arg1:Main):void{
main = _arg1;
active = false;
}
public static function Pause():void{
Game.pause = true;
Mouse.show();
pauseMC = TitleScreenState.mc_PauseScreen;
main.addChild(pauseMC);
pauseMC.buttonSound.addEventListener(MouseEvent.CLICK, buttonSoundPressed, false, 0, true);
pauseMC.buttonQuit.addEventListener(MouseEvent.CLICK, buttonQuitPressed, false, 0, true);
pauseMC.buttonContinue.addEventListener(MouseEvent.CLICK, buttonContinuePressed, false, 0, true);
pauseMC.buttonHelp.addEventListener(MouseEvent.CLICK, buttonHelpPressed, false, 0, true);
active = true;
if (MusicPlayer.doMusic){
pauseMC.selectedSound.gotoAndStop(2);
} else {
pauseMC.selectedSound.gotoAndStop(1);
};
}
public static function Unpause():void{
active = false;
Game.main.removeChild(pauseMC);
pauseMC = null;
KeyReader.InitOnce(Game.main.stage);
Game.pause = false;
}
public static function IsPaused():Boolean{
return (active);
}
}
}//package
Section 70
//PauseScreen (PauseScreen)
package {
import flash.display.*;
public dynamic class PauseScreen extends MovieClip {
}
}//package
Section 71
//PlayerDie (PlayerDie)
package {
import flash.display.*;
public dynamic class PlayerDie extends MovieClip {
}
}//package
Section 72
//PlayerFall (PlayerFall)
package {
import flash.display.*;
public dynamic class PlayerFall extends MovieClip {
}
}//package
Section 73
//PlayerFlip (PlayerFlip)
package {
import flash.display.*;
public dynamic class PlayerFlip extends MovieClip {
}
}//package
Section 74
//PlayerJump (PlayerJump)
package {
import flash.display.*;
public dynamic class PlayerJump extends MovieClip {
}
}//package
Section 75
//PlayerRun (PlayerRun)
package {
import flash.display.*;
public dynamic class PlayerRun extends MovieClip {
}
}//package
Section 76
//PlayerSlide (PlayerSlide)
package {
import flash.display.*;
public dynamic class PlayerSlide extends MovieClip {
}
}//package
Section 77
//PlayerStand (PlayerStand)
package {
import flash.display.*;
public dynamic class PlayerStand extends MovieClip {
}
}//package
Section 78
//PlayerWeapon (PlayerWeapon)
package {
import flash.geom.*;
public class PlayerWeapon {
var graphicID:int;
var bulletDamage:Array;
var homingRates:Array;
var powerCharge:Number;
var homingTurnRates:Array;
var collisionPoly:Array;
var playerWeaponGroup:PlayerWeaponGroup;
var fireTimer:int;
var bulletRates:Array;
var fireRate:int;
var type:int;
var speed:Number;
var homingSpeed:Array;
var angle:Number;
var homingDamage:Array;
var bulletSpeed:Array;
var levels:Array;
var damage:Number;
var powerChargeRates:Array;
var initFunc:Function;
var turnRate:Number;
static const lev_rate = 0;
static const lev_speed = 1;
static const lev_damage = 2;
static const lev_charge = 4;
static const lev_max = 5;
static const lev_turnRate = 3;
public function PlayerWeapon(){
speed = 1;
damage = 1;
fireRate = 1;
graphicID = 0;
initFunc = null;
collisionPoly = null;
playerWeaponGroup = null;
}
public function GetFireRate():int{
return (playerWeaponGroup.firerate);
}
public function GetFireAngle():Number{
return (angle);
}
public function GetSpeed():Number{
return (playerWeaponGroup.speed);
}
public function Reset(){
fireTimer = 0;
}
public function IncreaseLevel(_arg1:int, _arg2:int){
levels[_arg1] = (levels[_arg1] + _arg2);
if (levels[_arg1] >= 4){
levels[_arg1] = 4;
};
}
public function GetDamage():Number{
return (playerWeaponGroup.damage);
}
public function Setup(_arg1:Function, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number){
Reset();
initFunc = _arg1;
angle = _arg2;
fireRate = _arg3;
speed = _arg4;
damage = _arg5;
}
public function SetGraphicID(_arg1:int){
graphicID = _arg1;
}
public function SetLevel(_arg1:int, _arg2:int){
levels[_arg1] = _arg2;
}
public function IsActive():Boolean{
return (true);
}
public function AddCollisionPolyPoint(_arg1:Number, _arg2:Number){
if (collisionPoly == null){
collisionPoly = new Array();
};
collisionPoly.push(new Point(_arg1, _arg2));
}
}
}//package
Section 79
//PlayerWeaponGroup (PlayerWeaponGroup)
package {
public class PlayerWeaponGroup {
var timer:int;
var reloadTime:int;
var name:String;
var fireSoundID:int;
var weapons:Array;
var id:int;
var firerate:int;
var speed:Number;
var mode:int;
var shotTime:int;
var frame:int;
var damage:Number;
var shotDim:int;
var shots:Number;
var maxShots:int;
var shotDimRate:Number;
public function PlayerWeaponGroup(){
id = 0;
mode = 0;
timer = 0;
weapons = new Array();
shots = 0;
maxShots = 0;
reloadTime = 0;
shotDim = 0;
fireSoundID = 0;
frame = 0;
name = "";
damage = 0;
firerate = 0;
speed = 0;
shotTime = 0;
}
}
}//package
Section 80
//Poly (Poly)
package {
import flash.display.*;
import flash.geom.*;
public class Poly {
var param0:String;
var param1:String;
var subTypeName:String;
var active:Boolean;
var name:String;
var pointList:Array;
var typeName:String;
var boundingRectangle:Rectangle;
var iparam0:int;
var lineList:Array;
var closed:Boolean;
var hitCallback:Object;
var type:int;
var catmullRomLength:Number;
public static const polytype_WALL = 1;
public static const polytype_CEILING = 6;
public static const polytype_ZONE = 3;
public static const polytype_PATH = 0;
public static const polytype_FLOOR = 5;
public static const polytype_OVERLAY = 4;
public static const polytype_TRIGGER = 2;
public function Poly(_arg1:String, _arg2:int, _arg3:Number, _arg4:Number):void{
lineList = new Array();
active = true;
type = _arg2;
name = _arg1;
boundingRectangle = null;
hitCallback = null;
closed = false;
pointList = new Array();
pointList.push(new Point(_arg3, _arg4));
}
function PointOnCurve(_arg1:Number, _arg2:Point, _arg3:Point, _arg4:Point, _arg5:Point):Point{
var _local6:Point;
var _local7:Number;
var _local8:Number;
_local6 = new Point();
_local7 = (_arg1 * _arg1);
_local8 = (_local7 * _arg1);
_local6.x = (0.5 * ((((2 * _arg3.x) + ((-(_arg2.x) + _arg4.x) * _arg1)) + (((((2 * _arg2.x) - (5 * _arg3.x)) + (4 * _arg4.x)) - _arg5.x) * _local7)) + ((((-(_arg2.x) + (3 * _arg3.x)) - (3 * _arg4.x)) + _arg5.x) * _local8)));
_local6.y = (0.5 * ((((2 * _arg3.y) + ((-(_arg2.y) + _arg4.y) * _arg1)) + (((((2 * _arg2.y) - (5 * _arg3.y)) + (4 * _arg4.y)) - _arg5.y) * _local7)) + ((((-(_arg2.y) + (3 * _arg3.y)) - (3 * _arg4.y)) + _arg5.y) * _local8)));
return (_local6);
}
public function GetPoint(_arg1:int):Point{
return (new Point(pointList[_arg1].x, pointList[_arg1].y));
}
public function GetPointNormal(_arg1:int):Point{
return (new Point(lineList[_arg1].nx, lineList[_arg1].ny));
}
public function GetPointOnCatmullRom(_arg1:Number):Point{
var _local2:int;
var _local3:int;
var _local4:Point;
var _local5:Point;
var _local6:Point;
var _local7:Point;
var _local8:Number;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:int;
var _local14:int;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Point;
_local2 = GetNumPoints();
if (_local2 < 4){
return (new Point(0, 0));
};
_local3 = (_local2 - 1);
_local8 = (Number(_local3) * _arg1);
_local9 = _local8;
_local10 = (_local9 - 1);
_local11 = _local9;
_local12 = (_local9 + 1);
_local13 = (_local9 + 2);
if (_local10 < 0){
_local10 = 0;
};
if (_local12 > (_local2 - 1)){
_local12 = (_local2 - 1);
};
if (_local13 > (_local2 - 1)){
_local13 = (_local2 - 1);
};
_local4 = pointList[_local10];
_local5 = pointList[_local11];
_local6 = pointList[_local12];
_local7 = pointList[_local13];
_local14 = (_local9 + 1);
_local15 = ((1 / Number(_local3)) * _local9);
_local16 = ((1 / Number(_local3)) * _local14);
_local17 = ((1 / (_local16 - _local15)) * (_arg1 - _local15));
_local18 = PointOnCurve(_local17, _local4, _local5, _local6, _local7);
return (_local18);
}
public function AddLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Line;
var _local6:Rectangle;
_local5 = new Line(_arg1, _arg2, _arg3, _arg4);
lineList.push(_local5);
pointList.push(new Point(_arg3, _arg4));
if (boundingRectangle == null){
boundingRectangle = _local5.boundingRect;
} else {
_local6 = boundingRectangle.clone();
boundingRectangle = _local6.union(_local5.boundingRect);
};
}
public function GetLine(_arg1:int):Line{
return (lineList[_arg1]);
}
public function CalculateCatmullRomLength(){
var _local1:Array;
var _local2:int;
var _local3:int;
var _local4:Number;
var _local5:Point;
var _local6:Point;
var _local7:Point;
_local1 = new Array();
_local3 = GetNumPoints();
if (_local3 < 4){
catmullRomLength = 0;
} else {
_local4 = 0;
while (_local4 < 1) {
_local5 = GetPointOnCatmullRom(_local4);
_local1.push(_local5);
_local4 = (_local4 + 0.025);
};
};
catmullRomLength = 0;
_local2 = 0;
while (_local2 < (_local1.length - 2)) {
_local6 = _local1[_local2];
_local7 = _local1[(_local2 + 1)];
catmullRomLength = (catmullRomLength + Utils.DistBetweenPoints(_local6.x, _local6.y, _local7.x, _local7.y));
_local2++;
};
_local1 = null;
}
public function Finish(_arg1:Boolean){
var _local2:Line;
var _local3:Line;
var _local4:Line;
var _local5:Rectangle;
if (_arg1){
_local2 = lineList[0];
_local3 = lineList[(lineList.length - 1)];
_local4 = new Line(_local3.x1, _local3.y1, _local2.x0, _local2.y0);
lineList.push(_local4);
_local5 = boundingRectangle.clone();
boundingRectangle = _local5.union(_local4.boundingRect);
};
closed = _arg1;
}
public function GetCatmullRomLength():Number{
return (catmullRomLength);
}
public function GetNumLines():int{
return (lineList.length);
}
public function OffsetFromStartPoint(){
var _local1:*;
var _local2:*;
var _local3:int;
var _local4:Line;
_local1 = -(pointList[0].x);
_local2 = -(pointList[0].y);
_local3 = 0;
while (_local3 < pointList.length) {
pointList[_local3].x = (pointList[_local3].x + _local1);
pointList[_local3].y = (pointList[_local3].y + _local2);
_local3++;
};
_local3 = 0;
while (_local3 < lineList.length) {
_local4 = lineList[_local3];
lineList[_local3].x0 = (_local4.x0 + _local1);
_local4.x1 = (_local4.x1 + _local1);
_local4.y0 = (_local4.y0 + _local2);
_local4.y1 = (_local4.y1 + _local2);
_local3++;
};
}
public function DrawCatmullRom(_arg1:BitmapData, _arg2:uint, _arg3:Number, _arg4:Number){
var _local5:int;
var _local6:Number;
var _local7:Point;
_local5 = GetNumPoints();
if (_local5 < 4){
return;
};
_local6 = 0;
while (_local6 < 1) {
_local7 = GetPointOnCatmullRom(_local6);
_arg1.setPixel32((_local7.x + _arg3), (_local7.y + _arg4), _arg2);
_local6 = (_local6 + 0.001);
};
}
public function GetNumPoints():int{
return (pointList.length);
}
public static function PolyFromPointList(_arg1:Array):Poly{
var _local2:Point;
var _local3:Point;
var _local4:Poly;
var _local5:int;
var _local6:int;
_local2 = _arg1[0];
_local4 = new Poly("", 0, _local2.x, _local2.y);
_local5 = _arg1.length;
_local6 = 0;
while (_local6 < (_local5 - 1)) {
_local2 = _arg1[_local6];
_local3 = _arg1[(_local6 + 1)];
_local4.AddLine(_local2.x, _local2.y, _local3.x, _local3.y);
_local6++;
};
_local4.Finish(true);
return (_local4);
}
public static function FindAllByType(_arg1:int, _arg2:Array):Array{
var _local3:Array;
var _local4:Poly;
_local3 = new Array();
for each (_local4 in _arg2) {
if (_local4.type == _arg1){
_local3.push(_local4);
};
};
return (_local3);
}
public static function FindByName(_arg1:String, _arg2:Array):Poly{
var _local3:Poly;
for each (_local3 in _arg2) {
if (_local3.name == _arg1){
return (_local3);
};
};
return (null);
}
public static function FindIndexByName(_arg1:String, _arg2:Array):int{
var _local3:int;
var _local4:Poly;
_local3 = 0;
for each (_local4 in _arg2) {
if (_local4.name == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
}
}//package
Section 81
//PortalDef (PortalDef)
package {
public class PortalDef {
var portalGroups:Array;
var numPortals:int;
var maxtime:int;
var index:int;
var type:int;
var mintime:int;
public function PortalDef(_arg1:int, _arg2:Number, _arg3:Number){
type = 0;
portalGroups = new Array();
numPortals = _arg1;
mintime = (_arg2 * Defs.fps2);
maxtime = (_arg3 * Defs.fps2);
}
public function GetName():String{
return (portalGroups[index].enemyName);
}
public function AddGroup(_arg1:PortalGroup){
portalGroups.push(_arg1);
}
public function GetRandomTime():int{
return (Utils.RandBetweenInt(mintime, maxtime));
}
public function GetFrequency():int{
return (portalGroups[index].frequency);
}
public function GetMax():int{
return (portalGroups[index].maxGen);
}
public function GetNextIndex(){
var _local1:Array;
var _local2:int;
var _local3:PortalGroup;
_local1 = new Array();
_local2 = 0;
for each (_local3 in portalGroups) {
if (_local3.timer <= 0){
_local1.push(_local2);
};
_local2++;
};
if (_local1.length == 0){
index = 0;
} else {
Game.currentPortalGroup++;
if (Game.currentPortalGroup >= _local1.length){
Game.currentPortalGroup = 0;
};
index = _local1[Game.currentPortalGroup];
};
}
public function Randomise(){
var _local1:Array;
var _local2:int;
var _local3:PortalGroup;
var _local4:int;
_local1 = new Array();
_local2 = 0;
for each (_local3 in portalGroups) {
if (_local3.timer <= 0){
_local1.push(_local2);
};
_local2++;
};
_local4 = Utils.RandBetweenInt(0, (_local1.length - 1));
index = _local1[_local4];
}
public function GetMode():int{
return (portalGroups[index].mode);
}
public function GetMin():int{
return (portalGroups[index].minGen);
}
}
}//package
Section 82
//PortalGroup (PortalGroup)
package {
public class PortalGroup {
var maxGen:int;
var mode:int;
var enemyName:String;
var timer:int;
var frequency:int;
var minGen:int;
var initialDelay:int;
public static const mode_atplayer = 0;
public static const mode_random = 1;
public function PortalGroup(){
timer = 0;
}
public function Update(){
if (timer > 0){
timer--;
};
}
public function Init(_arg1:String, _arg2:int, _arg3:int, _arg4:Number, _arg5:Number, _arg6:String){
enemyName = _arg1;
minGen = _arg2;
maxGen = _arg3;
frequency = (_arg4 * Defs.fps);
initialDelay = (_arg5 * Defs.fps);
timer = initialDelay;
mode = mode_atplayer;
if (_arg6 == "atplayer"){
mode = mode_atplayer;
};
if (_arg6 == "random"){
mode = mode_random;
};
}
}
}//package
Section 83
//SetupScript (SetupScript)
package {
import flash.geom.*;
public class SetupScript {
static const outputMessages:Boolean = false;
static var main:Main;
static var lastGOGeneratedX;
static var lastGOGeneratedY;
static var lineStartX:int;
static var lineStartY:int;
static var lineType:int;
static var lineRectangle:Rectangle;
static var currentPoly:Poly;
static var lastGOGenerated;
static var lineList:Array;
public static function InitOnce(_arg1:Main){
main = _arg1;
}
static function AddPickup(_arg1:int, _arg2:int):void{
}
static function AddEnemy(_arg1:String, _arg2:int, _arg3:int, _arg4:int):void{
}
static function AddObject(_arg1:String, _arg2:int, _arg3:int, _arg4:String, _arg5:String, _arg6:String, _arg7:int=0, _arg8:int=0, _arg9:Number=0, _arg10:Number=0):void{
var _local11:GameObj;
}
static function LineEnd(_arg1:Boolean){
if (outputMessages){
trace((("SetupScript.LineEnd(" + _arg1) + ");"));
};
currentPoly.Finish(_arg1);
currentPoly.OffsetFromStartPoint();
currentPoly.CalculateCatmullRomLength();
Game.polygonList.push(currentPoly);
}
static function LineStart(_arg1:String, _arg2:int, _arg3:int, _arg4:int, _arg5:String="", _arg6:String="", _arg7:String="", _arg8:String=""){
if (outputMessages){
trace((((((("SetupScript.LineStart(" + _arg2) + ", ") + _arg3) + ", ") + _arg4) + ");"));
};
lineStartX = _arg2;
lineStartY = _arg3;
lineType = _arg4;
currentPoly = new Poly(_arg1, _arg4, _arg2, _arg3);
currentPoly.typeName = _arg5;
currentPoly.subTypeName = _arg6;
currentPoly.iparam0 = int(_arg7);
}
static function LineAdd(_arg1:int, _arg2:int, _arg3:int){
if (outputMessages){
trace((((((("SetupScript.LineAdd(" + _arg1) + ", ") + _arg2) + ", ") + _arg3) + ");"));
};
currentPoly.AddLine(lineStartX, lineStartY, _arg1, _arg2);
lineStartX = _arg1;
lineStartY = _arg2;
}
static function AddExit(_arg1:int, _arg2:int):void{
}
}
}//package
Section 84
//ShadowCopter (ShadowCopter)
package {
import flash.display.*;
public dynamic class ShadowCopter extends MovieClip {
}
}//package
Section 85
//shot2 (shot2)
package {
import flash.media.*;
public dynamic class shot2 extends Sound {
}
}//package
Section 86
//shot3 (shot3)
package {
import flash.media.*;
public dynamic class shot3 extends Sound {
}
}//package
Section 87
//ShotController (ShotController)
package {
import flash.geom.*;
public class ShotController {
public var timer:int;
public var active:Boolean;
public var speed:Number;
public var yoff:Number;
var numShotsFired:int;
public var controlMode:int;
public var fireOffset:Point;
public var minFreq:int;
public var xoff:Number;
public var shots:Array;
public var type:String;
public var maxFreq:int;
public var freq:int;
public function Set(_arg1:String, _arg2:int, _arg3:int, _arg4:Number, _arg5:Number, _arg6:Number){
timer = 0;
type = _arg1;
minFreq = _arg2;
maxFreq = _arg3;
xoff = _arg5;
yoff = _arg6;
speed = _arg4;
freq = 0;
controlMode = 0;
shots = new Array();
numShotsFired = 0;
active = true;
fireOffset = new Point(0, 0);
}
public function SetFireOffset(_arg1:Number, _arg2:Number){
trace(((("set fire offset " + _arg1) + " ") + _arg2));
fireOffset.x = _arg1;
fireOffset.y = _arg2;
}
public function clone():ShotController{
var _local1:ShotController;
var _local2:ShotControllerShot;
_local1 = new ShotController();
_local1.timer = timer;
_local1.xoff = xoff;
_local1.yoff = yoff;
_local1.minFreq = minFreq;
_local1.maxFreq = maxFreq;
_local1.type = type;
_local1.freq = freq;
_local1.speed = speed;
_local1.controlMode = controlMode;
_local1.numShotsFired = numShotsFired;
_local1.active = active;
_local1.shots = new Array();
_local1.fireOffset = fireOffset.clone();
for each (_local2 in shots) {
_local1.shots.push(_local2.clone());
};
return (_local1);
}
public function AddShot(_arg1:String, _arg2:Number, _arg3:Number){
var _local4:ShotControllerShot;
_local4 = new ShotControllerShot();
_local4.offset = (((Math.PI * 2) / 360) * _arg2);
_local4.delay = (_arg3 * Defs.fps2);
if (_arg1 == "atplayer"){
_local4.type = ShotControllerShot.type_atplayer;
};
if (_arg1 == "absolute"){
_local4.type = ShotControllerShot.type_absolute;
};
if (_arg1 == "dir"){
_local4.type = ShotControllerShot.type_dir;
};
shots.push(_local4);
}
public function Reset(){
var _local1:ShotControllerShot;
timer = Utils.RandBetweenInt(0, minFreq);
for each (_local1 in shots) {
_local1.timer = timer;
};
controlMode = 0;
}
public function Update(_arg1:GameObj){
var _local2:Number;
var _local3:Number;
var _local4:ShotControllerShot;
var _local5:GameObj;
var _local6:Matrix;
var _local7:Point;
var _local8:Particle;
_local2 = 0;
_local3 = 0;
if (controlMode == 0){
timer++;
if (timer >= freq){
timer = 0;
freq = Utils.RandBetweenInt(minFreq, maxFreq);
numShotsFired = 0;
controlMode = 1;
for each (_local4 in shots) {
_local4.fired = false;
_local4.timer = 0;
};
};
} else {
if (controlMode == 1){
for each (_local4 in shots) {
if (_local4.fired == false){
_local4.timer++;
if (_local4.timer >= _local4.delay){
_local4.fired = true;
_local4.timer = 0;
if (((!((fireOffset.x == 0))) || (!((fireOffset.y == 0))))){
_local6 = new Matrix();
_local6.rotate(_arg1.fireOffsetDir);
_local7 = _local6.transformPoint(fireOffset);
_local2 = _local7.x;
_local3 = _local7.y;
};
_local5 = GameObjects.AddObj(((_arg1.xpos + xoff) + _local2), ((_arg1.ypos + yoff) + _local3), (_arg1.zpos - 10));
if (_local5.objectDef.particleExplodeID != 0){
_local8 = Particles.Add(((_arg1.xpos + xoff) + _local2), ((_arg1.ypos + yoff) + _local3));
_local8.InitEnemyShotFired(_local5.objectDef.particleExplodeID);
};
numShotsFired++;
};
};
};
if (numShotsFired >= shots.length){
controlMode = 0;
};
};
};
}
}
}//package
Section 88
//ShotControllerShot (ShotControllerShot)
package {
public class ShotControllerShot {
var delay:int;
var timer:int;
var fired:Boolean;
var offset:Number;
var type:int;
static const type_atplayer = 0;
static const type_absolute = 1;
static const type_dir = 2;
public function ShotControllerShot(){
type = 0;
offset = 0;
delay = 0;
timer = 0;
fired = false;
}
public function clone():ShotControllerShot{
var _local1:ShotControllerShot;
_local1 = new ShotControllerShot();
_local1.type = type;
_local1.offset = offset;
_local1.delay = delay;
_local1.timer = timer;
_local1.fired = fired;
return (_local1);
}
}
}//package
Section 89
//SiteLock (SiteLock)
package {
import flash.events.*;
public class SiteLock {
static var miniclip_locked:Boolean = false;
static var sitelockActive:Boolean = false;
public static function InitOnce():void{
}
static function onValidDomain(_arg1:Event):void{
trace("Miniclip sitelock OK");
miniclip_locked = false;
}
public static function IsLocked():Boolean{
var _local1:String;
_local1 = GetDomain();
if (Licensors.GetLicensor() == Licensors.LICENSOR_GAMESLUNATIC_LOCKED){
if (((!((_local1 == "gameslunatic.com"))) && (!((_local1 == "longanimalsgames.com"))))){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_SIKIDS){
if (((!((_local1 == "timeforkids.com"))) && (!((_local1 == "sikids.com"))))){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_SHOCKWAVE){
if (_local1 != "shockwave.com"){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_KING){
if (((!((_local1 == "king.com"))) && (!((_local1 == "midasplayer.com"))))){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_GAMEZHERO){
if (_local1 != "gamezhero.com"){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_ARMORGAMES){
if (_local1 != "armorgames.com"){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_BUBBLEBOX){
if (_local1 != "bubblebox.com"){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_ANDKON){
if (_local1 != "andkon.com"){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_BIGFISH){
if (((((((((((!((_local1 == "bigfishgames.com"))) && (!((_local1 == "bigfishgames.de"))))) && (!((_local1 == "bigfishgames.fr"))))) && (!((_local1 == "bigfishgames.es"))))) && (!((_local1 == "bigfishgames.mx"))))) && (!((_local1 == "bigfishgames.jp"))))){
return (true);
};
return (false);
};
return (false);
}
public static function GetDomain():String{
var _local1:String;
var _local2:Number;
var _local3:Number;
var _local4:String;
var _local5:Number;
var _local6:Number;
_local1 = Main.theStage.loaderInfo.url;
_local2 = (_local1.indexOf("://") + 3);
_local3 = _local1.indexOf("/", _local2);
_local4 = _local1.substring(_local2, _local3);
_local5 = (_local4.lastIndexOf(".") - 1);
_local6 = (_local4.lastIndexOf(".", _local5) + 1);
_local4 = _local4.substring(_local6, _local4.length);
return (_local4);
}
public static function GetDomainFromUrl(_arg1:String):String{
var _local2:Number;
var _local3:Number;
var _local4:String;
var _local5:Number;
var _local6:Number;
_local2 = (_arg1.indexOf("://") + 3);
_local3 = _arg1.indexOf("/", _local2);
_local4 = _arg1.substring(_local2, _local3);
_local5 = (_local4.lastIndexOf(".") - 1);
_local6 = (_local4.lastIndexOf(".", _local5) + 1);
_local4 = _local4.substring(_local6, _local4.length);
return (_local4);
}
static function onInvalidDomain(_arg1:Event):void{
trace("Miniclip sitelock INVALID");
miniclip_locked = true;
}
}
}//package
Section 90
//SoundPlayer (SoundPlayer)
package {
import flash.media.*;
import flash.utils.*;
public class SoundPlayer {
public static const minPlayTime = 3;
public static const sfx_explosion1 = 0;
public static const sfx_explosion2 = 1;
public static const sfx_shot1 = 2;
public static const sfx_shot2 = 3;
static const maxSounds = 6;
public static const SOUND_MAX = 6;
static var doSFX:Boolean;
static var channel:SoundChannel;
public static var startTimes:Array;
static var active = false;
public static var sound:Sound;
public static var volumes:Array;
public static var soundTransform:SoundTransform;
static var main:Main;
static var playingFlag:Boolean;
public static var sounds:Array;
static var timer:Timer;
public static var lengths:Array;
static var timers:Array;
static var Instances:Array;
public static var soundTransforms:Array;
public static var soundNames:Array;
public static var soundChannels:Array;
public static function UpdateOncePerFrame():void{
var _local1:int;
var _local2:int;
var _local3:int;
_local2 = timers.length;
_local1 = 0;
while (_local1 < _local2) {
_local3 = timers[_local1];
if (_local3 > 0){
_local3--;
timers[_local1] = _local3;
};
_local1++;
};
}
static function AddSound(_arg1:Number, _arg2:Number){
startTimes.push((_arg1 * 1000));
lengths.push((_arg2 * 1000));
sounds.push(null);
}
public static function InitOnce(_arg1:Main):void{
var _local2:int;
var _local3:SoundPlay;
doSFX = true;
main = _arg1;
Instances = new Array(maxSounds);
_local2 = 0;
while (_local2 < maxSounds) {
_local3 = new SoundPlay();
_local3.Clear();
Instances[_local2] = _local3;
_local2++;
};
volumes = new Array();
startTimes = new Array();
lengths = new Array();
sounds = new Array();
soundChannels = new Array();
soundTransforms = new Array();
soundNames = new Array();
timers = new Array();
AddSound1(new explo01(), "explo01", 1);
AddSound1(new explo02(), "explo02", 1);
AddSound1(new shot2(), "shot2", 0.3);
AddSound1(new shot3(), "shot3", 0.3);
soundTransform = new SoundTransform(1, 0);
active = true;
playingFlag = false;
}
public static function Play(_arg1:int):void{
var _local2:SoundTransform;
var _local3:Sound;
var _local4:int;
var _local5:SoundPlay;
if (_local4 == -1){
trace("ERROR - SOUNDID");
return;
};
if (doSFX == false){
return;
};
timers[_arg1] = 10;
if (sounds[_arg1] != null){
_local3 = sounds[_arg1];
_local2 = new SoundTransform();
_local2.volume = volumes[_arg1];
_local2.pan = Utils.RandBetweenFloat(-0.5, 0.5);
_local3.play(0, 0, _local2);
} else {
_local4 = 0;
while (_local4 < maxSounds) {
_local5 = Instances[_local4];
if (_local5.Active() == false){
_local5.Play(_arg1);
return;
};
_local4++;
};
};
}
static function AddSound1(_arg1:Sound, _arg2:String, _arg3:Number=1){
sounds.push(_arg1);
startTimes.push(0);
lengths.push(0);
soundNames.push(_arg2);
timers.push(0);
volumes.push(_arg3);
}
public static function GetSoundIdFromString(_arg1:String):int{
var _local2:int;
_local2 = 0;
while (_local2 < soundNames.length) {
if (_arg1 == soundNames[_local2]){
return (_local2);
};
_local2++;
};
return (-1);
}
}
}//package
import flash.events.*;
import flash.media.*;
import flash.utils.*;
class SoundPlay {
private var channel:SoundChannel;
private var timer:Timer;
private var playingFlag;
private function SoundPlay(){
}
private function timerHandler(_arg1:TimerEvent):void{
timer.stop();
channel.stop();
playingFlag = false;
}
public function Clear():void{
playingFlag = false;
timer = null;
}
public function Active():Boolean{
return (playingFlag);
}
public function Play(_arg1:int):void{
channel = SoundPlayer.sound.play(SoundPlayer.startTimes[_arg1], 1, SoundPlayer.soundTransform);
timer = new Timer(SoundPlayer.lengths[_arg1]);
timer.addEventListener(TimerEvent.TIMER, timerHandler);
timer.start();
playingFlag = true;
}
}
Section 91
//Stats (Stats)
package {
public class Stats {
static var highestLevel:int;
static var topScore:int;
public static var levelNumKills:int;
static var totalCash:int;
public static var levelDamage:int;
static var levels_bestTime:Array;
static var numLevel:int;
static var levels_mostCash:Array;
static var numKills:int;
public static var levelTime:int;
static var numWeaponsOwned:int;
public static var levelCash:int;
public static var levelScore:int;
static var levels_bestScore:Array;
public static function EndLevel(){
var _local1:int;
_local1 = Game.currentLevel;
levelTime = Game.levelTimer;
if (levelCash > levels_mostCash[_local1]){
levels_mostCash[_local1] = levelCash;
};
if (levelScore > levels_bestScore[_local1]){
levels_bestScore[_local1] = levelScore;
};
if (levelTime < levels_bestTime[_local1]){
levels_bestTime[_local1] = levelTime;
};
if ((Game.currentLevel + 1) > highestLevel){
highestLevel = (Game.currentLevel + 1);
};
if (Game.currentScore > topScore){
topScore = Game.currentScore;
};
}
public static function StartLevel(){
levelNumKills = 0;
levelScore = 0;
levelTime = 0;
levelCash = 0;
levelDamage = 0;
}
public static function InitOnce(){
var _local1:int;
levels_mostCash = new Array();
levels_bestScore = new Array();
levels_bestTime = new Array();
_local1 = 0;
while (_local1 < 100) {
levels_bestScore.push(int(0));
levels_mostCash.push(int(0));
levels_bestTime.push(int(99999999));
_local1++;
};
topScore = 0;
numKills = 0;
numWeaponsOwned = 0;
highestLevel = 0;
totalCash = 0;
levelNumKills = 0;
levelScore = 0;
levelTime = 0;
levelCash = 0;
}
}
}//package
Section 92
//TailPiece (TailPiece)
package {
public class TailPiece {
var graphicID:int;
var frame:int;
var dir:Number;
var ypos:Number;
var xpos:Number;
}
}//package
Section 93
//TitleScreen (TitleScreen)
package {
import flash.display.*;
public dynamic class TitleScreen extends MovieClip {
public var buttonInstructions:SimpleButton;
public var buttonCredits:SimpleButton;
public var buttonStart:SimpleButton;
public var buttonGamesLunatic:MovieClip;
public var buttonMoreGames:SimpleButton;
public var buttonSound:MovieClip;
}
}//package
Section 94
//TitleScreenState (TitleScreenState)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class TitleScreenState {
static var mc_allocateWeapon:MovieClip;
static var veryFirstTime:Boolean = true;
static var mc_LevelCompleteScreen:MovieClip;
static var mc_IntroMovie:MovieClip;
static var mc_CreditsScreen:MovieClip;
static var mc_weaponDetails:MovieClip;
static var mc_TitleScreen:MovieClip;
static var mc_StartOrContinueScreen:MovieClip;
static var creditsMC:MovieClip;
static var main:Main;
static var mc_PauseScreen:MovieClip;
static var mc_instructions0:MovieClip;
static var helpTextFristTime:Boolean;
static var mc_instructions1:MovieClip;
static var introMovieDone:Boolean = false;
static var mc_WeaponScreen:MovieClip;
static var mc_AllLevelsCompleteScreen:MovieClip;
static var mc_InstructionsScreen:MovieClip;
static var mc_GameOverScreen:MovieClip;
static var mc_PreLevelScreen:MovieClip;
static var overlayMC:MovieClip;
static var titleMC:MovieClip;
static var blockerOverlay:MovieClip;
static var blockerFunction:Function;
static function buttonLonganimalsPressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.longanimalsgames.com"), "_blank");
}
public static function InitTitle(){
blockerFunction = null;
MusicPlayer.StartMusic(0);
main.InitStage();
titleMC = main.AddMovieClip(0, 0, mc_TitleScreen);
titleMC.buttonStart.addEventListener(MouseEvent.CLICK, buttonStartPressed);
titleMC.buttonCredits.addEventListener(MouseEvent.CLICK, buttonCreditsPressed);
titleMC.buttonInstructions.addEventListener(MouseEvent.CLICK, buttonInstructionsPressed);
titleMC.buttonSound.addEventListener(MouseEvent.CLICK, buttonSoundPressed);
titleMC.buttonMoreGames.addEventListener(MouseEvent.CLICK, buttonGamesLunaticPressed);
if (Licensors.GetLicensor() == Licensors.LICENSOR_GAMESLUNATIC_LOCKED){
titleMC.buttonGamesLunatic.gotoAndStop(2);
titleMC.buttonGamesLunatic.useHandCursor = false;
titleMC.buttonGamesLunatic.buttonMode = false;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_GAMESLUNATIC_VIRAL){
titleMC.buttonGamesLunatic.addEventListener(MouseEvent.CLICK, buttonGamesLunaticPressed);
titleMC.buttonGamesLunatic.gotoAndStop(1);
titleMC.buttonGamesLunatic.useHandCursor = true;
titleMC.buttonGamesLunatic.buttonMode = true;
};
};
titleMC.buttonSound.gotoAndStop(2);
if (SoundPlayer.doSFX){
titleMC.buttonSound.gotoAndStop(1);
};
}
public static function InitLevelComplete(){
var _local1:XML;
var _local2:int;
Stats.EndLevel();
Achievements.TestAtLevelComplete();
MusicPlayer.StartMusic(0);
titleMC = main.AddMovieClip(0, 0, mc_LevelCompleteScreen);
titleMC.buttonContinue.addEventListener(MouseEvent.CLICK, InitLevelComplete_buttonContinuePressed);
titleMC.textLevelComplete.text = (("Level " + int((Game.currentLevel + 1)).toString()) + " complete!");
titleMC.textStats.text = ((("You scored " + Stats.levelScore) + " points and earned $") + Stats.levelCash);
Game.currentLevel++;
_local1 = ExternalData.xml;
_local2 = int(_local1.leveldef.length());
if ((((Game.levelsCompleted == false)) && ((Game.currentLevel >= _local2)))){
Game.levelsCompleted = true;
Game.currentLevel = 0;
InitAllLevelsCompleteScreen();
};
}
static function InitHelpText1(_arg1:Boolean=false){
helpTextFristTime = _arg1;
overlayMC = main.AddMovieClip(0, 0, mc_instructions0);
overlayMC.buttonContinue.addEventListener(MouseEvent.CLICK, InitHelpText1_buttonContinuePressed, false, 0, true);
}
public static function InitPreLevelScreen_SetText(){
titleMC.textCurrentLevel.text = ((("Entering level " + int((Game.currentLevel + 1)).toString()) + ": ") + Game.level.name);
titleMC.textLevelInfo.text = "";
titleMC.textUnlocked.text = "";
if (Game.levelsCompleted){
titleMC.textUnlocked.text = "Levels Complete. Choose a level to play";
};
}
static function InitHelpText3(){
overlayMC = main.AddMovieClip(0, 0, mc_instructions1);
overlayMC.buttonContinue.addEventListener(MouseEvent.CLICK, InitHelpText3_buttonContinuePressed, false, 0, true);
}
static function mouseOutLevel(_arg1:MouseEvent):void{
titleMC.textLevelInfo.text = "";
titleMC.textLevelTime.text = "";
titleMC.textLevelScore.text = "";
titleMC.textLevelCash.text = "";
}
public static function buttonCreditsOKPressed(_arg1:MouseEvent){
Game.main.removeChild(creditsMC);
creditsMC = null;
}
public static function AllLevelsCompleteScreen_buttonContinuePressed(_arg1:MouseEvent){
Game.main.removeChild(overlayMC);
overlayMC = null;
}
static function InitHelpText2(){
}
public static function MovieFinished(){
Game.InitGame();
main.SetGameState(Main.gameState_LEVEL_PLAY);
}
static function buttonStartPressed_Complete1(){
}
public static function buttonStartPressed(_arg1:MouseEvent){
GraphicObjects.CompleteBitmapCreation();
Game.InitGame(false);
Game.main.removeChild(titleMC);
titleMC = null;
main.SetGameState(Main.gameState_LEVEL_PLAY);
}
public static function InitGameOver(){
Game.pause = true;
titleMC = main.AddMovieClip(0, 0, mc_GameOverScreen);
titleMC.buttonOK.addEventListener(MouseEvent.CLICK, buttonGameOverOKPressed);
if (Licensors.GetLicensor() == Licensors.LICENSOR_GAMESLUNATIC_LOCKED){
titleMC.buttonGamesLunatic.gotoAndStop(2);
titleMC.buttonGamesLunatic.useHandCursor = false;
titleMC.buttonGamesLunatic.buttonMode = false;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_GAMESLUNATIC_VIRAL){
titleMC.buttonGamesLunatic.addEventListener(MouseEvent.CLICK, buttonGamesLunaticPressed);
titleMC.buttonGamesLunatic.gotoAndStop(1);
titleMC.buttonGamesLunatic.useHandCursor = true;
titleMC.buttonGamesLunatic.buttonMode = true;
};
};
}
static function InitLevelComplete_buttonContinuePressed(_arg1:MouseEvent){
main.removeChild(titleMC);
titleMC = null;
Game.ReloadDataAndRestartLevel();
KeyReader.InitOnce(Game.main.stage);
}
static function buttonShopPressed(_arg1:MouseEvent){
ExitPreLevelScreen();
main.removeChild(titleMC);
titleMC = null;
}
public static function InitPreLevelScreen(){
}
static function PreLevelScreen_buttonContinuePressed(_arg1:MouseEvent){
ExitPreLevelScreen();
main.removeChild(titleMC);
titleMC = null;
KeyReader.InitOnce(Game.main.stage);
Game.pause = false;
}
static function Init(_arg1:Main){
main = _arg1;
InitAll();
if (introMovieDone){
InitTitle();
} else {
main.InitStage();
titleMC = main.AddMovieClip(320, 240, new GamesLunaticIntro());
if (Licensors.GetLicensor() == Licensors.LICENSOR_GAMESLUNATIC_LOCKED){
titleMC.useHandCursor = false;
titleMC.buttonMode = false;
} else {
if (Licensors.GetLicensor() == Licensors.LICENSOR_GAMESLUNATIC_VIRAL){
titleMC.addEventListener(MouseEvent.CLICK, buttonGamesLunaticPressed);
titleMC.useHandCursor = true;
titleMC.buttonMode = true;
};
};
};
}
public static function SetFrameUpdateText(_arg1:int, _arg2:int){
if (titleMC == null){
return;
};
}
public static function buttonInstructionsPressed(_arg1:MouseEvent){
creditsMC = mc_InstructionsScreen;
Game.main.addChild(creditsMC);
creditsMC.buttonOK.addEventListener(MouseEvent.CLICK, buttonCreditsOKPressed);
}
public static function StartOrContinue_buttonStartPressed(_arg1:MouseEvent){
Game.main.removeChild(overlayMC);
overlayMC = null;
Game.InitGame(false);
InitHelpText1(true);
}
static function buttonStartPressed_Complete(){
Game.InitGame(false);
main.SetGameState(Main.gameState_LEVEL_PLAY);
}
public static function GamesLunaticIntroMovieFinished(){
MusicPlayer.StartMusic(2);
introMovieDone = true;
main.removeChild(titleMC);
titleMC = null;
titleMC = main.AddMovieClip(320, 240, new IntroMovie());
trace("HERE");
}
static function PlayBlockerIn(_arg1:Function){
blockerFunction = _arg1;
Game.main.addChild(blockerOverlay);
}
static function buttonGamesLunaticPressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.gameslunatic.com"), "_blank");
}
public static function ExitPreLevelScreen(){
var _local1:XML;
var _local2:int;
var _local3:int;
var _local4:DisplayObject;
_local1 = ExternalData.xml;
_local2 = int(_local1.leveldef.length());
_local3 = 0;
while (_local3 < _local2) {
_local4 = titleMC.getChildAt(_local3);
_local4.removeEventListener(MouseEvent.MOUSE_OVER, mouseOverLevel);
_local4.removeEventListener(MouseEvent.MOUSE_OUT, mouseOutLevel);
if (Game.levelsCompleted){
_local4.removeEventListener(MouseEvent.CLICK, mouseClickLevel);
};
_local4 = null;
_local3++;
};
}
static function InitAllLevelsCompleteScreen(){
overlayMC = main.AddMovieClip(0, 0, mc_AllLevelsCompleteScreen);
overlayMC.buttonContinue.addEventListener(MouseEvent.CLICK, AllLevelsCompleteScreen_buttonContinuePressed, false, 0, true);
}
public static function InitHelpText1_buttonContinuePressed(_arg1:MouseEvent){
Game.main.removeChild(overlayMC);
overlayMC = null;
InitHelpText2();
}
public static function IntroMovieFinished(){
introMovieDone = true;
main.removeChild(titleMC);
titleMC = null;
InitTitle();
}
public static function InitHelpText3_buttonContinuePressed(_arg1:MouseEvent){
Game.main.removeChild(overlayMC);
overlayMC = null;
if (helpTextFristTime == true){
GraphicObjects.CompleteBitmapCreation();
Game.main.removeChild(titleMC);
titleMC = null;
main.SetGameState(Main.gameState_LEVEL_PLAY);
};
}
static function mouseClickLevel(_arg1:MouseEvent):void{
var _local2:String;
var _local3:int;
_local2 = _arg1.currentTarget.name;
_local3 = int(_local2);
Game.currentLevel = _local3;
InitPreLevelScreen_SetText();
}
static function buttonSoundPressed(_arg1:MouseEvent){
var _local2:Boolean;
_local2 = MusicPlayer.doMusic;
if (_local2 == true){
MusicPlayer.PauseMusic();
MusicPlayer.doMusic = false;
} else {
MusicPlayer.doMusic = true;
MusicPlayer.ResumeMusic();
};
_local2 = SoundPlayer.doSFX;
SoundPlayer.doSFX = (_local2 == false);
titleMC.buttonSound.gotoAndStop(2);
if (SoundPlayer.doSFX){
titleMC.buttonSound.gotoAndStop(1);
};
}
static function InitStartOrContinueScreen(){
overlayMC = main.AddMovieClip(0, 0, mc_StartOrContinueScreen);
overlayMC.buttonNewGame.addEventListener(MouseEvent.CLICK, StartOrContinue_buttonStartPressed, false, 0, true);
overlayMC.buttonContinue.addEventListener(MouseEvent.CLICK, StartOrContinue_buttonContinuePressed, false, 0, true);
}
public static function Update(_arg1:Main){
}
static function mouseOverLevel(_arg1:MouseEvent):void{
var _local2:XML;
var _local3:int;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:int;
_local2 = ExternalData.xml;
_local3 = int(_local2.leveldef.length());
_local4 = _arg1.currentTarget.name;
_local5 = int(_local4);
_local6 = _local2.leveldef[_local5].info.@name;
titleMC.textLevelInfo.text = _local6;
_local7 = Stats.levels_bestTime[_local5];
if (_local7 >= 999999){
titleMC.textLevelTime.text = "----";
} else {
titleMC.textLevelTime.text = _local7;
};
titleMC.textLevelScore.text = Stats.levels_bestScore[_local5];
titleMC.textLevelCash.text = Stats.levels_mostCash[_local5];
}
public static function BlockerOutComplete(){
if (blockerFunction != null){
blockerOverlay.stop();
Game.main.removeChild(blockerOverlay);
blockerOverlay = null;
blockerFunction();
blockerFunction = null;
};
}
static function PlayBlockerOut(_arg1:Function){
blockerFunction = _arg1;
Game.main.addChild(blockerOverlay);
}
public static function InitAll(){
if (veryFirstTime == false){
return;
};
veryFirstTime = true;
mc_PauseScreen = new PauseScreen();
mc_TitleScreen = new TitleScreen();
mc_InstructionsScreen = new InstructionsScreen();
mc_CreditsScreen = new CreditsScreen();
mc_GameOverScreen = new GameOverScreen();
}
static function buttonGameOverOKPressed(_arg1:MouseEvent){
main.removeChild(titleMC);
titleMC = null;
Game.main.SetGameState(Main.gameState_TITLE);
}
public static function BlockerInComplete(){
if (blockerFunction != null){
blockerOverlay.stop();
Game.main.removeChild(blockerOverlay);
blockerOverlay = null;
blockerFunction();
blockerFunction = null;
};
}
public static function buttonCreditsPressed(_arg1:MouseEvent){
creditsMC = mc_CreditsScreen;
Game.main.addChild(creditsMC);
creditsMC.buttonOK.addEventListener(MouseEvent.CLICK, buttonCreditsOKPressed);
}
static function buttonGameOverQuitPressed(_arg1:MouseEvent){
main.removeChild(titleMC);
titleMC = null;
main.SetGameState(Main.gameState_TITLE);
}
public static function StartOrContinue_buttonContinuePressed(_arg1:MouseEvent){
Game.main.removeChild(overlayMC);
overlayMC = null;
Game.InitGame(true);
InitHelpText1(true);
}
public static function InitHelpText2_buttonContinuePressed(_arg1:MouseEvent){
Game.main.removeChild(overlayMC);
overlayMC = null;
InitHelpText3();
}
}
}//package
Section 95
//Trail (Trail)
package {
import flash.display.*;
public dynamic class Trail extends MovieClip {
}
}//package
Section 96
//Utils (Utils)
package {
import flash.display.*;
import flash.geom.*;
public class Utils {
public static function RandPointInCircle(_arg1:Number):Point{
var _local2:Point;
var _local3:Number;
var _local4:Number;
_local2 = new Point();
_local3 = RandBetweenFloat(0, _arg1);
_local4 = (Math.random() * (Math.PI * 2));
_local2.x = (Math.cos(_local4) * _local3);
_local2.y = (Math.sin(_local4) * _local3);
return (_local2);
}
static function SideOfLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Boolean{
var _local7:Number;
_local7 = DotProduct((_arg3 - _arg1), (_arg4 - _arg2), (_arg5 - _arg1), (_arg6 - _arg2));
if (_local7 < 0){
return (false);
};
return (true);
}
public static function LimitNumber(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg3 < _arg1){
_arg3 = _arg1;
};
if (_arg3 > _arg2){
_arg3 = _arg2;
};
return (_arg3);
}
public static function ScaleTo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):Number{
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local6 = (_arg4 - _arg3);
_local7 = (_arg2 - _arg1);
_local8 = ((1 / _local6) * (_arg5 - _arg3));
_local8 = ((_local7 * _local8) + _arg1);
return (_local8);
}
static function DotProduct(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
_local5 = ((_arg1 * _arg3) + (_arg2 * _arg4));
return (_local5);
}
static function RenderDotLine(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:int, _arg7:uint):void{
var _local8:int;
var _local9:int;
var _local10:Number;
var _local11:Number;
_local9 = _arg6;
_local10 = ((_arg4 - _arg2) / Number(_local9));
_local11 = ((_arg5 - _arg3) / Number(_local9));
_local8 = 0;
while (_local8 < _local9) {
_arg2 = (_arg2 + _local10);
_arg3 = (_arg3 + _local11);
_arg1.setPixel32(int(_arg2), int(_arg3), _arg7);
_local8++;
};
}
static function RandBool():Boolean{
if (Math.random() < 0.5){
return (true);
};
return (false);
}
public static function NormalizeUnit(_arg1:Number):Number{
while (_arg1 < 0) {
_arg1 = (_arg1 + 1);
};
while (_arg1 > 1) {
_arg1--;
};
return (_arg1);
}
public static function DegToRad(_arg1:Number):Number{
return ((((Math.PI * 2) / 360) * _arg1));
}
public static function RadToDeg(_arg1:Number):Number{
return (((360 / (Math.PI * 2)) * _arg1));
}
static function RenderRectangle(_arg1:BitmapData, _arg2:Rectangle, _arg3:uint):void{
RenderDotLine(_arg1, _arg2.left, _arg2.top, _arg2.right, _arg2.top, 100, _arg3);
RenderDotLine(_arg1, _arg2.left, _arg2.bottom, _arg2.right, _arg2.bottom, 100, _arg3);
RenderDotLine(_arg1, _arg2.left, _arg2.top, _arg2.left, _arg2.bottom, 100, _arg3);
RenderDotLine(_arg1, _arg2.right, _arg2.top, _arg2.right, _arg2.bottom, 100, _arg3);
}
public static function LineLength(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
_local5 = (_arg3 - _arg1);
_local6 = (_arg4 - _arg2);
return (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))));
}
public static function LimitInt(_arg1:int, _arg2:int, _arg3:int):int{
if (_arg3 < _arg1){
_arg3 = _arg1;
};
if (_arg3 > _arg2){
_arg3 = _arg2;
};
return (_arg3);
}
static function RandBetweenFloat(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = (Math.random() * (_arg2 - _arg1));
_local3 = (_local3 + _arg1);
return (_local3);
}
static function DistBetweenPoints(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
_local5 = (_arg3 - _arg1);
_local6 = (_arg4 - _arg2);
return (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))));
}
public static function DP2(_arg1:Number):Number{
var _local2:Number;
_local2 = (Math.ceil((_arg1 * 100)) / 100);
return (_local2);
}
public static function NumberToString2DP(_arg1:Number):String{
var _local2:String;
var _local3:int;
var _local4:int;
_local2 = DP2(_arg1).toString();
_local3 = _local2.lastIndexOf(".");
if (_local3 == -1){
_local2.concat(".00");
} else {
_local4 = _local2.length;
if (_local3 == (_local4 - 1)){
_local2.concat("0");
};
};
return (_local2);
}
public static function NormalizeRot(_arg1:Number):Number{
while (_arg1 < 0) {
_arg1 = (_arg1 + (Math.PI * 2));
};
while (_arg1 > (Math.PI * 2)) {
_arg1 = (_arg1 - (Math.PI * 2));
};
return (_arg1);
}
static function RandBetweenInt(_arg1:int, _arg2:int):int{
var _local3:int;
_local3 = (Math.random() * ((_arg2 - _arg1) + 1));
_local3 = (_local3 + _arg1);
return (_local3);
}
static function RenderCircle(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:uint):void{
var _local6:int;
var _local7:Number;
var _local8:int;
var _local9:Number;
var _local10:Number;
var _local11:Number;
_local6 = 100;
_local7 = ((Math.PI * 2) / _local6);
_local9 = 0;
_local8 = 0;
while (_local8 < _local6) {
_local10 = (_arg2 + (Math.cos(_local9) * _arg4));
_local11 = (_arg3 + (Math.sin(_local9) * _arg4));
_local9 = (_local9 + _local7);
_arg1.setPixel32(int(_local10), int(_local11), _arg5);
_local8++;
};
}
static function DotProductAng(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local3 = Math.cos(_arg1);
_local4 = Math.sin(_arg1);
_local5 = Math.cos(_arg2);
_local6 = Math.sin(_arg2);
_local7 = ((_local3 * _local5) + (_local4 * _local6));
return (_local7);
}
public static function RandCircle():Number{
return ((Math.random() * (Math.PI * 2)));
}
public static function DP1(_arg1:Number):Number{
var _local2:Number;
_local2 = (Math.ceil((_arg1 * 10)) / 10);
return (_local2);
}
public static function ScaleBetween(_arg1:Number, _arg2:Number, _arg3:Number):Number{
var _local4:Number;
_local4 = ((_arg2 - _arg1) * _arg3);
_local4 = (_arg1 + _local4);
return (_local4);
}
static function Dist2BetweenPoints(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
_local5 = (_arg3 - _arg1);
_local6 = (_arg4 - _arg2);
return (((_local5 * _local5) + (_local6 * _local6)));
}
}
}//package
Section 97
//WarningOverlay (WarningOverlay)
package {
import flash.display.*;
public dynamic class WarningOverlay extends MovieClip {
}
}//package
Section 98
//WaveDef (WaveDef)
package {
public class WaveDef {
var enemyType:int;
var max:int;
var timer:int;
var freq:int;
var difficulty:int;
public function WaveDef(_arg1:int, _arg2:Number, _arg3:int, _arg4:int){
enemyType = _arg1;
max = _arg3;
freq = (_arg2 * Defs.fps);
timer = 0;
difficulty = _arg4;
}
}
}//package
Section 99
//WaveDefs (WaveDefs)
package {
public class WaveDefs {
static const et_cannon1:int = 0;
static const et_cannon2:int = 1;
static const et_landmine:int = 3;
static const et_max:int = 8;
static const et_copter:int = 6;
static const et_jetpackred:int = 4;
static const et_bouncingbomb:int = 2;
static const et_jetpackblue:int = 5;
static const et_boss:int = 7;
static var times:Array;
static var list:Array;
static function GetRandomEnemyWD(_arg1:int):WaveDef{
var _local2:Array;
var _local3:int;
var _local4:WaveDef;
_local2 = list[_arg1];
_local3 = Utils.RandBetweenInt(0, (_local2.length - 1));
_local4 = _local2[_local3];
return (_local4);
}
public static function InitOnce(){
var _local1:XML;
var _local2:int;
var _local3:int;
var _local4:Array;
var _local5:XML;
var _local6:int;
var _local7:int;
var _local8:XML;
var _local9:int;
list = new Array();
times = new Array();
_local1 = ExternalData.xml;
_local2 = _local1.wavedef.length();
_local3 = 0;
while (_local3 < _local2) {
_local4 = new Array();
_local5 = _local1.wavedef[_local3];
_local6 = _local5.enemy.length();
_local7 = 0;
while (_local7 < _local6) {
_local8 = _local5.enemy[_local7];
_local9 = GetEnemyIdFromName(_local8.@type);
_local4.push(new WaveDef(_local9, Number(_local8.@freq), int(_local8.@max), int(_local8.@difficulty)));
_local7++;
};
times.push(Number(_local5.@time));
list.push(_local4);
_local3++;
};
}
static function GetWaveDefs(_arg1:int):Array{
var _local2:Array;
_local2 = list[_arg1];
return (_local2);
}
static function ResetTimers(_arg1:int):void{
var _local2:WaveDef;
for each (_local2 in list[_arg1]) {
_local2.timer = _local2.max;
};
}
static function GetEnemyIdFromName(_arg1:String):int{
if (_arg1 == "cannon1"){
return (et_cannon1);
};
if (_arg1 == "cannon2"){
return (et_cannon2);
};
if (_arg1 == "bouncingbomb"){
return (et_bouncingbomb);
};
if (_arg1 == "landmine"){
return (et_landmine);
};
if (_arg1 == "jetpackred"){
return (et_jetpackred);
};
if (_arg1 == "jetpackblue"){
return (et_jetpackblue);
};
if (_arg1 == "copter"){
return (et_copter);
};
if (_arg1 == "boss"){
return (et_boss);
};
trace(("Enemy name not found: " + _arg1));
return (0);
}
static function IsBossWave(_arg1:int):Boolean{
var _local2:Array;
var _local3:WaveDef;
_local2 = list[_arg1];
for each (_local3 in _local2) {
if (_local3.enemyType == et_boss){
return (true);
};
};
return (false);
}
static function GetWaveTime(_arg1:int):int{
var _local2:Number;
_local2 = times[_arg1];
return ((_local2 * Defs.fps));
}
}
}//package
Section 100
//Vec (Vec)
package {
import flash.geom.*;
public class Vec {
public var speed:Number;
public var rot:Number;
public function Vec(){
rot = 0;
speed = 0;
}
public function Set(_arg1:Number, _arg2:Number){
rot = _arg1;
speed = _arg2;
}
public function GetUnitYComponent():Number{
return (Math.sin(rot));
}
public function dotRot(_arg1:Number):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = Math.cos(rot);
_local3 = Math.sin(rot);
_local4 = Math.cos(_arg1);
_local5 = Math.sin(_arg1);
_local6 = ((_local2 * _local4) + (_local3 * _local5));
return (_local6);
}
public function Add(_arg1:Vec){
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local2 = (Math.cos(rot) * speed);
_local3 = (Math.sin(rot) * speed);
_local4 = (Math.cos(_arg1.rot) * _arg1.speed);
_local5 = (Math.sin(_arg1.rot) * _arg1.speed);
_local6 = (_local2 + _local4);
_local7 = (_local3 + _local5);
rot = Math.atan2(_local7, _local6);
speed = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
}
public function FromVec(_arg1:Vec){
rot = _arg1.rot;
speed = _arg1.speed;
}
public function SetAngFromDxDy(_arg1:Number, _arg2:Number){
rot = Math.atan2(_arg2, _arg1);
}
function NormalizeRot():void{
while (rot < 0) {
rot = (rot + (Math.PI * 2));
};
while (rot > (Math.PI * 2)) {
rot = (rot - (Math.PI * 2));
};
}
public function GetUnitTangent():Point{
var _local1:Number;
var _local2:Point;
_local1 = (rot + (Math.PI * 0.5));
_local2 = new Point(Math.cos(_local1), Math.sin(_local1));
return (_local2);
}
public function SetAng(_arg1:Number){
rot = _arg1;
}
public function GetYComponent():Number{
return ((Math.sin(rot) * speed));
}
public function GetXComponent():Number{
return ((Math.cos(rot) * speed));
}
public function AddRot(_arg1:Number):void{
rot = (rot + _arg1);
NormalizeRot();
}
public function NearRot(_arg1:Number, _arg2:Number):Boolean{
var _local3:Number;
var _local4:Number;
_local3 = (rot - _arg1);
_local4 = Math.abs(_local3);
if (_local3 > Math.PI){
if (_arg1 < rot){
_arg1 = (_arg1 + (Math.PI * 2));
} else {
_arg1 = (_arg1 - (Math.PI * 2));
};
_local3 = (rot - _arg1);
};
if (Math.abs(_local3) <= _arg2){
return (true);
};
return (false);
}
public function GetUnitXComponent():Number{
return (Math.cos(rot));
}
}
}//package