STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
228114
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2561 · P5121

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/25458455?noj=FRM25458455-9DC" width="1" height="1"></div>

Skill & Physics - Mystic Mine.swf

This is the info page for
Flash #235052

(Click the ID number above for more basic data on this flash file.)


ActionScript [AS3]
Section 1
//AiController (control.AiController) package control { import koon.input.*; import model.*; public class AiController extends Controller { public function AiController(goldcar:GoldCar, iq:Number){ super(goldcar); } override public function tick(indev:UserInput):void{ if (this.goldcar.switchh != null){ this.handle_switching(); }; } public function handle_switching():void{ if (int((Math.random() * 16)) == 0){ this.goldcar.keydown(); }; } } }//package control
Section 2
//Controller (control.Controller) package control { import koon.input.*; import model.*; public class Controller { public var goldcar:GoldCar; public var ground_control:GroundControl; public function Controller(goldcar:GoldCar){ super(); this.goldcar = goldcar; } public function tick(indev:UserInput):void{ } } }//package control
Section 3
//GroundControl (control.GroundControl) package control { import koon.input.*; import model.*; public class GroundControl { public var playfield:Playfield; public var controllers:Array; public function GroundControl(playfield:Playfield){ super(); this.playfield = playfield; this.controllers = new Array(); } public function add_controllers(controllers:Array):void{ var controller:Controller; var i:int; for each (controller in controllers) { controller.goldcar = this.playfield.goldcars[i]; controller.ground_control = this; this.controllers.push(controller); i = (i + 1); }; } public function tick(indev:UserInput):void{ var controller:Controller; for each (controller in this.controllers) { controller.tick(indev); }; if (indev.mouse.went_down(Mouse.LEFT)){ GoldCar(this.playfield.goldcars[0]).keydown(); }; } } }//package control
Section 4
//HumanController (control.HumanController) package control { import koon.input.*; import model.*; public class HumanController extends Controller { public var action_button:uint; public function HumanController(goldcar:GoldCar, action_button:uint){ super(goldcar); this.action_button = action_button; } override public function tick(indev:UserInput):void{ if (indev.key.went_down(this.action_button)){ this.goldcar.keydown(); }; } } }//package control
Section 5
//Event (event.Event) package event { import koon.frame.*; import model.*; public class Event { protected static var play_fuse:Boolean = false; protected static var points:Array = new Array(); public function Event(){ super(); points = new Array(); play_fuse = false; } public static function clock_ring():void{ Resources.get("clockring_sound").play(); } public static function sound_test():void{ } public static function draw(frame:Frame):void{ var point:Point; for each (point in points) { point.draw(frame); }; } public static function dynamite_tick():void{ } public static function update():void{ var point:Point; var new_points:Array = []; for each (point in Event.points) { point.tick(); if (point.is_alive()){ new_points.push(point); }; }; Event.points = new_points; } public static function dynamite_fuse():void{ Event.play_fuse = true; } public static function pickaxe():void{ } public static function clock():void{ Resources.get("clock_sound").play(); } public static function rock_drop():void{ } public static function diamond():void{ Resources.get("diamond_sound").play(); } public static function explosion():void{ Resources.get("explosion_sound").play(); } public static function lamp():void{ } public static function playerkey():void{ } public static function rock():void{ } public static function coin_pickup(score:int, carpos:TrailPosition):void{ Resources.get("coin_sound").play(); Event.points.push(new Point(score, carpos.get_screen_position())); } public static function fireworks_explode():void{ } public static function flag_pickup(score:int, carpos:TrailPosition):void{ Event.points.push(new Point(score, carpos.get_screen_position())); } public static function collect(score:int, carpos:TrailPosition):void{ Resources.get("collect_sound").play(); Event.points.push(new Point(score, carpos.get_screen_position())); } public static function button():void{ } public static function pickaxe_pickup():void{ } public static function fireworks_start():void{ } public static function switch_trail():void{ Resources.get("railswitch_sound").play(); } public static function pickup():void{ Resources.get("pickup_sound").play(); } public static function carhit():void{ Resources.get("carhit_sound").play(); } } }//package event
Section 6
//Point (event.Point) package event { import koon.gfx.*; import flash.geom.*; import koon.frame.*; import flash.text.*; public class Point { protected var pos:Point; protected var font:Font; protected var life:int; protected var text:String; public function Point(score:int, pos:Point){ super(); if (score > 0){ this.text = ("+" + score); } else { this.text = ("" + score); }; this.pos = pos; this.life = 25; this.font = new Font("Edmunds", 16, 4294967295); } public function tick():void{ this.life = (this.life - 1); } public function is_alive():Boolean{ return ((this.life >= 0)); } public function draw(frame:Frame):void{ var pos:Point = new Point((this.pos.x + frame.X_OFFSET), (((this.pos.y + frame.Y_OFFSET) + this.life) - 50)); this.font.draw(this.text, frame.surface, pos.x, pos.y, TextFieldAutoSize.CENTER); } } }//package event
Section 7
//BalloonTipDlg (hud.BalloonTipDlg) package hud { import koon.input.*; import flash.geom.*; import koon.frame.*; import model.*; import koon.gui.*; import control.*; public class BalloonTipDlg extends TipDlg { protected var carpos:TrailPosition; protected var timer:int; protected var playfield:Playfield; public function BalloonTipDlg(scenario:Scenario, ground_control:GroundControl){ super(scenario, ground_control); this.description_field.set_text("With a balloon you can only go up."); this.playfield = new Playfield(); var x:int; var y:int = (5 - 3); this.playfield.level = new Level(); this.playfield.level.set_tile(new Tile(new Point((x + 4), (y + 1)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 3), (y + 1)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 3), (y + 0)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 4), (y + 0)), Tile.WEST_SLOPE_BOT)); this.playfield.level.set_tile(new Tile(new Point((x + 6), (y - 1)), Tile.WEST_SLOPE_TOP)); this.playfield.level.set_tile(new Tile(new Point((x + 7), (y - 1)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 5), (y + 1)), Tile.EAST_SLOPE_TOP)); this.playfield.level.set_tile(new Tile(new Point((x + 5), (y + 2)), Tile.EAST_SLOPE_BOT)); this.playfield.level.set_tile(new Tile(new Point((x + 6), (y + 2)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 7), (y + 2)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 8), (y + 2)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 7), (y + 0)), Tile.NORTH_SLOPE_BOT)); this.playfield.level.set_tile(new Tile(new Point((x + 8), (y + 0)), Tile.NORTH_SLOPE_TOP)); this.playfield.level.set_tile(new Tile(new Point((x + 8), (y + 1)), Tile.FLAT)); this.carpos = new TrailPosition(this.playfield.level.get_tile((x + 8), (y + 1)), 500); this.playfield.goldcars = [new GoldCar(this.carpos, 0)]; this.timer = 0; } override public function draw(frame:Frame):void{ super.draw(frame); frame.optimize_speed = false; frame.draw(this.playfield); frame.optimize_speed = true; } override public function tick(userinput:UserInput, guistate:GuiState):void{ var balloon_cnt:int; super.tick(userinput, guistate); this.playfield.tick(); this.timer = (this.timer + 1); if (this.timer == (25 * 3)){ balloon_cnt = this.playfield.get_pickup_count(Balloon); if (balloon_cnt < 1){ this.playfield.spawn_pickup(new Balloon()); }; } else { if (this.timer == (25 * 9)){ this.playfield.goldcars[0].collectible = null; this.timer = 0; }; }; } } }//package hud
Section 8
//BaseDlg (hud.BaseDlg) package hud { import koon.gfx.*; import flash.geom.*; import koon.frame.*; import koon.gui.*; import control.*; public class BaseDlg extends Dialog { public var is_tip:Boolean;// = false public var small_font:Font; public var background_image:SubSurf; public var font:Font; public var scenario:Scenario; public var large_font:Font; public var is_ready:Boolean; public var slhighscore_font:Font; public var ground_control:GroundControl; public var shighscore_font:Font; public var skill_font:Font; public var highscore_font:Font; public function BaseDlg(scenario:Scenario, ground_control:GroundControl){ super(new Rectangle(50, 45, (800 - 200), (600 - 200))); this.background_image = SubSurf(Resources.get("paperdialog_surf")); this.scenario = scenario; this.ground_control = ground_control; this.font = new Font("Edmunds", 18, 0); this.highscore_font = new Font("Edmunds", 20, 4285163612); this.shighscore_font = new Font("Edmunds", 16, 4285163612); this.slhighscore_font = new Font("Edmunds", 16, 4288678153); this.large_font = new Font("Edmunds", 26, 4278190080); this.small_font = new Font("Edmunds", 16, 4278190080); this.skill_font = new Font("Edmunds", 20, 4288678153); } override public function draw(frame:Frame):void{ this.background_image.draw(frame.surface, this.place.x, this.place.y); super.draw(frame); } } }//package hud
Section 9
//DiamondTipDlg (hud.DiamondTipDlg) package hud { import koon.input.*; import flash.geom.*; import koon.frame.*; import model.*; import koon.gui.*; import control.*; public class DiamondTipDlg extends TipDlg { protected var carpos:TrailPosition; protected var playfield:Playfield; public function DiamondTipDlg(scenario:Scenario, ground_control:GroundControl){ super(scenario, ground_control); this.description_field.set_text("Bring the diamond to a tunnel."); this.playfield = new Playfield(); var x = 3; var y:int = (5 - 3); this.playfield.level = new Level(); this.playfield.level.set_tile(new Enterance(new Point((x + 3), (y + 0)))); this.playfield.level.set_tile(new Tile(new Point((x + 2), (y + 0)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 1), (y + 0)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 0), (y + 0)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 0), (y + 1)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 0), (y + 2)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 0), (y + 3)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 1), (y + 3)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 2), (y + 3)), Tile.FLAT)); this.playfield.level.set_tile(new Enterance(new Point((x + 3), (y + 3)))); this.carpos = new TrailPosition(this.playfield.level.get_tile((x + 1), y), 500); this.carpos.reverse_progress(); this.playfield.goldcars = [new GoldCar(this.carpos.clone(), 0)]; } override public function draw(frame:Frame):void{ super.draw(frame); frame.optimize_speed = false; frame.draw(this.playfield); frame.optimize_speed = true; } override public function tick(userinput:UserInput, guistate:GuiState):void{ super.tick(userinput, guistate); this.playfield.tick(); var diamond_cnt:int = this.playfield.get_pickup_count(Diamond); if (diamond_cnt < 1){ this.playfield.spawn_pickup(new Diamond()); }; } } }//package hud
Section 10
//DynamiteTipDlg (hud.DynamiteTipDlg) package hud { import koon.input.*; import model.*; import koon.gui.*; import control.*; public class DynamiteTipDlg extends PassPickupTipDlg { protected var dynamite:Dynamite; public function DynamiteTipDlg(scenario:Scenario, ground_control:GroundControl){ super(scenario, ground_control); this.description_field.set_text("Pass the dynamite by bumping into other car."); this.dynamite = new Dynamite(); this.playfield.goldcars[0].add_pickup(this.dynamite); } override public function tick(userinput:UserInput, guistate:GuiState):void{ super.tick(userinput, guistate); this.dynamite.life = 0.9; if (((((this.is_ready) && (!((this.dynamite == null))))) && (!((this.dynamite.fuse_sound == null))))){ this.dynamite.fuse_sound.stop(); }; } } }//package hud
Section 11
//Hud (hud.Hud) package hud { import koon.input.*; import koon.gfx.*; import koon.frame.*; import model.*; import koon.gui.*; import control.*; import flash.text.*; import event.*; public class Hud { protected var font_white:Font; public var dialog:BaseDlg; public var scenario:Scenario; public var last_clock_ring:int; public var next_dialog:BaseDlg;// = null public var game_data:GameData; public var ground_control:GroundControl; public var guistate:GuiState; public var menu_btn:Button; public function Hud(scenario:Scenario, ground_control:GroundControl, game_data:GameData){ super(); this.font_white = new Font("Edmunds", 16, 0xFFFFFF); this.scenario = scenario; this.ground_control = ground_control; this.game_data = game_data; this.guistate = new GuiState(); this.last_clock_ring = -1; } public function start_name_screen():void{ this.dialog = new NameDlg(this.scenario, this.ground_control, this.game_data); } public function draw(frame:Frame):void{ Surface(Resources.get("hud_surf")).draw(frame.surface, 0, 0); this.font_white.draw("Score:", frame.surface, 10, 9); this.font_white.draw(String(GoldCar(this.scenario.playfield.goldcars[0]).score), frame.surface, 37, 32, TextFieldAutoSize.CENTER); var timeout:int = this.scenario.get_timeout(); if (timeout != -1){ this.font_white.draw("Time:", frame.surface, 10, 63); this.font_white.draw(String(timeout), frame.surface, 37, 86, TextFieldAutoSize.CENTER); }; if (this.dialog != null){ this.dialog.draw(frame); } else { this.font_white.draw(this.scenario.mission_txt, frame.surface, 130, 5); }; } public function append_coupon_screen():void{ this.next_dialog = new PromoDlg(this.scenario, this.ground_control, this.game_data); } public function is_ready():Boolean{ if (this.dialog.is_tip){ return (false); }; if (this.dialog != null){ return (this.dialog.is_ready); }; return (true); } public function end_info():void{ this.dialog = null; } public function start_intro_screen():void{ this.dialog = null; this.dialog = this.get_tip_dialog(); if (this.dialog == null){ this.dialog = new IntroDlg(this.scenario, this.ground_control, this.game_data); }; } public function tick(indev:UserInput):void{ if (this.dialog != null){ this.dialog.tick(indev, null); if (((this.dialog.is_tip) && (TipDlg(this.dialog).is_ready))){ this.dialog = new IntroDlg(this.scenario, this.ground_control, this.game_data); } else { if (((this.dialog.is_ready) && (!((this.next_dialog == null))))){ this.dialog = this.next_dialog; this.next_dialog = null; }; }; }; var timeout:int = this.scenario.get_timeout(); if ((((timeout >= 0)) && ((timeout <= 10)))){ if (timeout != this.last_clock_ring){ if (timeout > 0){ Event.clock(); } else { Event.clock_ring(); }; this.last_clock_ring = timeout; }; }; } public function start_win_screen():void{ this.dialog = new WinDlg(this.scenario, this.ground_control, this.game_data); } public function get_tip_dialog():TipDlg{ if (this.game_data.quest.current_learn == RandomQuest.LEARN_SWITCH){ return (new TrackTipDlg(this.scenario, this.ground_control)); }; if (this.game_data.quest.current_learn == RandomQuest.LEARN_DIAMOND){ return (new DiamondTipDlg(this.scenario, this.ground_control)); }; if (this.game_data.quest.current_learn == RandomQuest.LEARN_PASS_DIAMOND){ return (new PassDiamondTipDlg(this.scenario, this.ground_control)); }; if (this.game_data.quest.current_learn == RandomQuest.LEARN_DYNAMITE){ return (new DynamiteTipDlg(this.scenario, this.ground_control)); }; if (this.game_data.quest.current_learn == RandomQuest.LEARN_BALLOON){ return (new BalloonTipDlg(this.scenario, this.ground_control)); }; if (this.game_data.quest.current_learn == RandomQuest.LEARN_OILER){ return (new OilerTipDlg(this.scenario, this.ground_control)); }; return (null); } public function start_lose_screen():void{ this.dialog = new LoseDlg(this.scenario, this.ground_control, this.game_data); } } }//package hud
Section 12
//IntroDlg (hud.IntroDlg) package hud { import koon.gfx.*; import flash.geom.*; import koon.frame.*; import model.*; import flash.utils.*; import koon.gui.*; import control.*; import flash.text.*; public class IntroDlg extends MultiDlg { protected var left_anim_timer:LoopAnimationTimer; protected var title_sprite_left_y:int; protected var right_anim_timer:LoopAnimationTimer; protected var title_sprite_left:IDrawable; protected var title_sprite_right_y:int; protected var game_data:GameData; protected var title_sprite_right:IDrawable; protected var pickup_y:int; protected var description_field:TextField; protected var pickup_surf:IDrawable; public function IntroDlg(scenario:Scenario, ground_control:GroundControl, game_data:GameData){ super(scenario, ground_control); this.game_data = game_data; this.description_field = new TextField(new Rectangle(110, 120, 400, 400), this.font); this.description_field.set_text(this.scenario.description); this.description_field.is_enabled = false; this.add_subcomponent(this.description_field); init_pickup_surf(); init_title_sprites(); } public function draw_opponents(surface:Surface, time_sec:Number, pos:Point):void{ var i:int; var offset:Point; var sprite:SpriteFilm; var opponent_count:int = this.game_data.get_quest().get_opponent_iqs().length; if (opponent_count > 0){ this.small_font.draw("opponents:", surface, pos.x, pos.y); pos = new Point(((pos.x + 130) - (35 * ((opponent_count - 1) / 2))), (pos.y + 20)); i = 0; while (i < opponent_count) { offset = new Point((i * 40), 0); sprite = Resources.get((("car" + (i + 2)) + "_sprite")).clone(); sprite.nr = 0; sprite.draw(surface, (pos.x + offset.x), (pos.y + offset.y)); i++; }; }; } override public function draw(frame:Frame):void{ var highscores:Array; var score:Highscore; super.draw(frame); var center:Point = new Point((640 / 2), (480 / 2)); var y:int = (center.y - 160); draw_title(frame.surface, frame.time_sec, new Point(center.x, y)); draw_opponents(frame.surface, frame.time_sec, new Point((center.x - 190), (y + 100))); draw_pickup(frame.surface, frame.time_sec, new Point((center.x + 40), (y + 100))); y = 220; this.highscore_font.draw("Online Highscores", frame.surface, (center.x - 140), y, TextFieldAutoSize.LEFT); y = (y + 25); if (this.game_data.get_quest().current_level.is_loaded){ highscores = this.game_data.get_quest().current_level.highscores; if (((!((highscores == null))) && ((highscores.length > 0)))){ for each (score in highscores) { this.shighscore_font.draw((score.place + ". "), frame.surface, (center.x - 200), y); this.shighscore_font.draw(score.name, frame.surface, (center.x - 140), y); this.shighscore_font.draw(String(score.score), frame.surface, (center.x + 200), y, TextFieldAutoSize.RIGHT); y = (y + 20); }; } else { this.shighscore_font.draw("No highscores available", frame.surface, (center.x - 200), y); }; } else { this.shighscore_font.draw("Loading highscores...", frame.surface, (center.x - 200), y); }; this.small_font.draw("Your current skill:", frame.surface, (center.x - 130), 355, TextFieldAutoSize.CENTER); this.skill_font.draw((((this.game_data.skill_level.name + " (") + int((this.game_data.skill_level.value * 100))) + "%)"), frame.surface, (center.x - 130), 380, TextFieldAutoSize.CENTER); } public function init_pickup_surf():void{ var pickup:Class; this.pickup_surf = null; this.pickup_y = 30; if (this.scenario.pickups.length > 0){ pickup = Class(this.scenario.pickups[0]); if (pickup == Oiler){ this.pickup_surf = Resources.get("oiler_sprite").clone(); } else { if (pickup == Balloon){ this.pickup_surf = Resources.get("balloon_sprite").clone(); this.pickup_y = 15; }; }; }; } public function draw_pickup(surface:Surface, time_sec:Number, pos:Point):void{ if (this.pickup_surf != null){ this.small_font.draw("pickup:", surface, pos.x, pos.y); this.pickup_surf.draw(surface, (pos.x + 90), (pos.y + this.pickup_y)); }; } public function draw_title(surface:Surface, time_sec:Number, pos:Point):void{ this.large_font.draw(("Game: " + this.scenario.title), surface, pos.x, pos.y, TextFieldAutoSize.CENTER); var width = 300; var left_pos:Point = new Point(((pos.x - (width / 2)) - 25), (pos.y + this.title_sprite_left_y)); var right_pos:Point = new Point(((pos.x + (width / 2)) + 25), (pos.y + this.title_sprite_right_y)); if (this.title_sprite_left != null){ if (this.left_anim_timer != null){ SpriteFilm(this.title_sprite_left).nr = this.left_anim_timer.get_frame(time_sec); }; this.title_sprite_left.draw(surface, left_pos.x, left_pos.y); }; if (this.title_sprite_right != null){ if (this.right_anim_timer != null){ SpriteFilm(this.title_sprite_right).nr = this.right_anim_timer.get_frame(time_sec); }; this.title_sprite_right.draw(surface, right_pos.x, right_pos.y); }; } public function init_title_sprites():void{ this.title_sprite_left = null; this.title_sprite_right = null; this.title_sprite_left_y = 0; this.title_sprite_right_y = 0; if (getQualifiedClassName(this.scenario) == "ScenarioCoinCollect"){ this.title_sprite_left = Resources.get("copper_sprite").clone(); this.title_sprite_right = Resources.get("copper_sprite").clone(); this.left_anim_timer = new LoopAnimationTimer(25, 0, SpriteFilm(this.title_sprite_left).max_x); this.right_anim_timer = new LoopAnimationTimer(25, 0, SpriteFilm(this.title_sprite_left).max_x); this.title_sprite_left_y = 23; this.title_sprite_right_y = 23; } else { if (getQualifiedClassName(this.scenario) == "ScenarioBlowup"){ this.title_sprite_left = Resources.get("dynamite_sprite").clone(); this.title_sprite_right = Resources.get("dynamite_sprite").clone(); this.left_anim_timer = null; this.right_anim_timer = null; this.title_sprite_left_y = 35; this.title_sprite_right_y = 35; } else { if (getQualifiedClassName(this.scenario) == "ScenarioDiamondCollect"){ this.title_sprite_left = Resources.get("diamond_sprite").clone(); this.title_sprite_right = Resources.get("diamond_sprite").clone(); this.left_anim_timer = new LoopAnimationTimer(25, 0, 4); this.right_anim_timer = new LoopAnimationTimer(25, 0, 4); this.title_sprite_left_y = 27; this.title_sprite_right_y = 27; } else { if (getQualifiedClassName(this.scenario) == "ScenarioCollectAll"){ this.title_sprite_left = Resources.get("copper_sprite").clone(); this.title_sprite_right = Resources.get("diamond_sprite").clone(); this.left_anim_timer = new LoopAnimationTimer(25, 0, SpriteFilm(this.title_sprite_left).max_x); this.right_anim_timer = new LoopAnimationTimer(25, 0, 4); this.title_sprite_left_y = 23; this.title_sprite_right_y = 27; }; }; }; }; } } }//package hud
Section 13
//LoseDlg (hud.LoseDlg) package hud { import flash.geom.*; import koon.frame.*; import control.*; import flash.text.*; public class LoseDlg extends SingleDlg { public function LoseDlg(scenario:Scenario, ground_control:GroundControl, game_data:GameData){ super(scenario, ground_control, game_data); } override public function draw(frame:Frame):void{ super.draw(frame); var center:Point = new Point((640 / 2), (480 / 2)); var y:int = (center.y - 160); this.large_font.draw("Not good!", frame.surface, center.x, y, TextFieldAutoSize.CENTER); } } }//package hud
Section 14
//MultiDlg (hud.MultiDlg) package hud { import koon.input.*; import koon.gfx.*; import flash.geom.*; import koon.frame.*; import koon.gui.*; import control.*; public class MultiDlg extends BaseDlg { public var readys:Array; protected var play_btn:Button; public var no_input_timeout:int; public var anim_timer:LoopAnimationTimer; public function MultiDlg(scenario:Scenario, ground_control:GroundControl){ super(scenario, ground_control); this.no_input_timeout = (25 * 1); this.is_ready = false; this.anim_timer = new LoopAnimationTimer(15, 0, 12); this.play_btn = new Button(new Rectangle(430, 380, 100, 30)); this.play_btn.view.set_label("Play", this.font); this.add_subcomponent(this.play_btn); } override public function draw(frame:Frame):void{ super.draw(frame); } public function all_is_ready():Boolean{ return (this.is_ready); } override public function tick(userinput:UserInput, guistate:GuiState):void{ super.tick(userinput, guistate); if (this.no_input_timeout <= 0){ if (((userinput.key.went_down(HumanController(this.ground_control.controllers[0]).action_button)) || (this.play_btn.went_down))){ this.is_ready = true; }; } else { this.no_input_timeout = (this.no_input_timeout - 1); }; } } }//package hud
Section 15
//NameDlg (hud.NameDlg) package hud { import koon.input.*; import flash.geom.*; import koon.frame.*; import koon.gui.*; import control.*; import flash.text.*; import flash.ui.*; public class NameDlg extends MultiDlg { protected var cursor_cnt:int; protected var cursor:String; protected var game_data:GameData; public function NameDlg(scenario:Scenario, ground_control:GroundControl, game_data:GameData){ super(scenario, ground_control); this.game_data = game_data; this.cursor = ""; this.cursor_cnt = 0; this.game_data.player_name = ""; this.play_btn.view.set_label("OK", this.font); } override public function draw(frame:Frame):void{ super.draw(frame); var center:Point = new Point((640 / 2), (480 / 2)); var y:int = (center.y - 160); this.large_font.draw("New Highscore!", frame.surface, center.x, 90, TextFieldAutoSize.CENTER); this.font.draw("(type in your name for online highscores)", frame.surface, center.x, 140, TextFieldAutoSize.CENTER); this.font.draw((("Player Name: " + this.game_data.player_name) + this.cursor), frame.surface, (center.x - 200), 200); } override public function tick(userinput:UserInput, guistate:GuiState):void{ this.play_btn.tick(userinput, this.guistate); this.cursor_cnt = ((this.cursor_cnt + 1) % 10); if (this.cursor_cnt > 3){ this.cursor = "|"; } else { this.cursor = ""; }; this.game_data.player_name = (this.game_data.player_name + userinput.key.get_chars()); if (this.game_data.player_name.length > 16){ this.game_data.player_name = this.game_data.player_name.substr(0, 16); }; if (((userinput.key.went_down(Keyboard.BACKSPACE)) && ((this.game_data.player_name.length > 0)))){ this.game_data.player_name = this.game_data.player_name.substr(0, (this.game_data.player_name.length - 1)); }; if (((((((userinput.key.went_down(Keyboard.ENTER)) || (userinput.key.went_down(Keyboard.NUMPAD_ENTER)))) || (this.play_btn.went_down))) && ((this.game_data.player_name.length > 0)))){ this.is_ready = true; }; } } }//package hud
Section 16
//OilerTipDlg (hud.OilerTipDlg) package hud { import koon.input.*; import flash.geom.*; import koon.frame.*; import model.*; import koon.gui.*; import control.*; public class OilerTipDlg extends TipDlg { protected var carpos:TrailPosition; protected var timer:int; protected var playfield:Playfield; public function OilerTipDlg(scenario:Scenario, ground_control:GroundControl){ super(scenario, ground_control); this.description_field.set_text("Go up slopes with oil."); this.playfield = new Playfield(); var x = 3; var y:int = (4 - 3); this.playfield.level = new Level(); this.playfield.level.set_tile(new Tile(new Point((x + 0), (y + 4)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 0), (y + 3)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 0), (y + 2)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 0), (y + 1)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 1), (y + 1)), Tile.WEST_SLOPE_BOT)); this.playfield.level.set_tile(new Tile(new Point((x + 3), (y + 0)), Tile.WEST_SLOPE_TOP)); this.playfield.level.set_tile(new Tile(new Point((x + 4), (y + 0)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 4), (y + 1)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 4), (y + 2)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 4), (y + 3)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 1), (y + 4)), Tile.WEST_SLOPE_BOT)); this.playfield.level.set_tile(new Tile(new Point((x + 3), (y + 3)), Tile.WEST_SLOPE_TOP)); this.carpos = new TrailPosition(this.playfield.level.get_tile((x + 0), (y + 1)), 500); this.carpos.reverse_progress(); this.playfield.goldcars = [new GoldCar(this.carpos, 0)]; this.timer = 0; } override public function draw(frame:Frame):void{ super.draw(frame); frame.optimize_speed = false; frame.draw(this.playfield); frame.optimize_speed = true; } override public function tick(userinput:UserInput, guistate:GuiState):void{ var oil_cnt:int; var x:int; var y:int; var tile:Tile; super.tick(userinput, guistate); this.playfield.tick(); this.timer = (this.timer + 1); if (this.timer == (25 * 3)){ oil_cnt = this.playfield.get_pickup_count(Oiler); if (oil_cnt < 1){ x = 3; y = ((4 + 3) - 3); tile = this.playfield.level.get_tile(x, y); tile.pickup = new Oiler(); tile.pickup.container = tile; }; } else { if (this.timer == (25 * 11)){ this.playfield.goldcars[0].modifier = null; this.timer = 0; }; }; } } }//package hud
Section 17
//PassDiamondTipDlg (hud.PassDiamondTipDlg) package hud { import model.*; import control.*; public class PassDiamondTipDlg extends PassPickupTipDlg { protected var diamond:Diamond; public function PassDiamondTipDlg(scenario:Scenario, ground_control:GroundControl){ super(scenario, ground_control); this.description_field.set_text("Pass the diamond by bumping into other car."); this.diamond = new Diamond(); this.playfield.goldcars[0].add_pickup(this.diamond); } } }//package hud
Section 18
//PassPickupTipDlg (hud.PassPickupTipDlg) package hud { import koon.input.*; import flash.geom.*; import koon.frame.*; import model.*; import koon.gui.*; import control.*; public class PassPickupTipDlg extends TipDlg { protected var playfield:Playfield; public function PassPickupTipDlg(scenario:Scenario, ground_control:GroundControl){ super(scenario, ground_control); this.playfield = new Playfield(); this.playfield.level = new Level(); this._fill_level(); } override public function draw(frame:Frame):void{ super.draw(frame); frame.optimize_speed = false; frame.draw(this.playfield); frame.optimize_speed = true; } override public function tick(userinput:UserInput, guistate:GuiState):void{ super.tick(userinput, guistate); this.playfield.tick(); } public function _fill_level():void{ var x = 2; var y:int = (7 - 3); this.playfield.level.set_tile(new Tile(new Point((x + 0), (y - 1)), Tile.EAST_SLOPE_TOP)); this.playfield.level.set_tile(new Tile(new Point((x + 0), y), Tile.EAST_SLOPE_BOT)); this.playfield.level.set_tile(new Tile(new Point((x + 1), y), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 2), y), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 3), y), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 4), y), Tile.WEST_SLOPE_BOT)); this.playfield.level.set_tile(new Tile(new Point((x + 6), (y - 1)), Tile.WEST_SLOPE_TOP)); this.playfield.goldcars = [new GoldCar(new TrailPosition(this.playfield.level.get_tile((x + 1), y), 500), 0), new GoldCar(new TrailPosition(this.playfield.level.get_tile((x + 3), y), 500), 1)]; } } }//package hud
Section 19
//PromoDlg (hud.PromoDlg) package hud { import koon.input.*; import koon.gfx.*; import flash.geom.*; import koon.frame.*; import koon.gui.*; import control.*; import flash.text.*; import flash.net.*; public class PromoDlg extends BaseDlg { public var amount_back_font:Font; public var download_btn:Button; public var btn_font:Font; public var amount_font:Font; protected var game_data:GameData; public var skip_btn:Button; public function PromoDlg(scenario:Scenario, ground_control:GroundControl, game_data:GameData){ super(scenario, ground_control); this.game_data = game_data; this.download_btn = new Button(new Rectangle(148, 381, 334, 43)); this.download_btn.view = new ButtonView(this.download_btn); this.skip_btn = new Button(new Rectangle(148, 427, 334, 43)); this.skip_btn.view = new ButtonView(this.skip_btn); this.btn_font = new Font("Edmunds", 18, 4278190080); this.amount_font = new Font("Edmunds", 24, 4278190080); this.amount_back_font = new Font("Edmunds", 24, 4294967261); } override public function draw(frame:Frame):void{ super.draw(frame); Surface(Resources.get("add_coupon")).draw(frame.surface, 0, 0); this.amount_back_font.draw(this.game_data.promo_amount, frame.surface, (307 + 2), (60 + 2), TextFieldAutoSize.CENTER); this.amount_font.draw(this.game_data.promo_amount, frame.surface, 307, 60, TextFieldAutoSize.CENTER); this.btn_font.draw((("Click here to claim your " + this.game_data.promo_amount) + " coupon."), frame.surface, 318, 394, TextFieldAutoSize.CENTER); } override public function tick(userinput:UserInput, guistate:GuiState):void{ super.tick(userinput, guistate); this.download_btn.tick(userinput, guistate); this.skip_btn.tick(userinput, guistate); if (this.download_btn.went_down){ navigateToURL(new URLRequest("http://www.koonsolo.com/mysticmine/flashcoupon.php?utm_source=flash&utm_medium=flash&utm_campaign=flashcoupon")); }; if (this.skip_btn.went_down){ this.is_ready = true; }; } } }//package hud
Section 20
//SingleDlg (hud.SingleDlg) package hud { import koon.input.*; import flash.geom.*; import koon.frame.*; import model.*; import koon.gui.*; import control.*; import flash.text.*; public class SingleDlg extends MultiDlg { protected var scorehl_cnt:int; public var game_data:GameData; public function SingleDlg(scenario:Scenario, ground_control:GroundControl, game_data:GameData){ super(scenario, ground_control); this.game_data = game_data; this.play_btn.view.set_label("Next", this.font); this.scorehl_cnt = 0; } override public function draw(frame:Frame):void{ var gained_str:String; var highscores:Array; var prev_place:int; var score:Highscore; super.draw(frame); var center:Point = new Point((640 / 2), (480 / 2)); var y = 120; var skill:SkillLevel = new SkillLevel(this.game_data.quest.get_completed_skill(this.scenario)); this.small_font.draw("Played level as:", frame.surface, (center.x - 20), (y + 3), TextFieldAutoSize.RIGHT); this.skill_font.draw((((skill.name + " (") + int((skill.value * 100))) + "%)"), frame.surface, (center.x - 10), y); y = (y + 30); var gained:int = ((this.game_data.skill_level.value - this.game_data.skill_level.old_value) * 100); if (gained >= 0){ this.small_font.draw("Skill points gained:", frame.surface, (center.x - 20), (y + 3), TextFieldAutoSize.RIGHT); gained_str = ("+" + gained); } else { this.small_font.draw("Skill points lost:", frame.surface, (center.x - 20), (y + 3), TextFieldAutoSize.RIGHT); gained_str = ("" + gained); }; this.skill_font.draw(gained_str, frame.surface, (center.x - 10), y); y = 180; this.highscore_font.draw("Online Highscores", frame.surface, (center.x - 140), y, TextFieldAutoSize.LEFT); var my_name:String = this.game_data.player_name; var my_score:int = GoldCar(this.scenario.playfield.goldcars[0]).score; var my_found:Boolean; y = (y + 25); if (this.game_data.get_quest().current_level.is_saved){ highscores = this.game_data.get_quest().current_level.highscores; if (((!((highscores == null))) && ((highscores.length > 0)))){ prev_place = 0; for each (score in highscores) { if (prev_place != (score.place - 1)){ y = (y - 10); this.shighscore_font.draw("...", frame.surface, (center.x - 200), y); this.shighscore_font.draw("...", frame.surface, (center.x - 140), y); this.shighscore_font.draw("...", frame.surface, (center.x + 200), y, TextFieldAutoSize.RIGHT); y = (y + 18); }; prev_place = score.place; if (((((((!(my_found)) && ((this.scorehl_cnt > 0)))) && ((my_name == score.name)))) && ((my_score == score.score)))){ this.slhighscore_font.draw((score.place + ". "), frame.surface, (center.x - 200), y); this.slhighscore_font.draw(score.name, frame.surface, (center.x - 140), y); this.slhighscore_font.draw(String(score.score), frame.surface, (center.x + 200), y, TextFieldAutoSize.RIGHT); my_found = true; } else { this.shighscore_font.draw((score.place + ". "), frame.surface, (center.x - 200), y); this.shighscore_font.draw(score.name, frame.surface, (center.x - 140), y); this.shighscore_font.draw(String(score.score), frame.surface, (center.x + 200), y, TextFieldAutoSize.RIGHT); }; y = (y + 19); }; } else { this.shighscore_font.draw("No highscores available", frame.surface, (center.x - 200), y); }; } else { this.shighscore_font.draw("Loading highscores...", frame.surface, (center.x - 200), y); }; this.small_font.draw("Your current skill:", frame.surface, (center.x - 130), 355, TextFieldAutoSize.CENTER); this.skill_font.draw((((this.game_data.skill_level.name + " (") + int((this.game_data.skill_level.value * 100))) + "%)"), frame.surface, (center.x - 130), 380, TextFieldAutoSize.CENTER); } override public function tick(userinput:UserInput, guistate:GuiState):void{ super.tick(userinput, guistate); this.scorehl_cnt = (this.scorehl_cnt + 1); if (this.scorehl_cnt > 5){ this.scorehl_cnt = -5; }; } } }//package hud
Section 21
//TipDlg (hud.TipDlg) package hud { import koon.input.*; import flash.geom.*; import koon.frame.*; import koon.gui.*; import control.*; import flash.text.*; import flash.ui.*; public class TipDlg extends BaseDlg { protected var play_btn:Button; protected var description_field:TextField; public function TipDlg(scenario:Scenario, ground_control:GroundControl){ super(scenario, ground_control); this.play_btn = new Button(new Rectangle(430, 380, 100, 30)); this.play_btn.view.set_label("OK", this.font); this.add_subcomponent(this.play_btn); this.description_field = new TextField(new Rectangle(110, 130, 400, 400), this.font); this.description_field.is_enabled = false; this.add_subcomponent(this.description_field); this.is_ready = false; this.is_tip = true; } override public function draw(frame:Frame):void{ super.draw(frame); var center:Point = new Point((640 / 2), (480 / 2)); var y:int = (center.y - 160); this.large_font.draw("Info:", frame.surface, center.x, y, TextFieldAutoSize.CENTER); } override public function tick(userinput:UserInput, guistate:GuiState):void{ super.tick(userinput, guistate); if (((userinput.key.went_down(Keyboard.SPACE)) || (this.play_btn.went_down))){ this.is_ready = true; }; } } }//package hud
Section 22
//TrackTipDlg (hud.TrackTipDlg) package hud { import koon.input.*; import flash.geom.*; import koon.frame.*; import model.*; import koon.gui.*; import control.*; public class TrackTipDlg extends TipDlg { protected var carpos:TrailPosition; protected var timer:int; protected var playfield:Playfield; public function TrackTipDlg(scenario:Scenario, ground_control:GroundControl){ super(scenario, ground_control); this.description_field.set_text("Switch the track with spacebar. You can also click with your mouse to switch it."); this.playfield = new Playfield(); var x = 2; var y:int = (7 - 3); this.playfield.level = new Level(); this.playfield.level.set_tile(new Tile(new Point((x + 0), y), Tile.FLAT, Trail.EW)); this.playfield.level.set_tile(new Tile(new Point((x + 1), y), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 2), y), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 3), y), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 3), (y + 1)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 3), (y + 2)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 3), (y - 1)), Tile.FLAT)); this.playfield.level.set_tile(new Tile(new Point((x + 3), (y - 2)), Tile.FLAT)); this.carpos = new TrailPosition(this.playfield.level.get_tile((x + 1), y), 500); this.carpos.reverse_progress(); this.playfield.goldcars = [new GoldCar(this.carpos.clone(), 0)]; this.timer = 0; } override public function draw(frame:Frame):void{ super.draw(frame); frame.xtrapol = 0; frame.optimize_speed = false; frame.draw(this.playfield); frame.optimize_speed = true; } override public function tick(userinput:UserInput, guistate:GuiState):void{ super.tick(userinput, guistate); this.playfield.tick(); GoldCar(this.playfield.goldcars[0]).pos = this.carpos.clone(); GoldCar(this.playfield.goldcars[0]).select_next_switch(); this.timer = (this.timer + 1); if (this.timer > 15){ GoldCar(this.playfield.goldcars[0]).keydown(); this.timer = 0; }; } } }//package hud
Section 23
//WinDlg (hud.WinDlg) package hud { import koon.input.*; import koon.gfx.*; import flash.geom.*; import koon.frame.*; import koon.gui.*; import control.*; import flash.text.*; import flash.net.*; public class WinDlg extends SingleDlg { protected var add_offset:int; protected var download_btn:Button; protected var add_text:String; public var add_font:Font; protected static const ADD_SPEED:int = 10; public function WinDlg(scenario:Scenario, ground_control:GroundControl, game_data:GameData){ super(scenario, ground_control, game_data); this.download_btn = new Button(new Rectangle((((640 - 525) / 2) + 157), ((480 - 66) + 35), 208, 31)); this.download_btn.view = new ButtonView(this.download_btn); this.add_font = new Font("Edmunds", 18, 4294967295); if ((((game_data.quest.progress_cnt >= game_data.feature_first)) && ((((game_data.quest.progress_cnt - game_data.feature_first) % game_data.feature_div) == 0)))){ add_offset = (-25 * 1); } else { add_offset = -500; }; var texts:Array = ["170 extra levels in the extended version!", "5 extra scenarios in the extended version!", "4 extra pickups in the extended version!", "6 people multiplayer in the extended version!", "High quality graphics in the extended version!", "Fullscreen gaming in the extended version!", "Bigger levels in the extended version!", "Play adventure mode in the extended version!", "Smarter opponents in the extended version!", "The extended version supports multiplayer!"]; this.add_text = texts[int((Math.random() * texts.length))]; } override public function tick(userinput:UserInput, guistate:GuiState):void{ super.tick(userinput, guistate); if (add_offset <= -500){ } else { if (add_offset < 66){ add_offset = (add_offset + ADD_SPEED); } else { this.download_btn.tick(userinput, new GuiState()); if (this.download_btn.went_down){ navigateToURL(new URLRequest("http://www.koonsolo.com/mysticmine/flashpromo.php?utm_source=flash&utm_medium=flash&utm_campaign=flashfeature")); }; }; }; } override public function draw(frame:Frame):void{ var yy:int; super.draw(frame); var center:Point = new Point((640 / 2), (480 / 2)); var y:int = (center.y - 160); this.large_font.draw("Nice job!", frame.surface, center.x, y, TextFieldAutoSize.CENTER); if (add_offset > 0){ yy = 66; if (add_offset < 66){ yy = (add_offset + (ADD_SPEED * frame.xtrapol)); }; Surface(Resources.get("add_end")).draw(frame.surface, ((640 - 525) / 2), (480 - yy)); this.add_font.draw(this.add_text, frame.surface, 320, ((480 - yy) + 7), TextFieldAutoSize.CENTER); }; } } }//package hud
Section 24
//Game (koon.app.Game) package koon.app { import flash.events.*; import koon.input.*; import koon.gfx.*; import flash.display.*; import flash.utils.*; import flash.text.*; public class Game extends Sprite { protected var next_game_tick:int; private var display_bitmap:Bitmap; protected var frame_cnt:int; protected var userinput:UserInput; protected var fps:int; protected var next_half_second:int; private var display_surf:Surface; protected var input_text_field:TextField; public static var GAMETICKS:int = (1000 / TICKS_PER_SECOND); public static var TICKS_PER_SECOND:int = 25; public function Game():void{ input_text_field = new TextField(); userinput = new UserInput(); super(); if (stage){ start_loop(); } else { addEventListener(Event.ADDED_TO_STAGE, start_loop); }; input_text_field.type = TextFieldType.INPUT; input_text_field.addEventListener(TextEvent.TEXT_INPUT, handle_text_input); input_text_field.x = -50; this.addChild(input_text_field); } private function on_mouse_move(event:Event):void{ var mouse_event:MouseEvent = MouseEvent(event); this.userinput.mouse.feed_pos(mouse_event.stageX, mouse_event.stageY); } private function run_tick(event:Event):void{ var loop_count:int; while ((((getTimer() > this.next_game_tick)) && ((loop_count < 4)))) { this.tick(this.userinput); this.userinput.update(); this.next_game_tick = (this.next_game_tick + GAMETICKS); loop_count = (loop_count + 1); }; if (loop_count >= 4){ this.next_game_tick = getTimer(); }; var time_sec:Number = (getTimer() * 0.001); var xtrapol:Number = (1 - ((this.next_game_tick - getTimer()) / Number(GAMETICKS))); this.display_surf.bitmap_data.lock(); this.render(this.display_surf, xtrapol, time_sec); this.display_surf.bitmap_data.unlock(); this.frame_cnt = (this.frame_cnt + 1); if (getTimer() > this.next_half_second){ this.fps = (this.frame_cnt * 2); this.frame_cnt = 0; this.next_half_second = (this.next_half_second + 500); }; stage.focus = input_text_field; } private function on_mouse_up(event:Event):void{ var mouse_event:MouseEvent = MouseEvent(event); this.userinput.mouse.feed_up(Mouse.LEFT); } public function render(surface:Surface, xtrapol:Number, time_sec:Number):void{ } private function on_key_up(event:Event):void{ var key_event:KeyboardEvent = KeyboardEvent(event); this.userinput.key.feed_up(key_event.keyCode); } private function on_mouse_down(event:Event):void{ var mouse_event:MouseEvent = MouseEvent(event); this.userinput.mouse.feed_down(Mouse.LEFT); } public function tick(inp:UserInput):void{ } private function start_loop(e:Event=null):void{ removeEventListener(Event.ADDED_TO_STAGE, start_loop); this.display_surf = Surface.create_surface(640, 480); this.display_bitmap = new Bitmap(this.display_surf.bitmap_data); addChild(this.display_bitmap); this.next_game_tick = getTimer(); this.frame_cnt = 0; this.next_half_second = getTimer(); stage.addEventListener(KeyboardEvent.KEY_DOWN, on_key_down); stage.addEventListener(KeyboardEvent.KEY_UP, on_key_up); stage.addEventListener(MouseEvent.MOUSE_DOWN, on_mouse_down); stage.addEventListener(MouseEvent.MOUSE_UP, on_mouse_up); stage.addEventListener(MouseEvent.MOUSE_MOVE, on_mouse_move); addEventListener(Event.ENTER_FRAME, run_tick); } private function on_key_down(event:Event):void{ var key_event:KeyboardEvent = KeyboardEvent(event); this.userinput.key.feed_down(key_event.keyCode); } private function handle_text_input(event:TextEvent):void{ event.preventDefault(); this.userinput.key.feed_char(event.text); } protected function draw_fps():void{ var font:Font = new Font(null, 10, 0xFFFFFF); font.draw(String(this.fps), this.display_surf, 0, 0); } public static function set_game_speed(slowdown:int):void{ Game.TICKS_PER_SECOND = (25 * slowdown); Game.GAMETICKS = (1000 / TICKS_PER_SECOND); } } }//package koon.app
Section 25
//Frame (koon.frame.Frame) package koon.frame { import koon.gfx.*; public class Frame { public var xtrapol:Number; public var optimize_speed:Boolean; public var surface:Surface; public var Y_OFFSET:int;// = 300 public var X_OFFSET:int;// = 20 public var time_sec:Number; public function Frame(surface:Surface, xtrapol:Number, time_sec:Number){ super(); this.surface = surface; this.xtrapol = xtrapol; this.time_sec = time_sec; this.optimize_speed = true; } public function draw_z(models:Array):void{ var model:GameModel; var sview:GameView; var view:GameView; var submodels:Array; var submodel:GameModel; var subview:GameView; var views:Array = new Array(); for each (model in models) { for each (view in ViewRepository.get_views(model)) { views.push(view); submodels = view.get_submodels(); if (submodels != null){ for each (submodel in submodels) { for each (subview in ViewRepository.get_views(submodel)) { views.push(subview); }; }; }; }; }; views.sortOn("z", Array.NUMERIC); for each (sview in views) { sview.draw(this); }; } public function draw(model:GameModel):void{ var view:GameView; for each (view in ViewRepository.get_views(model)) { view.draw(this); }; } } }//package koon.frame
Section 26
//GameModel (koon.frame.GameModel) package koon.frame { public class GameModel { public var views:Array;// = null public function GameModel(){ super(); } } }//package koon.frame
Section 27
//GameView (koon.frame.GameView) package koon.frame { public class GameView { public function GameView(model:GameModel){ super(); } public function get_submodels():Array{ return (null); } public function get z():int{ return (0); } public function draw(frame:Frame):void{ } } }//package koon.frame
Section 28
//ViewRepository (koon.frame.ViewRepository) package koon.frame { import flash.utils.*; import koon.util.*; public class ViewRepository { protected static var views:Dictionary = new Dictionary(); public function ViewRepository(){ super(); } public static function register_views(model_type:Class, view_types:Array):void{ _slot1.views[model_type] = view_types; } public static function get_views(model:GameModel):Array{ var model_views:Array; var view_class:Class; if (model.views == null){ model.views = new Array(); model_views = _slot1.views[Koon.get_class(model)]; for each (view_class in model_views) { model.views.push(new view_class(model)); }; }; return (model.views); } } }//package koon.frame
Section 29
//Vec2D (koon.geo.Vec2D) package koon.geo { import flash.geom.*; public class Vec2D { public var x:Number; public var y:Number; public function Vec2D(x:Number, y:Number){ super(); this.x = x; this.y = y; } public function mul(factor:Number):Vec2D{ return (new Vec2D((this.x * factor), (this.y * factor))); } public function length():Number{ return (Math.sqrt(this.length2())); } public function dot(other:Vec2D):Number{ return (((this.x * other.x) + (this.y * other.y))); } public function length2():Number{ return (this.dot(this)); } public function normalize():Vec2D{ return (this.div(this.length())); } public function div(factor:Number):Vec2D{ return (new Vec2D((this.x / factor), (this.y / factor))); } public function negative():Vec2D{ return (new Vec2D(-(this.x), -(this.y))); } public function minus(other:Vec2D):Vec2D{ return (new Vec2D((this.x - other.x), (this.y - other.y))); } public function plus(other:Vec2D):Vec2D{ return (new Vec2D((this.x + other.x), (this.y + other.y))); } public function to_point():Point{ return (new Point(this.x, this.y)); } public function equals(other:Vec2D):Boolean{ return ((((this.x == other.x)) && ((this.y == other.y)))); } public static function from_point(point:Point):Vec2D{ return (new Vec2D(point.x, point.y)); } } }//package koon.geo
Section 30
//Draw (koon.gfx.Draw) package koon.gfx { import flash.geom.*; import flash.display.*; public class Draw { public function Draw(){ super(); } public static function rect(surface:Surface, color:uint, rect:Rectangle, thickness:int):void{ var shape:Shape = new Shape(); shape.graphics.lineStyle(thickness, color); shape.graphics.drawRect(rect.x, rect.y, rect.width, rect.height); surface.bitmap_data.draw(shape); } } }//package koon.gfx
Section 31
//Font (koon.gfx.Font) package koon.gfx { import flash.geom.*; import flash.text.*; public class Font { public var textfield:TextField; public var format:TextFormat; public function Font(name:String, size:int, color:uint){ super(); this.textfield = new TextField(); this.textfield.textColor = color; if (name != null){ this.format = new TextFormat(name, size, color); this.textfield.defaultTextFormat = this.format; this.textfield.embedFonts = true; }; } public function get color():uint{ return (this.textfield.textColor); } public function set color(color:uint):void{ this.textfield.textColor = color; this.format.color = color; } public function draw(text:String, surface:Surface, x:int, y:int, align:String=null):void{ if (align == null){ align = TextFieldAutoSize.LEFT; }; this.textfield.text = text; this.textfield.autoSize = TextFieldAutoSize.LEFT; var matrix:Matrix = new Matrix(); if (align == TextFieldAutoSize.CENTER){ matrix.translate((x - (this.textfield.width / 2)), y); } else { if (align == TextFieldAutoSize.RIGHT){ matrix.translate((x - this.textfield.width), y); } else { matrix.translate(x, y); }; }; surface.bitmap_data.draw(this.textfield, matrix); } public function clone():Font{ return (new Font(this.format.font, int(this.format.size), this.textfield.textColor)); } } }//package koon.gfx
Section 32
//IDrawable (koon.gfx.IDrawable) package koon.gfx { import flash.geom.*; public interface IDrawable { function draw(_arg1:Surface, _arg2:int, _arg3:int, _arg4:Rectangle=null):void; } }//package koon.gfx
Section 33
//LoopAnimationTimer (koon.gfx.LoopAnimationTimer) package koon.gfx { public class LoopAnimationTimer { public var fps:int; public var maxframes:int; public var startframe:int; public var starttime:Number; public var firstframe:int; public function LoopAnimationTimer(fps:int, firstframe:int, maxframes:int){ super(); this.fps = fps; this.firstframe = firstframe; this.maxframes = maxframes; this.set_frame(0, firstframe); } public function get_frame(time:Number):int{ var frame:int = int(((time - this.starttime) * this.fps)); frame = ((frame + this.startframe) % this.maxframes); return ((frame + this.firstframe)); } public function set_frame(time:Number, frame:int):void{ this.starttime = time; this.startframe = frame; } } }//package koon.gfx
Section 34
//SpriteFilm (koon.gfx.SpriteFilm) package koon.gfx { import flash.geom.*; public class SpriteFilm implements IDrawable { public var nr:int;// = 0 public var width:int; public var height:int; public var surface:Surface; public var center:Point; public var max_x:int; public function SpriteFilm(surface:Surface){ center = new Point(0, 0); super(); this.surface = surface; } public function set_dimension(width:int, height:int):void{ this.width = width; this.height = height; this.max_x = (this.surface.bitmap_data.width / width); } public function draw(surface:Surface, x:int, y:int, rect:Rectangle=null):void{ var r:Rectangle; var sp_x:Number = ((this.nr % this.max_x) * this.width); var sp_y:Number = (int((this.nr / this.max_x)) * this.height); var sprite_rect:Rectangle = new Rectangle(sp_x, sp_y, this.width, this.height); if (rect != null){ r = new Rectangle((rect.x + sp_x), (rect.y + sp_y), rect.width, rect.height); sprite_rect = sprite_rect.intersection(r); }; this.surface.draw(surface, (x - this.center.x), (y - this.center.y), sprite_rect); } public function set_div(x_sprites:int, y_sprites:int):void{ this.width = (this.surface.bitmap_data.width / x_sprites); this.height = (this.surface.bitmap_data.height / y_sprites); this.max_x = x_sprites; this.center = new Point((this.width / 2), (this.height / 2)); } public function clone():SpriteFilm{ var sprite:SpriteFilm = new SpriteFilm(this.surface); sprite.nr = this.nr; sprite.width = this.width; sprite.height = this.height; sprite.max_x = this.max_x; sprite.center = new Point(this.center.x, this.center.y); return (sprite); } } }//package koon.gfx
Section 35
//SubSurf (koon.gfx.SubSurf) package koon.gfx { import flash.geom.*; public class SubSurf implements IDrawable { protected var offset:Point; protected var rect:Rectangle; protected var surface:Surface; public function SubSurf(surface:Surface, rect:Rectangle=null, offset:Point=null){ super(); if (offset == null){ offset = new Point(0, 0); }; this.surface = surface; this.rect = rect; this.offset = offset; } public function draw(surface:Surface, x:int, y:int, rectangle:Rectangle=null):void{ var p:Point = new Point(x, y).subtract(this.offset); this.surface.draw(surface, p.x, p.y, this.rect); } } }//package koon.gfx
Section 36
//Surface (koon.gfx.Surface) package koon.gfx { import flash.geom.*; import flash.display.*; public class Surface implements IDrawable { public var bitmap_data:BitmapData; public function Surface(bitmap_data:BitmapData):void{ super(); this.bitmap_data = bitmap_data; } public function fill(rect:Rectangle, color:uint):void{ if (rect == null){ rect = new Rectangle(0, 0, this.bitmap_data.width, this.bitmap_data.height); }; this.bitmap_data.fillRect(rect, color); } public function get_blended(alpha:Number):Surface{ var blended:Surface = new Surface(this.bitmap_data.clone()); blended.bitmap_data.colorTransform(new Rectangle(0, 0, blended.bitmap_data.width, blended.bitmap_data.height), new ColorTransform(1.5, 1.5, 1.5, alpha)); return (blended); } public function draw(surface:Surface, x:int, y:int, rect:Rectangle=null):void{ if (rect == null){ rect = new Rectangle(0, 0, this.bitmap_data.width, this.bitmap_data.height); }; surface.bitmap_data.copyPixels(this.bitmap_data, rect, new Point(x, y)); } public static function create_surface(width:int, height:int):Surface{ return (new Surface(new BitmapData(width, height, false))); } } }//package koon.gfx
Section 37
//Timer (koon.gfx.Timer) package koon.gfx { public class Timer { public var next_tick:Number;// = -1 public var timeskip:Number; public function Timer(hertz:Number){ super(); this.timeskip = (1 / hertz); } public function start(time_sec:Number):void{ this.next_tick = time_sec; } public function tick(time_sec:Number):Boolean{ if (this.next_tick == -1){ this.start((time_sec - this.timeskip)); }; if (this.next_tick < time_sec){ this.next_tick = (this.next_tick + this.timeskip); return (true); }; return (false); } } }//package koon.gfx
Section 38
//Button (koon.gui.Button) package koon.gui { import koon.input.*; import flash.geom.*; import koon.frame.*; import flash.ui.*; public class Button extends Component { public var view:ButtonView; public var active:Boolean; public var is_down:Boolean; public var went_down:Boolean; public static const SELECT_KEYS:Array = [Keyboard.ENTER, Keyboard.SPACE, Keyboard.NUMPAD_ENTER]; public function Button(place:Rectangle){ super(true, place); this.went_down = false; this.is_down = false; this.active = false; this.view = new ButtonView(this); } override public function tick(userinput:UserInput, guistate:GuiState):void{ super.tick(userinput, guistate); this.went_down = false; if (this.is_enabled){ if (((userinput.mouse.went_down(Mouse.LEFT)) && (this.place.containsPoint(userinput.mouse.pos)))){ this.went_down = true; }; if (((((!((guistate == null))) && ((guistate.get_active() == this)))) && (userinput.key.any_went_down(Button.SELECT_KEYS)))){ this.went_down = true; }; this.is_down = false; if (((userinput.mouse.is_down(Mouse.LEFT)) && (this.place.containsPoint(userinput.mouse.pos)))){ this.is_down = true; }; if (((((!((guistate == null))) && ((guistate.get_active() == this)))) && (userinput.key.any_is_down(Button.SELECT_KEYS)))){ this.is_down = true; }; }; this.active = ((!((guistate == null))) && ((guistate.get_active() == this))); } override public function draw(frame:Frame):void{ this.view.draw(frame); } } }//package koon.gui
Section 39
//ButtonImageView (koon.gui.ButtonImageView) package koon.gui { import koon.gfx.*; import flash.geom.*; import koon.frame.*; import flash.text.*; public class ButtonImageView extends ButtonView { protected var sprite:SpriteFilm; public function ButtonImageView(button:Button, sprite:SpriteFilm){ super(button); this.sprite = sprite; this.sprite.nr = 0; } override protected function draw_label(frame:Frame):void{ var pos:Point; if (this.label != null){ pos = new Point((this.button.place.x + (this.sprite.width / 2)), this.button.place.y); pos.y = (pos.y + 8); this.selected_font.draw(this.label, frame.surface, (pos.x + 1), (pos.y + 1), TextFieldAutoSize.CENTER); this.font.draw(this.label, frame.surface, pos.x, pos.y, TextFieldAutoSize.CENTER); }; } override protected function draw_button(frame:Frame):void{ this.sprite.draw(frame.surface, this.button.place.x, this.button.place.y); } } }//package koon.gui
Section 40
//ButtonView (koon.gui.ButtonView) package koon.gui { import koon.gfx.*; import flash.geom.*; import koon.frame.*; import flash.text.*; public class ButtonView extends ComponentView { protected var font:Font; public var button:Button; protected var selected_font:Font; protected var label:String; public function ButtonView(button:Button){ super(button); this.button = button; } override public function draw(frame:Frame):void{ super.draw(frame); this.draw_button(frame); this.draw_label(frame); } protected function draw_button(frame:Frame):void{ if (this.button.active){ Draw.rect(frame.surface, this.selected_font.color, this.button.place, 3); } else { Draw.rect(frame.surface, this.font.color, this.button.place, 3); }; } public function set_label(label:String, font:Font):void{ this.label = label; this.font = font; this.selected_font = font.clone(); this.selected_font.color = (4278190080 & ((font.color + 0xFFFFFF) - (0xFFFFFF & font.color))); } protected function draw_label(frame:Frame):void{ var pos:Point; if (this.label != null){ pos = new Point((this.button.place.x + (this.button.place.width / 2)), this.button.place.y); pos.y = (pos.y + 3); this.font.draw(this.label, frame.surface, pos.x, pos.y, TextFieldAutoSize.CENTER); }; } } }//package koon.gui
Section 41
//Component (koon.gui.Component) package koon.gui { import koon.input.*; import flash.geom.*; import koon.frame.*; public class Component { public var delegate_active:Component; public var prev_neighbor:Component; public var place:Rectangle; public var is_enabled:Boolean; public var is_interactive:Boolean;// = false public var subs:Array; public var has_input_lock:Boolean; public var is_visible:Boolean; public var next_neighbor:Component; public function Component(is_interactive:Boolean=false, place:Rectangle=null){ super(); if (place == null){ place = new Rectangle(0, 0, 0, 0); }; this.subs = new Array(); this.is_enabled = true; this.is_visible = true; this.place = place; this.is_interactive = is_interactive; this.has_input_lock = false; this.next_neighbor = null; this.prev_neighbor = null; this.delegate_active = null; } public function tick(userinput:UserInput, guistate:GuiState):void{ var sub:Component; for each (sub in this.subs) { sub.tick(userinput, guistate); }; } public function draw(frame:Frame):void{ var sub:Component; if (this.is_visible){ for each (sub in this.subs) { sub.draw(frame); }; }; } public function update_neighbors():void{ var i:int; var j:int; var comps:Array = GuiState.get_interactive_components(this); if (comps.length > 2){ i = 0; while (i < (comps.length - 1)) { comps[i].next_neighbor = comps[(i + 1)]; i++; }; j = 1; while (j < comps.length) { comps[j].prev_neighbor = comps[(j - 1)]; j++; }; comps[0].prev_neighbor = comps[(comps.length - 1)]; comps[-1].next_neighbor = comps[0]; }; } public function add_subcomponent(subcomponent:Component):void{ this.subs.push(subcomponent); } public function remove_subcomponent(subcomponent:Component):void{ this.subs.splice(subs.indexOf(subcomponent), 1); } } }//package koon.gui
Section 42
//ComponentView (koon.gui.ComponentView) package koon.gui { import koon.frame.*; public class ComponentView { public function ComponentView(component:Component){ super(); } public function draw(frame:Frame):void{ } } }//package koon.gui
Section 43
//Dialog (koon.gui.Dialog) package koon.gui { import koon.input.*; import flash.geom.*; import koon.frame.*; public class Dialog extends Component { public var guistate:GuiState; public function Dialog(place:Rectangle){ super(true, place); this.guistate = new GuiState(); } override public function draw(frame:Frame):void{ super.draw(frame); } override public function tick(userinput:UserInput, guistate:GuiState):void{ super.tick(userinput, guistate); this.guistate.update(userinput, this); } } }//package koon.gui
Section 44
//GuiState (koon.gui.GuiState) package koon.gui { import koon.input.*; import flash.ui.*; public class GuiState { public var active:Component; public function GuiState(){ super(); this.active = null; } public function set_active(component:Component):void{ this.active = component; } public function activate_prev():void{ if (this.active.prev_neighbor != null){ this.set_active(this.active.prev_neighbor); while (!(this.active.is_enabled)) { this.set_active(this.active.prev_neighbor); }; }; } public function update(userinput:UserInput, component:Component):void{ this._update_active(userinput, component); } public function _update_active(userinput:UserInput, component:Component):void{ var comp:Component; var comp2:Component; var interactives:Array = GuiState.get_interactive_components(component); if (((!((this.active == null))) && (!(this.active.has_input_lock)))){ if (userinput.key.went_down(Keyboard.UP)){ this.activate_prev(); }; if (userinput.key.went_down(Keyboard.DOWN)){ this.activate_next(); }; }; if (((userinput.mouse.has_moved()) && ((((this.active == null)) || (!(this.active.has_input_lock)))))){ for each (comp in interactives) { if (((comp.place.containsPoint(userinput.mouse.pos)) && (comp.is_enabled))){ this.set_active(comp); }; }; }; if (userinput.mouse.went_down(Mouse.LEFT)){ if (((!((this.active == null))) && (this.active.has_input_lock))){ this.active.has_input_lock = false; }; for each (comp2 in interactives) { if (((comp2.place.containsPoint(userinput.mouse.pos)) && (comp2.is_enabled))){ this.set_active(comp2); }; }; }; if ((((((this.active == null)) || ((interactives.indexOf(this.active) < 0)))) || (!(this.active.is_enabled)))){ if (interactives.length > 0){ this.set_active(interactives[0]); }; }; } public function activate_next():void{ if (this.active.next_neighbor != null){ this.set_active(this.active.next_neighbor); while (!(this.active.is_enabled)) { this.set_active(this.active.next_neighbor); }; }; } public function get_active():Component{ return (this.active); } public static function get_interactive_components(component:Component):Array{ var sub:Component; var interactives:Array = new Array(); if (((component.is_interactive) && ((component.delegate_active == null)))){ interactives.push(component); }; for each (sub in component.subs) { interactives = interactives.concat(GuiState.get_interactive_components(sub)); }; return (interactives); } } }//package koon.gui
Section 45
//TextField (koon.gui.TextField) package koon.gui { import koon.gfx.*; import flash.geom.*; import koon.frame.*; import flash.text.*; public class TextField extends Component { protected var text:String; protected var textfield:TextField; protected var font:Font; public function TextField(place:Rectangle, font:Font){ super(false, place); this.font = font; this.textfield = new TextField(); this.textfield.defaultTextFormat = font.format; this.textfield.embedFonts = true; this.textfield.multiline = true; this.textfield.wordWrap = true; this.textfield.width = place.width; this.textfield.height = place.height; } public function set_text(text:String):void{ this.textfield.text = text; } override public function draw(frame:Frame):void{ super.draw(frame); var matrix:Matrix = new Matrix(); matrix.translate(this.place.x, this.place.y); frame.surface.bitmap_data.draw(this.textfield, matrix); } } }//package koon.gui
Section 46
//ButtonLogger (koon.input.ButtonLogger) package koon.input { import flash.utils.*; public class ButtonLogger { protected var down_buttons:Dictionary; protected var went_up_buttons:Dictionary; protected var any_up_counter:int;// = 0 protected var went_down_buttons:Dictionary; protected var any_down_counter:int;// = 0 protected var down_counter:int;// = 0 public function ButtonLogger(){ went_down_buttons = new Dictionary(); went_up_buttons = new Dictionary(); down_buttons = new Dictionary(); super(); } public function any_went_down(keys:Array=null):Boolean{ var key:uint; if (keys != null){ for each (key in keys) { if (this.went_down(key)){ return (true); }; }; return (false); //unresolved jump }; return ((this.any_down_counter > 0)); } public function any_went_up(keys:Array=null):Boolean{ var key:uint; if (keys != null){ for each (key in keys) { if (this.went_up(key)){ return (true); }; }; return (false); //unresolved jump }; return ((this.any_up_counter > 0)); } public function feed_down(button:uint):void{ if (!this.is_down(button)){ this.went_down_buttons[button] = ""; this.down_buttons[button] = ""; this.any_down_counter = (this.any_down_counter + 1); this.down_counter = (this.down_counter + 1); }; } public function went_up(button:uint):Boolean{ return ((this.went_up_buttons[button] == "")); } public function update():void{ this.went_down_buttons = new Dictionary(); this.went_up_buttons = new Dictionary(); this.any_down_counter = 0; this.any_up_counter = 0; } public function went_down(button:uint):Boolean{ return ((this.went_down_buttons[button] == "")); } public function any_is_down(keys:Array=null):Boolean{ var key:uint; if (keys != null){ for each (key in keys) { if (this.is_down(key)){ return (true); }; }; return (false); //unresolved jump }; return ((this.down_counter > 0)); } public function is_down(button:uint):Boolean{ return ((this.down_buttons[button] == "")); } public function feed_up(button:uint):void{ this.went_up_buttons[button] = ""; this.down_buttons[button] = null; this.any_up_counter = (this.any_up_counter + 1); this.down_counter = (this.down_counter - 1); } } }//package koon.input
Section 47
//Keyboard (koon.input.Keyboard) package koon.input { public class Keyboard extends ButtonLogger { protected var char_buffer:String; public function Keyboard(){ super(); this.char_buffer = ""; } override public function update():void{ super.update(); this.char_buffer = ""; } public function get_chars():String{ return (this.char_buffer); } public function feed_char(char:String):void{ this.char_buffer = (this.char_buffer + char); } } }//package koon.input
Section 48
//Mouse (koon.input.Mouse) package koon.input { import flash.geom.*; public class Mouse extends ButtonLogger { public var pos:Point; protected var prev_pos:Point; public static var MIDDLE:int = 1; public static var LEFT:int = 0; public static var RIGHT:int = 2; public function Mouse(){ pos = new Point(0, 0); prev_pos = new Point(0, 0); super(); } public function feed_pos(x:int, y:int):void{ this.prev_pos.x = this.pos.x; this.prev_pos.y = this.pos.y; this.pos.x = x; this.pos.y = y; } public function has_moved():Boolean{ return (!((this.pos == this.prev_pos))); } } }//package koon.input
Section 49
//UserInput (koon.input.UserInput) package koon.input { public class UserInput { public var mouse:Mouse; public var key:Keyboard; public function UserInput(){ key = new Keyboard(); mouse = new Mouse(); super(); } public function update():void{ this.key.update(); this.mouse.update(); } } }//package koon.input
Section 50
//ResourceManager (koon.res.ResourceManager) package koon.res { public class ResourceManager { public function ResourceManager(){ super(); } } }//package koon.res
Section 51
//Music (koon.snd.Music) package koon.snd { import flash.events.*; import flash.media.*; public class Music { public var channel:SoundChannel; public var sound:Sound; public static var our_music_volume:Number = 0.8; public static var our_current_music:Music; public function Music(sound:Sound){ super(); this.sound = sound; this.channel = null; } public function loopMusic(e:Event):void{ if (this.channel != null){ this.channel.removeEventListener(Event.SOUND_COMPLETE, loopMusic); this.channel = this.sound.play(0, 0, new SoundTransform(Music.our_music_volume)); this.channel.addEventListener(Event.SOUND_COMPLETE, loopMusic); }; } public function stop():void{ if (this.channel != null){ this.channel.stop(); this.channel = null; Music.our_current_music = null; }; } public function play():void{ this.channel = this.sound.play(20, int.MAX_VALUE, new SoundTransform(Music.our_music_volume)); Music.our_current_music = this; } public static function set volume(volume:Number):void{ Music.our_music_volume = volume; if (((!((our_current_music == null))) && (!((our_current_music.channel == null))))){ our_current_music.channel.soundTransform = new SoundTransform(volume); }; } public static function get volume():Number{ return (Music.our_music_volume); } } }//package koon.snd
Section 52
//Sound (koon.snd.Sound) package koon.snd { import flash.media.*; public class Sound { public var channel:SoundChannel; public var sound:Sound; public static var our_sound_volume:Number = 0.8; public function Sound(sound:Sound){ super(); this.sound = sound; this.channel = null; } public function stop():void{ if (this.channel != null){ this.channel.stop(); this.channel = null; }; } public function play(loop:int=0):void{ this.channel = this.sound.play(0, loop, new SoundTransform(our_sound_volume)); } public static function set_global_volume(volume:Number):void{ Sound.our_sound_volume = volume; } public static function get_global_volume():Number{ return (Sound.our_sound_volume); } } }//package koon.snd
Section 53
//Koon (koon.util.Koon) package koon.util { import flash.utils.*; public class Koon { public function Koon(){ super(); } public static function lin_ipol(value:Number, a:Number, b:Number, begin:Number=0, end:Number=1):Number{ return ((a + (((value - begin) * (b - a)) / (end - begin)))); } public static function get_class(obj:Object):Class{ return (Class(getDefinitionByName(getQualifiedClassName(obj)))); } } }//package koon.util
Section 54
//MochiBot (koon.util.MochiBot) package koon.util { import flash.display.*; import flash.system.*; import flash.net.*; public dynamic class MochiBot extends Sprite { public function MochiBot(){ super(); } public static function track(parent:Sprite, tag:String):MochiBot{ if (Security.sandboxType == "localWithFile"){ return (null); }; var self:MochiBot = new (MochiBot); parent.addChild(self); Security.allowDomain("*"); Security.allowInsecureDomain("*"); var server:String = "http://core.mochibot.com/my/core.swf"; var lv:URLVariables = new URLVariables(); lv["sb"] = Security.sandboxType; lv["v"] = Capabilities.version; lv["swfid"] = tag; lv["mv"] = "8"; lv["fv"] = "9"; var url:String = self.root.loaderInfo.loaderURL; if (url.indexOf("http") == 0){ lv["url"] = url; } else { lv["url"] = "local"; }; var req:URLRequest = new URLRequest(server); req.contentType = "application/x-www-form-urlencoded"; req.method = URLRequestMethod.POST; req.data = lv; var loader:Loader = new Loader(); self.addChild(loader); loader.load(req); return (self); } } }//package koon.util
Section 55
//SHA1 (koon.util.SHA1) package koon.util { public class SHA1 { public static const HEX_FORMAT_LOWERCASE:uint = 0; public static const BITS_PER_CHAR_ASCII:uint = 8; public static const BASE64_PAD_CHARACTER_DEFAULT_COMPLIANCE:String = ""; public static const HEX_FORMAT_UPPERCASE:uint = 1; public static const BITS_PER_CHAR_UNICODE:uint = 8; public static const BASE64_PAD_CHARACTER_RFC_COMPLIANCE:String = "="; public static var hexcase:uint = 0; public static var chrsz:uint = 8; public static var b64pad:String = ""; public function SHA1(){ super(); } public static function binb2str(bin:Array):String{ var str:String = ""; var mask:Number = ((1 << chrsz) - 1); var i:Number = 0; while (i < (bin.length * 32)) { str = (str + String.fromCharCode(((bin[(i >> 5)] >>> ((32 - chrsz) - (i % 32))) & mask))); i = (i + chrsz); }; return (str); } public static function b64_sha1(string:String):String{ return (binb2b64(core_sha1(str2binb(string), (string.length * chrsz)))); } public static function sha1_ft(t:Number, b:Number, c:Number, d:Number):Number{ if (t < 20){ return (((b & c) | (~(b) & d))); }; if (t < 40){ return (((b ^ c) ^ d)); }; if (t < 60){ return ((((b & c) | (b & d)) | (c & d))); }; return (((b ^ c) ^ d)); } public static function core_hmac_sha1(key:String, data:String):Array{ var bkey:Array = str2binb(key); if (bkey.length > 16){ bkey = core_sha1(bkey, (key.length * chrsz)); }; var ipad:Array = new Array(16); var opad:Array = new Array(16); var i:Number = 0; while (i < 16) { ipad[i] = (bkey[i] ^ 909522486); opad[i] = (bkey[i] ^ 1549556828); i++; }; var hash:Array = core_sha1(ipad.concat(str2binb(data)), (0x0200 + (data.length * chrsz))); return (core_sha1(opad.concat(hash), (0x0200 + 160))); } public static function str_hmac_sha1(key:String, data:String):String{ return (binb2str(core_hmac_sha1(key, data))); } public static function str_sha1(string:String):String{ return (binb2str(core_sha1(str2binb(string), (string.length * chrsz)))); } public static function sha1_vm_test():Boolean{ return ((hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d")); } public static function binb2hex(binarray:Array):String{ var hex_tab:String = (hexcase) ? "0123456789ABCDEF" : "0123456789abcdef"; var str:String = ""; var i:Number = 0; while (i < (binarray.length * 4)) { str = (str + (hex_tab.charAt(((binarray[(i >> 2)] >> (((3 - (i % 4)) * 8) + 4)) & 15)) + hex_tab.charAt(((binarray[(i >> 2)] >> ((3 - (i % 4)) * 8)) & 15)))); i++; }; return (str); } public static function encrypt(string:String):String{ return (hex_sha1(string)); } public static function rol(num:Number, cnt:Number):Number{ return (((num << cnt) | (num >>> (32 - cnt)))); } public static function hex_sha1(string:String):String{ return (binb2hex(core_sha1(str2binb(string), (string.length * chrsz)))); } public static function sha1_kt(t:Number):Number{ return (((t)<20) ? 1518500249 : ((t)<40) ? 1859775393 : ((t)<60) ? -1894007588 : -899497514); } public static function core_sha1(x:Array, len:Number):Array{ var olda:Number; var oldb:Number; var oldc:Number; var oldd:Number; var olde:Number; var j:Number; var t:Number; x[(len >> 5)] = (x[(len >> 5)] | (128 << (24 - (len % 32)))); x[((((len + 64) >> 9) << 4) + 15)] = len; var w:Array = new Array(80); var a:Number = 1732584193; var b:Number = -271733879; var c:Number = -1732584194; var d:Number = 271733878; var e:Number = -1009589776; var i:Number = 0; while (i < x.length) { olda = a; oldb = b; oldc = c; oldd = d; olde = e; j = 0; while (j < 80) { if (j < 16){ w[j] = x[(i + j)]; } else { w[j] = rol((((w[(j - 3)] ^ w[(j - 8)]) ^ w[(j - 14)]) ^ w[(j - 16)]), 1); }; t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), safe_add(safe_add(e, w[j]), sha1_kt(j))); e = d; d = c; c = rol(b, 30); b = a; a = t; j++; }; a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); e = safe_add(e, olde); i = (i + 16); }; return ([a, b, c, d, e]); } public static function binb2b64(binarray:Array):String{ var triplet:Number; var j:Number; var tab:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var str:String = ""; var i:Number = 0; while (i < (binarray.length * 4)) { triplet = (((((binarray[(i >> 2)] >> (8 * (3 - (i % 4)))) & 0xFF) << 16) | (((binarray[((i + 1) >> 2)] >> (8 * (3 - ((i + 1) % 4)))) & 0xFF) << 8)) | ((binarray[((i + 2) >> 2)] >> (8 * (3 - ((i + 2) % 4)))) & 0xFF)); j = 0; while (j < 4) { if (((i * 8) + (j * 6)) > (binarray.length * 32)){ str = (str + b64pad); } else { str = (str + tab.charAt(((triplet >> (6 * (3 - j))) & 63))); }; j++; }; i = (i + 3); }; return (str); } public static function str2binb(str:String):Array{ var bin:Array = new Array(); var mask:Number = ((1 << chrsz) - 1); var i:Number = 0; while (i < (str.length * chrsz)) { bin[(i >> 5)] = (bin[(i >> 5)] | ((str.charCodeAt((i / chrsz)) & mask) << ((32 - chrsz) - (i % 32)))); i = (i + chrsz); }; return (bin); } public static function safe_add(x:Number, y:Number):Number{ var lsw:Number = ((x & 0xFFFF) + (y & 0xFFFF)); var msw:Number = (((x >> 16) + (y >> 16)) + (lsw >> 16)); return (((msw << 16) | (lsw & 0xFFFF))); } public static function hex_hmac_sha1(key:String, data:String):String{ return (binb2hex(core_hmac_sha1(key, data))); } public static function b64_hmac_sha1(key:String, data:String):String{ return (binb2b64(core_hmac_sha1(key, data))); } } }//package koon.util
Section 56
//CarAnimation (menu.CarAnimation) package menu { import koon.input.*; import koon.gfx.*; public class CarAnimation { protected var rails:RailObject; protected var carsprite_car:SubSurf; protected var hat:RailObject; protected var carsprite_man:SubSurf; protected var carsprite_hat:SubSurf; protected var carsprite:SpriteFilm; protected var man:RailObject; protected var car:RailObject; protected var carsprite_hat_front:SubSurf; public function CarAnimation(){ super(); this.carsprite = SpriteFilm(Resources.get("introcar_sprite")); this.carsprite_car = SubSurf(Resources.get("introcar_car")); this.carsprite_man = SubSurf(Resources.get("introcar_man")); this.carsprite_hat = SubSurf(Resources.get("introcar_hat")); this.carsprite_hat_front = SubSurf(Resources.get("introcar_hat_front")); this.rails = new RailObject(0); this.car = new RailObject(1.5); this.man = new RailObject(1); this.hat = new RailObject(1); } public function draw(surface:Surface, interpol:Number, time_sec:Number):void{ this.carsprite.draw(surface, -150, (80 + this.rails.offset)); this.carsprite_hat.draw(surface, -150, (80 + this.hat.offset)); this.carsprite_man.draw(surface, -150, (80 + this.man.offset)); this.carsprite_hat_front.draw(surface, -150, (80 + this.hat.offset)); this.carsprite_car.draw(surface, -150, (80 + this.car.offset)); } public function tick_car(userinput:UserInput):void{ var offset:Number; this.carsprite.nr = ((this.carsprite.nr + 1) % 5); var LOW:Number = (-200 * 1); var HIGH:Number = (105 * 1); offset = ((Math.random() * (HIGH - LOW)) + LOW); if (this.rails.offset > offset){ this.rails.speed = (this.rails.speed - 4.7); } else { this.rails.speed = (this.rails.speed + 4.7); }; this.rails.speed = Math.max(Math.min(this.rails.speed, 8), -8); this.rails.offset = (this.rails.offset + this.rails.speed); this.car.tick(this.rails.offset); this.man.tick(this.car.offset); this.hat.tick(this.man.offset); } public function tick(userinput:UserInput):void{ this.tick_car(userinput); } } }//package menu
Section 57
//RailObject (menu.RailObject) package menu { public class RailObject { public var offset:Number; public var speed:Number; public var weight:Number; public function RailObject(weight:Number){ super(); this.weight = weight; this.offset = 0; this.speed = 0; } public function tick(parent_offset:Number):void{ if (this.offset > parent_offset){ if ((this.offset - 5) > parent_offset){ this.offset = (parent_offset + 5); }; this.speed = (this.speed - (this.weight * 1)); this.offset = (this.offset + this.speed); if (this.offset <= parent_offset){ this.speed = 0; this.offset = parent_offset; }; } else { if (this.offset < parent_offset){ this.speed = (this.speed + this.weight); this.offset = (this.offset + this.speed); if (this.offset >= parent_offset){ this.speed = 0; this.offset = parent_offset; }; }; }; } } }//package menu
Section 58
//Balloon (model.Balloon) package model { public class Balloon extends Powerup { public function Balloon(){ super((20 * 25), true); } } }//package model
Section 59
//Coin (model.Coin) package model { public class Coin extends Collectible { public function Coin(){ super(true); } } }//package model
Section 60
//Collectible (model.Collectible) package model { public class Collectible extends Pickup { public function Collectible(is_good:Boolean=true){ super(); this.is_good = is_good; } } }//package model
Section 61
//Diamond (model.Diamond) package model { public class Diamond extends Collectible { public function Diamond(){ super(true); } } }//package model
Section 62
//Direction (model.Direction) package model { public class Direction { public var id:int; public static const SOUTH:Direction = new Direction(2); ; public static const NORTH:Direction = new Direction(0); ; public static const ALL:Array = [NORTH, EAST, SOUTH, WEST]; public static const EAST:Direction = new Direction(1); ; public static const WEST:Direction = new Direction(3); ; public function Direction(id:int){ super(); this.id = id; } public function get_opposite():Direction{ return (ALL[((this.id + 2) % 4)]); } public function equals(other:Direction):Boolean{ return ((this.id == other.id)); } } }//package model
Section 63
//Dynamite (model.Dynamite) package model { import koon.snd.*; import event.*; public class Dynamite extends Powerup { public var fuse_sound:Sound; public var is_exploding:Boolean;// = false public var life:Number; public static const DEC:Number = 0.004; public function Dynamite(){ super(0, true); this.life = 1; this.is_good = false; this.fuse_sound = Sound(Resources.get("dynamitefuse_sound")); this.fuse_sound.play(int.MAX_VALUE); } public function explode():Boolean{ if (this.life <= 0){ this.fuse_sound.stop(); }; return ((this.life <= 0)); } override public function is_done():Boolean{ return (false); } override public function tick():void{ super.tick(); if (this.life > 0){ this.life = (this.life - Dynamite.DEC); } else { this.is_exploding = true; }; if (this.life > (Dynamite.DEC * 18)){ Event.dynamite_fuse(); }; } } }//package model
Section 64
//Enterance (model.Enterance) package model { import flash.geom.*; public class Enterance extends Tile { public var portals:Array; public function Enterance(pos:Point, trail_type:int=-1){ super(pos, Tile.FLAT, trail_type); } public function get_random_portal():Enterance{ return (this.portals[int((Math.random() * this.portals.length))]); } public function is_north_exit():Boolean{ return (!((this.neighbors[Direction.SOUTH.id] == null))); } } }//package model
Section 65
//Explosion (model.Explosion) package model { import koon.gfx.*; import flash.geom.*; import koon.frame.*; import event.*; public class Explosion { public var animTimer:LoopAnimationTimer; public var sprite:SpriteFilm; public var pos:Point; public var particles:Array; public function Explosion(pos:Point, end_tiles:Array){ var tile:Tile; super(); this.particles = new Array(); for each (tile in end_tiles) { this.particles.push(new GoldParticle(pos, tile)); }; this.pos = pos; this.sprite = Resources.get("explosion_sprite").clone(); this.animTimer = null; Event.explosion(); } public function draw(frame:Frame):void{ var particle:GoldParticle; for each (particle in this.particles) { particle.draw(frame.surface, frame.X_OFFSET, frame.Y_OFFSET); }; if (this.animTimer == null){ this.animTimer = new LoopAnimationTimer(14, 0, 5); this.animTimer.set_frame(frame.time_sec, 0); }; if (this.sprite != null){ this.sprite.nr = this.animTimer.get_frame(frame.time_sec); this.sprite.draw(frame.surface, (this.pos.x + frame.X_OFFSET), (this.pos.y + frame.Y_OFFSET)); if (this.sprite.nr >= 4){ this.sprite = null; }; }; } public function is_alive():Boolean{ return (!((this.sprite == null))); } public function tick():void{ var particle:GoldParticle; var new_particles:Array = new Array(); for each (particle in this.particles) { particle.tick(); if (!particle.is_dead()){ new_particles.push(particle); }; }; this.particles = new_particles; } } }//package model
Section 66
//GoldCar (model.GoldCar) package model { import koon.frame.*; import flash.utils.*; import event.*; public class GoldCar extends GameModel { public var switch_dir:Direction; public var speed:int; public var nr:int; public var switch_dist:int; public var score:int; public var pos:TrailPosition; public var _key_went_down:int; public var modifier:Powerup; public var amount:int; public var switchh:Tile; public var collectible:Pickup; public static const COLLIDE_DISTANCE:int = 500; public function GoldCar(pos:TrailPosition, nr:int){ super(); this.pos = pos; this.speed = 70; this.switchh = null; this.switch_dir = Direction.NORTH; this.score = 0; this.collectible = null; this.modifier = null; this.nr = nr; this.amount = 0; this._key_went_down = 0; } public function keydown():void{ if (this.switchh != null){ this.switchh.switch_it(this.switch_dir); Event.switch_trail(); }; this._key_went_down = 2; } public function key_went_down():Boolean{ return ((this._key_went_down > 0)); } public function clear_switch_and_pos():void{ if (this.switchh != null){ this.switchh.set_selected(false); this.switchh = null; this.pos.tile.trail.may_switch = true; }; } public function add_pickup(pickup:Pickup):void{ var multiplier = 1; if (getQualifiedClassName(pickup) == "model::Coin"){ this.score = (this.score + (1 * multiplier)); Event.coin_pickup(1, this.pos); } else { if (getQualifiedClassName(pickup) == "model::Diamond"){ this.collectible = Collectible(pickup); this.collectible.goldcar = this; this.collectible.container = this; Event.diamond(); } else { if (getQualifiedClassName(pickup) == "model::Dynamite"){ this.collectible = Powerup(pickup); this.collectible.goldcar = this; this.collectible.container = this; Event.pickup(); } else { if (getQualifiedClassName(pickup) == "model::Balloon"){ this.collectible = Powerup(pickup); this.collectible.goldcar = this; this.collectible.container = this; Event.pickup(); } else { if (getQualifiedClassName(pickup) == "model::Oiler"){ this.modifier = Powerup(pickup); this.modifier.goldcar = this; this.modifier.container = this; Event.pickup(); }; }; }; }; }; } public function handle_collision(other:GoldCar):void{ var SPEEDUP:Number; var SLOWDOWN:Number; var tmp:int; var diff:int; var proportion1:Number; var proportion2:Number; SPEEDUP = 1.05; SLOWDOWN = 0.95; if (this.pos.get_distance(other.pos) < GoldCar.COLLIDE_DISTANCE){ Event.carhit(); tmp = this.speed; this.speed = other.speed; other.speed = tmp; if (!this.pos.same_direction(other.pos)){ this.pos.reverse_progress(); other.pos.reverse_progress(); }; diff = (GoldCar.COLLIDE_DISTANCE - this.pos.get_distance(other.pos)); proportion1 = (Number(this.speed) / (this.speed + other.speed)); proportion2 = (Number(other.speed) / (this.speed + other.speed)); if (!this.pos.same_direction(other.pos)){ this.pos.add(int((diff * proportion1))); other.pos.add(int((diff * proportion2))); this.speed = (this.speed * SPEEDUP); other.speed = (other.speed * SPEEDUP); } else { if (this.speed <= other.speed){ this.pos.substract(int((diff * proportion1))); other.pos.add((int((diff * proportion2)) + 1)); this.speed = (this.speed * SLOWDOWN); other.speed = (other.speed * SPEEDUP); } else { this.pos.add((int((diff * proportion1)) + 1)); other.pos.substract(int((diff * proportion2))); this.speed = (this.speed * SPEEDUP); other.speed = (other.speed * SLOWDOWN); }; }; this.switch_collectibles(this, other); } else { if ((((((this.pos.get_distance(other.pos) < ((GoldCar.COLLIDE_DISTANCE * 3) / 2))) && (this.pos.same_direction(other.pos)))) && ((Math.abs((this.speed - other.speed)) < 10)))){ if ((this.pos + this.pos.get_distance(other.pos)) == other.pos){ this.speed = (this.speed * SLOWDOWN); other.speed = (other.speed * SPEEDUP); } else { if ((other.pos + this.pos.get_distance(other.pos)) == this.pos){ this.speed = (this.speed * SPEEDUP); other.speed = (other.speed * SLOWDOWN); } else { trace("Should be one or the other!"); }; }; }; }; } public function tick():void{ if (this.pos == null){ return; }; var old_tile:Tile = this.pos.tile; var MIN_SPEED = 140; var MAX_SPEED = 230; var SLOPE_ACCEL:Number = 1.2; var SLOPE_SLOWDOWN:Number = 0.8; var SPEEDUP:Number = 1.05; if (getQualifiedClassName(this.modifier) == "model::Oiler"){ MIN_SPEED = 150; SLOPE_SLOWDOWN = 0.15; SPEEDUP = 1.5; }; this.speed = int((this.speed * 0.99)); if ((((this.pos.tile.type == Tile.FLAT)) && ((this.speed < MIN_SPEED)))){ this.speed = int(((this.speed + 5) * SPEEDUP)); }; if (((((this.pos.is_reversed()) && (!((getQualifiedClassName(this.collectible) == "model::Balloon"))))) || (((!(this.pos.is_reversed())) && ((getQualifiedClassName(this.collectible) == "model::Balloon")))))){ this.speed = Math.min(int((this.speed + (SLOPE_ACCEL * this.pos.tile.get_angle()))), MAX_SPEED); } else { this.speed = Math.min(int((this.speed - (SLOPE_SLOWDOWN * this.pos.tile.get_angle()))), MAX_SPEED); }; if (this.speed < 0){ this.speed = (this.speed * -1); this.pos.reverse_progress(); this.select_next_switch(); }; this.pos.add(this.speed); if (this.pos.tile != old_tile){ old_tile.trail.may_switch = true; this.pos.tile.trail.may_switch = false; this.select_next_switch(); }; if (this.collectible != null){ this.collectible.tick(); }; if (this.modifier != null){ this.modifier.tick(); if (Powerup(this.modifier).is_done()){ this.modifier = null; }; }; if (this._key_went_down > 0){ this._key_went_down = (this._key_went_down - 1); }; } public function switch_collectibles(car:GoldCar, other:GoldCar):void{ if (car.collectible != null){ car.collectible.jump(); }; if (other.collectible != null){ other.collectible.jump(); }; var tmp:Pickup = car.collectible; car.collectible = other.collectible; other.collectible = tmp; if (car.collectible != null){ car.collectible.container = car; }; if (other.collectible != null){ other.collectible.container = other; }; } public function align_switch():void{ if (this.switchh != null){ this.switchh.trail.align(this.switch_dir); }; } public function select_next_switch():void{ var old_tile:Tile; if (this.switchh != null){ this.switchh.set_selected(false); }; var it:TrailPosition = this.pos.clone(); var out_dir:Direction = it.get_out_direction(); it.to_next_tile(); this.switch_dist = it.tile.get_length(); var count:int; while (((!(it.tile.is_switch())) && ((count < 100)))) { out_dir = it.get_out_direction(); old_tile = it.tile; it.to_next_tile(); if (old_tile == it.tile){ this.switchh = null; return; }; this.switch_dist = (this.switch_dist + it.tile.get_length()); count = (count + 1); }; if (count < 100){ this.switchh = it.tile; this.switch_dir = out_dir.get_opposite(); this.switchh.set_selected(true); } else { this.switchh = null; }; } } }//package model
Section 67
//GoldParticle (model.GoldParticle) package model { import koon.gfx.*; import flash.geom.*; import koon.geo.*; public class GoldParticle { public var end_tile:Tile; public var pos:Vec2D; public var start_pos:Vec2D; public var progress:Number; public function GoldParticle(start_pos:Point, end_tile:Tile){ super(); this.start_pos = Vec2D.from_point(start_pos); this.end_tile = end_tile; this.pos = this.start_pos; this.progress = 0; } public function draw(surface:Surface, x_offset:int, y_offset:int):void{ var gold_sprite:SpriteFilm; if (this.progress <= 1){ gold_sprite = SpriteFilm(Resources.get("copper_sprite")); gold_sprite.draw(surface, (this.pos.x + x_offset), (this.pos.y + y_offset)); }; } public function is_dead():Boolean{ return ((this.progress > 1)); } public function tick():void{ var end_pos:Vec2D; var speed:Number; if (this.progress <= 1){ end_pos = Vec2D.from_point(this.end_tile.get_center()); speed = (20 / end_pos.minus(this.start_pos).length()); this.progress = (this.progress + speed); this.pos = this.start_pos.mul((1 - this.progress)).plus(end_pos.mul(this.progress)); if ((((this.progress > 1)) && ((this.end_tile.pickup == null)))){ this.end_tile.pickup = new Coin(); this.end_tile.pickup.container = this.end_tile; }; }; } } }//package model
Section 68
//Level (model.Level) package model { import koon.frame.*; import flash.utils.*; import koon.geo.*; public class Level extends GameModel { public var tiles:Array; public function Level(){ tiles = new Array(); super(); } public function get_random_flat_tile():Tile{ var tile:Tile; var flat_tiles:Array = new Array(); for each (tile in this.tiles) { if ((((tile.type == Tile.FLAT)) && (!((getQualifiedClassName(tile) == "model::Enterance"))))){ flat_tiles.push(tile); }; }; return (flat_tiles[int((Math.random() * flat_tiles.length))]); } public function get_first_portal():Tile{ var tile:Tile; var portals:Array = new Array(); for each (tile in this.tiles) { if (getQualifiedClassName(tile) == "model::Enterance"){ return (tile); }; }; return (null); } public function update_tile_neighbors(tile:Tile):void{ var direction:Direction; var offset:Vec2D; var neighbor:Tile; if (tile == null){ return; }; for each (direction in Direction.ALL) { offset = Vec2D.from_point(tile.get_neighbor_offset(direction)); neighbor = null; if (((!((offset.x == 0))) || (!((offset.y == 0))))){ neighbor = this.get_tile((tile.pos.x + offset.x), (tile.pos.y + offset.y)); if (neighbor != null){ if (!offset.mul(-1).to_point().equals(neighbor.get_neighbor_offset(direction.get_opposite()))){ neighbor = null; }; }; }; tile.set_neighbor(neighbor, direction); }; } public function align_trails():void{ var tile:Tile; for each (tile in this.tiles) { tile.trail.align(); }; } public function remove_tile(x:int, y:int):void{ var tile:Tile; var i:int; for each (tile in this.tiles) { if ((((tile.pos.x == x)) && ((tile.pos.y == y)))){ this.tiles.splice(i, 1); this.update_neighbors(); this.align_trails(); return; }; i++; }; } public function update_neighbors():void{ var tile:Tile; for each (tile in this.tiles) { this.update_tile_neighbors(tile); }; this.update_portals(); } public function update_portals():void{ var tile:Tile; var portal:Enterance; var others:Array; var portals:Array = new Array(); for each (tile in this.tiles) { if (getQualifiedClassName(tile) == "model::Enterance"){ portals.push(tile); }; }; for each (portal in portals) { others = portals.concat(); others.splice(others.indexOf(portal), 1); portal.portals = others; }; } public function set_tile(tile:Tile):void{ this.remove_tile(tile.pos.x, tile.pos.y); this.tiles.push(tile); this.tiles.sort(tilesort); this.update_neighbors(); this.align_trails(); } public function get_tile(x:int, y:int):Tile{ var tile:Tile; for each (tile in this.tiles) { if ((((tile.pos.x == x)) && ((tile.pos.y == y)))){ return (tile); }; }; return (null); } public function get_first_flat_tile():Tile{ var tile:Tile; for each (tile in this.tiles) { if ((((tile.type == Tile.FLAT)) && (!((getQualifiedClassName(tile) == "model::Enterance"))))){ return (tile); }; }; return (null); } public function get_random_portal():Tile{ var tile:Tile; var portals:Array = new Array(); for each (tile in this.tiles) { if (getQualifiedClassName(tile) == "model::Enterance"){ portals.push(tile); }; }; return (portals[int((Math.random() * portals.length))]); } public static function tilesort(tile1:Tile, tile2:Tile):int{ var pos1:int = (-(tile1.pos.x) + tile1.pos.y); var pos2:int = (-(tile2.pos.x) + tile2.pos.y); if (pos1 < pos2){ return (-1); }; if (pos1 > pos2){ return (1); }; return (0); } public static function load(in_file:ByteArray):Level{ var level:Level = new (Level); in_file.endian = Endian.LITTLE_ENDIAN; var count:int = in_file.readInt(); var i:int; while (i < count) { level.tiles.push(Tile.load(in_file)); i++; }; level.update_neighbors(); return (level); } } }//package model
Section 69
//Oiler (model.Oiler) package model { public class Oiler extends Powerup { public function Oiler(){ super((20 * 25), false); } } }//package model
Section 70
//Pickup (model.Pickup) package model { import koon.frame.*; public class Pickup extends GameModel { public var container:GameModel; public var is_good:Boolean;// = true public var goldcar:GoldCar; public var jump_cnt:Number;// = -256 public function Pickup(){ super(); } public function tick():void{ if (this.jump_cnt != -256){ this.jump_cnt = (this.jump_cnt + 0.25); if (this.jump_cnt >= 1){ this.jump_cnt = -256; }; }; } public function jump():void{ this.jump_cnt = 0; } } }//package model
Section 71
//Playfield (model.Playfield) package model { import flash.geom.*; import koon.frame.*; import flash.utils.*; import event.*; public class Playfield extends GameModel { public var level:Level; public var pickup_count:Dictionary; public var explosion:Explosion; public var dynamite:Dynamite; public var goldcars:Array; public function Playfield(){ super(); } public function spawn_pickup(pickup:Pickup):Tile{ var pos:Point; var tile:Tile = this.level.get_random_flat_tile(); if (tile.pickup == null){ tile.pickup = pickup; pos = tile.get_center(); tile.pickup.container = tile; return (tile); }; return (null); } public function handle_new_pickups(goldcar:GoldCar):void{ var pickup:Pickup; if (goldcar.pos.tile.pickup != null){ pickup = goldcar.pos.tile.pickup; if ((((getQualifiedClassName(goldcar.collectible) == "model::Diamond")) && ((getQualifiedClassName(pickup) == "model::Diamond")))){ } else { if (getQualifiedClassName(goldcar.collectible) == "model::Dynamite"){ if ((((getQualifiedClassName(pickup) == "model::Coin")) || ((getQualifiedClassName(pickup) == "model::Oiler")))){ goldcar.add_pickup(goldcar.pos.tile.pickup); goldcar.pos.tile.pickup = null; }; } else { if (goldcar.collectible != null){ if ((((((getQualifiedClassName(pickup) == "model::Coin")) || ((getQualifiedClassName(pickup) == "model::Diamond")))) || ((getQualifiedClassName(pickup) == "model::Oiler")))){ goldcar.add_pickup(goldcar.pos.tile.pickup); goldcar.pos.tile.pickup = null; }; } else { goldcar.add_pickup(goldcar.pos.tile.pickup); goldcar.pos.tile.pickup = null; }; }; }; }; } public function get_goldcar_ranking():Array{ var goldcar:GoldCar; var single_ranking:Array = goldcars.concat(); single_ranking.sortOn("score", Array.NUMERIC); var ranking:Array = new Array(); var prev_score = -99999; for each (goldcar in single_ranking) { if (goldcar.score == prev_score){ (ranking[(ranking.length - 1)] as Array).push(goldcar); } else { ranking.push([goldcar]); prev_score = goldcar.score; }; }; return (ranking); } public function count_car_pickups(goldcar:GoldCar):void{ if (goldcar.modifier != null){ this.add_pickup_count(Class(getDefinitionByName(getQualifiedClassName(goldcar.modifier)))); }; if (goldcar.collectible != null){ this.add_pickup_count(Class(getDefinitionByName(getQualifiedClassName(goldcar.collectible)))); }; } public function load(level_nr:int):void{ this.level = Resources.get_level(level_nr); } public function handle_collisions(goldcar:GoldCar):void{ var car2:GoldCar; for each (car2 in this.goldcars) { if (((!((goldcar == car2))) && (!((car2.pos == null))))){ goldcar.handle_collision(car2); if ((((goldcar.switchh == car2.switchh)) && (!((goldcar.switchh == null))))){ if (goldcar.switch_dist < car2.switch_dist){ car2.switchh = null; } else { goldcar.switchh = null; }; }; }; }; } public function get_free_position():TrailPosition{ var pos:TrailPosition; var tile:Tile = this.level.get_random_flat_tile(); if (tile.pickup == null){ pos = new TrailPosition(tile, (tile.get_length() / 2)); if (this.is_free_position(pos)){ return (pos); }; }; return (null); } public function get_pickup_count(pickup_class:Class):int{ if (this.pickup_count[pickup_class] != null){ return (this.pickup_count[pickup_class]); }; return (0); } public function is_free_position(position:TrailPosition, ignore:GoldCar=null):Boolean{ var goldcar:GoldCar; var distance:int; for each (goldcar in this.goldcars) { if (goldcar.pos != null){ distance = goldcar.pos.get_distance(position); if ((((distance < (GoldCar.COLLIDE_DISTANCE * 1.2))) && (!((goldcar == ignore))))){ return (false); }; }; }; return (true); } public function tick():void{ var was_reversed:Boolean; var old_tile:Tile; var goldcar:GoldCar; var tile:Tile; var goldcar2:GoldCar; var tile2:Tile; var port:Tile; var new_pos:TrailPosition; this.pickup_count = new Dictionary(); for each (goldcar in this.goldcars) { if (goldcar.pos != null){ was_reversed = goldcar.pos.is_reversed(); old_tile = goldcar.pos.tile; }; goldcar.tick(); if (goldcar.pos != null){ if (getQualifiedClassName(goldcar.pos.tile) == "model::Enterance"){ if (((!((was_reversed == goldcar.pos.is_reversed()))) && ((old_tile == goldcar.pos.tile)))){ if (getQualifiedClassName(goldcar.collectible) == "model::Diamond"){ goldcar.collectible = null; goldcar.score = (goldcar.score + 10); Event.collect(10, goldcar.pos); }; port = Enterance(goldcar.pos.tile).get_random_portal(); new_pos = new TrailPosition(port, 0); if (this.is_free_position(new_pos, goldcar)){ goldcar.pos.tile = port; goldcar.pos.progress = 0; }; }; }; this.handle_new_pickups(goldcar); this.handle_collisions(goldcar); goldcar.align_switch(); }; }; for each (tile in this.level.tiles) { tile.tick(); if (tile.pickup != null){ if (getQualifiedClassName(tile.pickup) == "model::Dynamite"){ if (Dynamite(tile.pickup).explode()){ tile.pickup = null; }; }; }; }; for each (goldcar2 in this.goldcars) { this.count_car_pickups(goldcar2); }; for each (tile2 in this.level.tiles) { if (tile2.pickup != null){ this.add_pickup_count(Class(getDefinitionByName(getQualifiedClassName(tile2.pickup)))); }; }; if (this.explosion != null){ this.explosion.tick(); }; } public function add_pickup_count(pickup_class:Class, increment:int=1):void{ if (this.pickup_count[pickup_class] != null){ this.pickup_count[pickup_class] = (this.pickup_count[pickup_class] + increment); } else { this.pickup_count[pickup_class] = increment; }; } public function spawn_dynamite_on_car(goldcar:GoldCar):void{ this.dynamite = new Dynamite(); goldcar.add_pickup(this.dynamite); } public function spawn_next_goldcar(random_spawn:Boolean=true):Boolean{ var goldcar:GoldCar; for each (goldcar in this.goldcars) { if (goldcar.pos == null){ if (random_spawn){ goldcar.pos = new TrailPosition(this.level.get_random_portal(), 0); } else { goldcar.pos = new TrailPosition(this.level.get_first_portal(), 0); }; return (true); }; }; return (false); } public function add_goldcars(goldcar_names:Array):void{ var name:String; this.goldcars = new Array(); for each (name in goldcar_names) { this.goldcars.push(new GoldCar(null, this.goldcars.length)); }; } } }//package model
Section 72
//Powerup (model.Powerup) package model { public class Powerup extends Pickup { public var gets_passed:Boolean; public var time_to_live:int; public function Powerup(time_to_live:int, gets_passed:Boolean=true){ super(); this.time_to_live = time_to_live; this.gets_passed = gets_passed; } public function is_done():Boolean{ return ((this.time_to_live <= 0)); } override public function tick():void{ super.tick(); if (this.goldcar != null){ this.time_to_live = (this.time_to_live - 1); }; } } }//package model
Section 73
//Tile (model.Tile) package model { import flash.geom.*; import koon.frame.*; import flash.utils.*; import koon.geo.*; public class Tile extends GameModel { public var neighbors:Array; public var trail:Trail; public var type:int; public var is_selected:Boolean;// = false public var pos:Point; public var pickup:Pickup;// = null public static const WEST_SLOPE_TOP:int = 7; public static const MAX:int = 9; public static const ENTERANCE:int = 10; public static const FLAT:int = 0; public static const NORTH_SLOPE_BOT:int = 2; public static const RAILGATE:int = 11; public static const SOUTH_SLOPE_BOT:int = 6; public static const WEST_SLOPE_BOT:int = 8; public static const NORTH_SLOPE_TOP:int = 1; public static const SOUTH_SLOPE_TOP:int = 5; public static const EAST_SLOPE_BOT:int = 4; public static const EAST_SLOPE_TOP:int = 3; public function Tile(pos:Point, tile_type:int, trail_type:int=-1){ neighbors = [null, null, null, null]; super(); if (trail_type == -1){ if (tile_type == Tile.FLAT){ trail_type = Trail.NS; } else { trail_type = Trail.HILL; }; }; this.pos = pos; this.type = tile_type; this.trail = new Trail(this, trail_type); } public function get_possible_switches(from_dir:Direction=null):Array{ var available:Array = new Array(); if (((!((this.get_neighbor(Direction.NORTH) == null))) && (!((this.get_neighbor(Direction.SOUTH) == null))))){ if ((((((from_dir == null)) || ((from_dir == Direction.NORTH)))) || ((from_dir == Direction.SOUTH)))){ available.push(Trail.NS); }; }; if (((!((this.get_neighbor(Direction.EAST) == null))) && (!((this.get_neighbor(Direction.WEST) == null))))){ if ((((((from_dir == null)) || ((from_dir == Direction.EAST)))) || ((from_dir == Direction.WEST)))){ available.push(Trail.EW); }; }; if (((!((this.get_neighbor(Direction.SOUTH) == null))) && (!((this.get_neighbor(Direction.EAST) == null))))){ if ((((((from_dir == null)) || ((from_dir == Direction.SOUTH)))) || ((from_dir == Direction.EAST)))){ available.push(Trail.SE); }; }; if (((!((this.get_neighbor(Direction.SOUTH) == null))) && (!((this.get_neighbor(Direction.WEST) == null))))){ if ((((((from_dir == null)) || ((from_dir == Direction.SOUTH)))) || ((from_dir == Direction.WEST)))){ available.push(Trail.SW); }; }; if (((!((this.get_neighbor(Direction.NORTH) == null))) && (!((this.get_neighbor(Direction.WEST) == null))))){ if ((((((from_dir == null)) || ((from_dir == Direction.NORTH)))) || ((from_dir == Direction.WEST)))){ available.push(Trail.NW); }; }; if (((!((this.get_neighbor(Direction.NORTH) == null))) && (!((this.get_neighbor(Direction.EAST) == null))))){ if ((((((from_dir == null)) || ((from_dir == Direction.NORTH)))) || ((from_dir == Direction.EAST)))){ available.push(Trail.NE); }; }; return (available); } public function get_out_tile():Tile{ return (this.get_neighbor(this.trail.get_out_direction())); } public function switch_it(from_dir:Direction=null):void{ this.trail.switch_it(from_dir); } public function get_neighbor_offset(direction:Direction):Point{ var offset:Point; if (direction == Direction.NORTH){ offset = new Point(0, -1); } else { if (direction == Direction.EAST){ offset = new Point(1, 0); } else { if (direction == Direction.SOUTH){ offset = new Point(0, 1); } else { if (direction == Direction.WEST){ offset = new Point(-1, 0); }; }; }; }; if (this.type == Tile.NORTH_SLOPE_TOP){ if (direction == Direction.NORTH){ offset = new Point(-1, 0); } else { if ((((direction == Direction.EAST)) || ((direction == Direction.WEST)))){ offset = new Point(0, 0); }; }; } else { if (this.type == Tile.NORTH_SLOPE_BOT){ if (direction == Direction.SOUTH){ offset = new Point(1, 0); } else { if ((((direction == Direction.EAST)) || ((direction == Direction.WEST)))){ offset = new Point(0, 0); }; }; } else { if (this.type == Tile.EAST_SLOPE_TOP){ if (direction == Direction.EAST){ offset = new Point(0, 1); } else { if ((((direction == Direction.SOUTH)) || ((direction == Direction.NORTH)))){ offset = new Point(0, 0); }; }; } else { if (this.type == Tile.EAST_SLOPE_BOT){ if (direction == Direction.WEST){ offset = new Point(0, -1); } else { if ((((direction == Direction.SOUTH)) || ((direction == Direction.NORTH)))){ offset = new Point(0, 0); }; }; } else { if (this.type == Tile.SOUTH_SLOPE_TOP){ if (direction == Direction.SOUTH){ offset = new Point(-1, 2); } else { if ((((direction == Direction.EAST)) || ((direction == Direction.WEST)))){ offset = new Point(0, 0); }; }; } else { if (this.type == Tile.SOUTH_SLOPE_BOT){ if (direction == Direction.NORTH){ offset = new Point(1, -2); } else { if ((((direction == Direction.EAST)) || ((direction == Direction.WEST)))){ offset = new Point(0, 0); }; }; } else { if (this.type == Tile.WEST_SLOPE_TOP){ if (direction == Direction.WEST){ offset = new Point(-2, 1); } else { if ((((direction == Direction.SOUTH)) || ((direction == Direction.NORTH)))){ offset = new Point(0, 0); }; }; } else { if (this.type == Tile.WEST_SLOPE_BOT){ if (direction == Direction.EAST){ offset = new Point(2, -1); } else { if ((((direction == Direction.SOUTH)) || ((direction == Direction.NORTH)))){ offset = new Point(0, 0); }; }; }; }; }; }; }; }; }; }; return (offset); } public function set_selected(enable:Boolean):void{ this.is_selected = enable; } public function tick():void{ if (this.pickup != null){ this.pickup.tick(); }; } public function get_center():Point{ return (new Point((((this.pos.x * 32) + (this.pos.y * 32)) + 32), (((-(this.pos.x) * 16) + (this.pos.y * 16)) + 16))); } public function get_in_tile():Tile{ return (this.get_neighbor(this.trail.get_in_direction())); } public function is_switch():Boolean{ return (this.trail.is_switch()); } public function get_angle():int{ if (this.type == Tile.FLAT){ return (0); }; return (8); } public function get_length():Number{ if (this.type == Tile.FLAT){ if ((((this.trail.type == Trail.NS)) || ((this.trail.type == Trail.EW)))){ return (1000); }; return (Number((((0.5 * Math.PI) / 2) * 1000))); //unresolved jump }; return ((2300 / 2)); } public function get_screen_position(length:int):Point{ var in_pos:Vec2D; var out_pos:Vec2D; var pos:Vec2D; var interpol:Number; var in_dir:Direction = this.trail.get_in_direction(); var out_dir:Direction = this.trail.get_out_direction(); if (in_dir == Direction.NORTH){ if (this.type == Tile.NORTH_SLOPE_TOP){ in_pos = new Vec2D(-16, 8); } else { in_pos = new Vec2D(-16, -8); }; } else { if (in_dir == Direction.EAST){ if (this.type == Tile.EAST_SLOPE_TOP){ in_pos = new Vec2D(16, 8); } else { in_pos = new Vec2D(16, -8); }; } else { if (in_dir == Direction.SOUTH){ if (this.type == Tile.SOUTH_SLOPE_TOP){ in_pos = new Vec2D(16, 24); } else { in_pos = new Vec2D(16, 8); }; } else { if (in_dir == Direction.WEST){ if (this.type == Tile.WEST_SLOPE_TOP){ in_pos = new Vec2D(-16, 24); } else { in_pos = new Vec2D(-16, 8); }; }; }; }; }; if (out_dir == Direction.NORTH){ if (this.type == Tile.SOUTH_SLOPE_BOT){ out_pos = new Vec2D(-16, -24); } else { out_pos = new Vec2D(-16, -8); }; } else { if (out_dir == Direction.EAST){ if (this.type == Tile.WEST_SLOPE_BOT){ out_pos = new Vec2D(16, -24); } else { out_pos = new Vec2D(16, -8); }; } else { if (out_dir == Direction.SOUTH){ if (this.type == Tile.NORTH_SLOPE_BOT){ out_pos = new Vec2D(16, -8); } else { out_pos = new Vec2D(16, 8); }; } else { if (out_dir == Direction.WEST){ if (this.type == Tile.EAST_SLOPE_BOT){ out_pos = new Vec2D(-16, -8); } else { out_pos = new Vec2D(-16, 8); }; }; }; }; }; if (in_dir == out_dir.get_opposite()){ pos = in_pos.mul((this.get_length() - length)).plus(out_pos.mul(length)).div(this.get_length()); } else { interpol = (Number(length) / Number(this.get_length())); pos = in_pos.minus(in_pos.mul(Math.sin(((Math.PI * interpol) / 2)))); pos = pos.plus(out_pos.mul((1 - Math.cos(((Math.PI * interpol) / 2))))); }; pos = new Vec2D((((pos.x + (this.pos.x * 32)) + (this.pos.y * 32)) + 32), (((pos.y - (this.pos.x * 16)) + (this.pos.y * 16)) + 16)); return (pos.to_point()); } public function set_neighbor(neighbor_tile:Tile, direction:Direction):void{ this.neighbors[direction.id] = neighbor_tile; } public function get_neighbor(direction:Direction):Tile{ return (this.neighbors[direction.id]); } public static function load(in_file:ByteArray):Tile{ var type:int = in_file.readUnsignedByte(); var trail_type:int = in_file.readUnsignedByte(); in_file.readUnsignedByte(); in_file.readUnsignedByte(); var pos_x:int = in_file.readInt(); var pos_y:int = in_file.readInt(); var pos_z:int = in_file.readInt(); if (type == Tile.ENTERANCE){ return (new Enterance(new Point(pos_x, pos_y), trail_type)); }; return (new Tile(new Point(pos_x, pos_y), type, trail_type)); } } }//package model
Section 74
//Trail (model.Trail) package model { import flash.utils.*; public class Trail { public var tile:Tile; public var type:int; public var may_switch:Boolean; public static const SW:int = 3; public static const NS:int = 0; public static const NW:int = 4; public static const HILL:int = 6; public static const SE:int = 2; public static const NE:int = 5; public static const EW:int = 1; public static const MAX:int = 7; public function Trail(tile:Tile, trail_type:int):void{ super(); this.tile = tile; this.type = trail_type; this.may_switch = true; } public function switch_it(from_dir:Direction=null):void{ if (!this.may_switch){ return; }; var available:Array = this.tile.get_possible_switches(from_dir); if (available.length == 0){ return; }; var i = 5; i = Math.max(0, available.indexOf(this.type)); if ((i + 1) >= available.length){ this.type = available[0]; } else { this.type = available[(i + 1)]; }; } public function get_out_direction():Direction{ if (this.tile.type == Tile.FLAT){ if ((((((this.type == Trail.NW)) || ((this.type == Trail.EW)))) || ((this.type == Trail.SW)))){ return (Direction.WEST); }; if ((((this.type == Trail.NS)) || ((this.type == Trail.SE)))){ return (Direction.SOUTH); }; if (this.type == Trail.NE){ return (Direction.EAST); }; trace("Trail type not public functionined"); return (Direction.WEST); //unresolved jump }; return (this.get_in_direction().get_opposite()); } public function is_switch():Boolean{ return ((((this.tile.type == Tile.FLAT)) && ((this.tile.neighbors.filter(function (x:Tile, i:int, a:Array):Boolean{ return ((x == null)); }).length < 2)))); } public function align(direction:Direction=null):void{ var enterance:Enterance; var available:Array; if (this.tile.type != Tile.FLAT){ return; }; if (getQualifiedClassName(this.tile) == "model::Enterance"){ enterance = Enterance(this.tile); if (enterance.is_north_exit()){ this.type = Trail.NS; } else { this.type = Trail.EW; }; } else { if (direction == null){ available = this.tile.get_possible_switches(); if (available.indexOf(this.type) < 0){ this.switch_it(); }; } else { if (((!((direction == this.get_in_direction()))) && (!((direction == this.get_out_direction()))))){ this.switch_it(direction); }; }; }; } public function get_in_direction():Direction{ if (this.tile.type == Tile.FLAT){ if ((((((this.type == Trail.NS)) || ((this.type == Trail.NE)))) || ((this.type == Trail.NW)))){ return (Direction.NORTH); }; if ((((this.type == Trail.EW)) || ((this.type == Trail.SE)))){ return (Direction.EAST); }; if (this.type == Trail.SW){ return (Direction.SOUTH); }; trace("Trail type not public functionined!"); return (Direction.NORTH); //unresolved jump }; if ((((this.tile.type == Tile.NORTH_SLOPE_BOT)) || ((this.tile.type == Tile.NORTH_SLOPE_TOP)))){ return (Direction.NORTH); }; if ((((this.tile.type == Tile.EAST_SLOPE_BOT)) || ((this.tile.type == Tile.EAST_SLOPE_TOP)))){ return (Direction.EAST); }; if ((((this.tile.type == Tile.SOUTH_SLOPE_BOT)) || ((this.tile.type == Tile.SOUTH_SLOPE_TOP)))){ return (Direction.SOUTH); }; if ((((this.tile.type == Tile.WEST_SLOPE_BOT)) || ((this.tile.type == Tile.WEST_SLOPE_TOP)))){ return (Direction.WEST); }; trace("Tile type not public functionined!"); return (Direction.NORTH); } } }//package model
Section 75
//TrailPosition (model.TrailPosition) package model { import flash.geom.*; public class TrailPosition { public var reversed:int; public var progress:int; public var tile:Tile; public function TrailPosition(tile:Tile, progress:int){ super(); this.tile = tile; this.progress = progress; this.reversed = 1; } public function get_out_direction():Direction{ if (this.reversed > 0){ return (this.tile.trail.get_out_direction()); }; return (this.tile.trail.get_in_direction()); } public function set_position(tile:Tile, progress:int):void{ var old_tile:Tile; this.tile = tile; this.progress = progress; while ((((this.progress < 0)) || ((this.progress > this.tile.get_length())))) { old_tile = this.tile; if (this.progress < 0){ this.tile = this.tile.get_in_tile(); if (this.tile == null){ this.tile = old_tile; this.progress = (this.progress * -1); this.reverse_progress(); } else { if (this.tile.get_in_tile() == old_tile){ this.progress = (this.progress * -1); this.reverse_progress(); } else { if (this.tile.get_out_tile() == old_tile){ this.progress = (this.tile.get_length() + this.progress); } else { this.tile = old_tile; this.reverse_progress(); this.progress = (this.progress * -1); }; }; }; } else { if (this.progress > this.tile.get_length()){ this.progress = (this.progress - old_tile.get_length()); this.tile = this.tile.get_out_tile(); if (this.tile == null){ this.tile = old_tile; this.reverse_progress(); } else { if (this.tile.get_in_tile() == old_tile){ } else { if (this.tile.get_out_tile() == old_tile){ this.progress = (this.tile.get_length() - this.progress); this.reverse_progress(); } else { this.tile = old_tile; this.reverse_progress(); this.progress = (this.tile.get_length() - this.progress); }; }; }; }; }; }; } public function add(distance:int):void{ this.set_position(this.tile, (this.progress + (distance * this.reversed))); } public function reverse_progress():void{ this.reversed = (this.reversed * -1); } public function get_screen_position():Point{ return (this.tile.get_screen_position(this.progress)); } public function same_direction(trailpos:TrailPosition):Boolean{ if (this.tile == trailpos.tile){ return ((this.reversed == trailpos.reversed)); }; if (this.tile.get_in_tile() == trailpos.tile){ if (trailpos.tile.get_in_tile() == this.tile){ return (!((this.reversed == trailpos.reversed))); }; if (trailpos.tile.get_out_tile() == this.tile){ return ((this.reversed == trailpos.reversed)); }; } else { if (this.tile.get_out_tile() == trailpos.tile){ if (trailpos.tile.get_in_tile() == this.tile){ return ((this.reversed == trailpos.reversed)); }; if (trailpos.tile.get_out_tile() == this.tile){ return (!((this.reversed == trailpos.reversed))); }; }; }; return (true); } public function minus(distance:int):TrailPosition{ var pos:TrailPosition = this.clone(); pos.set_position(pos.tile, (pos.progress - (distance * pos.reversed))); return (pos); } public function get_in_direction():Direction{ if (this.reversed > 0){ return (this.tile.trail.get_in_direction()); }; return (this.tile.trail.get_out_direction()); } public function to_next_tile():void{ var old_tile:Tile = this.tile; if (this.reversed > 0){ this.tile = this.tile.get_out_tile(); if (this.tile == null){ this.tile = old_tile; this.reverse_progress(); } else { if (this.tile.get_out_tile() == old_tile){ this.reverse_progress(); }; }; } else { this.tile = this.tile.get_in_tile(); if (this.tile == null){ this.tile = old_tile; this.reverse_progress(); } else { if (this.tile.get_in_tile() == old_tile){ this.reverse_progress(); }; }; }; this.progress = 0; } public function is_reversed():Boolean{ return ((this.reversed == -1)); } public function substract(distance:int):void{ this.set_position(this.tile, (this.progress - (distance * this.reversed))); } public function plus(distance:int):TrailPosition{ var pos:TrailPosition = this.clone(); pos.set_position(pos.tile, (pos.progress + (distance * pos.reversed))); return (pos); } public function clone():TrailPosition{ var pos:TrailPosition = new TrailPosition(this.tile, this.progress); pos.reversed = this.reversed; return (pos); } public function get_distance(trailpos:TrailPosition):int{ var dist:int; if (this.tile == trailpos.tile){ return (Math.abs((this.progress - trailpos.progress))); }; if (this.tile.get_in_tile() == trailpos.tile){ dist = this.progress; if (trailpos.tile.get_in_tile() == this.tile){ return ((dist + trailpos.progress)); }; if (trailpos.tile.get_out_tile() == this.tile){ return (((dist + trailpos.tile.get_length()) - trailpos.progress)); }; } else { if (this.tile.get_out_tile() == trailpos.tile){ dist = (this.tile.get_length() - this.progress); if (trailpos.tile.get_in_tile() == this.tile){ return ((dist + trailpos.progress)); }; if (trailpos.tile.get_out_tile() == this.tile){ return (((dist + trailpos.tile.get_length()) - trailpos.progress)); }; }; }; return (999999999); } public function equals(other:TrailPosition):Boolean{ return ((((this.tile == other.tile)) && ((this.progress == other.progress)))); } } }//package model
Section 76
//BitmapAsset (mx.core.BitmapAsset) package mx.core { import flash.display.*; public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject { mx_internal static const VERSION:String = "3.4.0.9271"; public function BitmapAsset(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){ super(bitmapData, pixelSnapping, smoothing); } public function get measuredWidth():Number{ if (bitmapData){ return (bitmapData.width); }; return (0); } public function get measuredHeight():Number{ if (bitmapData){ return (bitmapData.height); }; return (0); } public function setActualSize(newWidth:Number, newHeight:Number):void{ width = newWidth; height = newHeight; } public function move(x:Number, y:Number):void{ this.x = x; this.y = y; } } }//package mx.core
Section 77
//ByteArrayAsset (mx.core.ByteArrayAsset) package mx.core { import flash.utils.*; public class ByteArrayAsset extends ByteArray implements IFlexAsset { mx_internal static const VERSION:String = "3.4.0.9271"; public function ByteArrayAsset(){ super(); } } }//package mx.core
Section 78
//FlexBitmap (mx.core.FlexBitmap) package mx.core { import flash.display.*; import mx.utils.*; public class FlexBitmap extends Bitmap { mx_internal static const VERSION:String = "3.4.0.9271"; public function FlexBitmap(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){ var bitmapData = bitmapData; var pixelSnapping = pixelSnapping; var smoothing = smoothing; super(bitmapData, pixelSnapping, smoothing); name = NameUtil.createUniqueName(this); //unresolved jump var _slot1 = e; } override public function toString():String{ return (NameUtil.displayObjectToString(this)); } } }//package mx.core
Section 79
//FontAsset (mx.core.FontAsset) package mx.core { import flash.text.*; public class FontAsset extends Font implements IFlexAsset { mx_internal static const VERSION:String = "3.4.0.9271"; public function FontAsset(){ super(); } } }//package mx.core
Section 80
//IFlexAsset (mx.core.IFlexAsset) package mx.core { public interface IFlexAsset { } }//package mx.core
Section 81
//IFlexDisplayObject (mx.core.IFlexDisplayObject) package mx.core { import flash.events.*; import flash.geom.*; import flash.display.*; import flash.accessibility.*; public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher { function get visible():Boolean; function get rotation():Number; function localToGlobal(void:Point):Point; function get name():String; function set width(flash.display:Number):void; function get measuredHeight():Number; function get blendMode():String; function get scale9Grid():Rectangle; function set name(flash.display:String):void; function set scaleX(flash.display:Number):void; function set scaleY(flash.display:Number):void; function get measuredWidth():Number; function get accessibilityProperties():AccessibilityProperties; function set scrollRect(flash.display:Rectangle):void; function get cacheAsBitmap():Boolean; function globalToLocal(void:Point):Point; function get height():Number; function set blendMode(flash.display:String):void; function get parent():DisplayObjectContainer; function getBounds(String:DisplayObject):Rectangle; function get opaqueBackground():Object; function set scale9Grid(flash.display:Rectangle):void; function setActualSize(_arg1:Number, _arg2:Number):void; function set alpha(flash.display:Number):void; function set accessibilityProperties(flash.display:AccessibilityProperties):void; function get width():Number; function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean; function set cacheAsBitmap(flash.display:Boolean):void; function get scaleX():Number; function get scaleY():Number; function get scrollRect():Rectangle; function get mouseX():Number; function get mouseY():Number; function set height(flash.display:Number):void; function set mask(flash.display:DisplayObject):void; function getRect(String:DisplayObject):Rectangle; function get alpha():Number; function set transform(flash.display:Transform):void; function move(_arg1:Number, _arg2:Number):void; function get loaderInfo():LoaderInfo; function get root():DisplayObject; function hitTestObject(mx.core:IFlexDisplayObject/mx.core:IFlexDisplayObject:stage/get:DisplayObject):Boolean; function set opaqueBackground(flash.display:Object):void; function set visible(flash.display:Boolean):void; function get mask():DisplayObject; function set x(flash.display:Number):void; function set y(flash.display:Number):void; function get transform():Transform; function set filters(flash.display:Array):void; function get x():Number; function get y():Number; function get filters():Array; function set rotation(flash.display:Number):void; function get stage():Stage; } }//package mx.core
Section 82
//IRepeaterClient (mx.core.IRepeaterClient) package mx.core { public interface IRepeaterClient { function get instanceIndices():Array; function set instanceIndices(C:\autobuild\galaga\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void; function get isDocument():Boolean; function set repeaters(C:\autobuild\galaga\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void; function initializeRepeaterArrays(C:\autobuild\galaga\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:IRepeaterClient):void; function get repeaters():Array; function set repeaterIndices(C:\autobuild\galaga\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void; function get repeaterIndices():Array; } }//package mx.core
Section 83
//mx_internal (mx.core.mx_internal) package mx.core { public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal"; }//package mx.core
Section 84
//SoundAsset (mx.core.SoundAsset) package mx.core { import flash.media.*; public class SoundAsset extends Sound implements IFlexAsset { mx_internal static const VERSION:String = "3.4.0.9271"; public function SoundAsset(){ super(); } } }//package mx.core
Section 85
//NameUtil (mx.utils.NameUtil) package mx.utils { import flash.display.*; import flash.utils.*; import mx.core.*; public class NameUtil { mx_internal static const VERSION:String = "3.4.0.9271"; private static var counter:int = 0; public function NameUtil(){ super(); } public static function displayObjectToString(displayObject:DisplayObject):String{ var result:String; var o:DisplayObject; var s:String; var indices:Array; var displayObject = displayObject; o = displayObject; while (o != null) { if (((((o.parent) && (o.stage))) && ((o.parent == o.stage)))){ break; }; s = o.name; if ((o is IRepeaterClient)){ indices = IRepeaterClient(o).instanceIndices; if (indices){ s = (s + (("[" + indices.join("][")) + "]")); }; }; result = ((result == null)) ? s : ((s + ".") + result); o = o.parent; }; //unresolved jump var _slot1 = e; return (result); } public static function createUniqueName(object:Object):String{ if (!object){ return (null); }; var name:String = getQualifiedClassName(object); var index:int = name.indexOf("::"); if (index != -1){ name = name.substr((index + 2)); }; var charCode:int = name.charCodeAt((name.length - 1)); if ((((charCode >= 48)) && ((charCode <= 57)))){ name = (name + "_"); }; return ((name + counter++)); } } }//package mx.utils
Section 86
//BalloonView (view.BalloonView) package view { import koon.gfx.*; import koon.frame.*; import koon.geo.*; public class BalloonView extends PickupView { public var sprite:SpriteFilm; public function BalloonView(model:GameModel){ super(model); this.sprite = SpriteFilm(Resources.get("balloon_sprite")); } override public function draw(frame:Frame):void{ var pos:Vec2D; if (this.get_pos(frame) != null){ pos = Vec2D.from_point(this.get_pos(frame)).plus(new Vec2D(frame.X_OFFSET, (frame.Y_OFFSET - 20))); this.sprite.draw(frame.surface, pos.x, pos.y); }; } } }//package view
Section 87
//CoinView (view.CoinView) package view { import koon.gfx.*; import koon.frame.*; import koon.geo.*; public class CoinView extends PickupView { public var animTimer:LoopAnimationTimer; public var sprite:SpriteFilm; public function CoinView(model:GameModel){ super(model); this.sprite = Resources.get("copper_sprite").clone(); this.animTimer = new LoopAnimationTimer(25, 0, this.sprite.max_x); this.animTimer.set_frame(0, int((Math.random() * this.sprite.max_x))); } override public function draw(frame:Frame):void{ var pos:Vec2D; if (this.get_pos(frame) != null){ this.sprite.nr = this.animTimer.get_frame(frame.time_sec); pos = Vec2D.from_point(this.get_pos(frame)).plus(new Vec2D(frame.X_OFFSET, frame.Y_OFFSET)); this.sprite.draw(frame.surface, pos.x, pos.y); }; } } }//package view
Section 88
//DiamondView (view.DiamondView) package view { import koon.gfx.*; import koon.frame.*; import koon.geo.*; public class DiamondView extends PickupView { public var animTimer:LoopAnimationTimer; public var sprite:SpriteFilm; public function DiamondView(model:GameModel){ super(model); this.sprite = Resources.get("diamond_sprite").clone(); this.animTimer = new LoopAnimationTimer(25, 0, this.sprite.max_x); this.animTimer.set_frame(0, int((Math.random() * this.sprite.max_x))); } override public function draw(frame:Frame):void{ var pos:Vec2D; if (this.get_pos(frame) != null){ this.sprite.nr = this.animTimer.get_frame(frame.time_sec); pos = Vec2D.from_point(this.get_pos(frame)).plus(new Vec2D(frame.X_OFFSET, frame.Y_OFFSET)); this.sprite.draw(frame.surface, pos.x, pos.y); }; } } }//package view
Section 89
//DynamiteView (view.DynamiteView) package view { import koon.gfx.*; import flash.geom.*; import koon.frame.*; import model.*; import event.*; public class DynamiteView extends PickupView { public var sparkles:Array; public var sprite:SpriteFilm; public var prev_life:Number; public var sparkle_timer:Timer; public var dynamite:Dynamite; public var sparkle_offset:Point; public var sparkle_line:Point; public var sprite_delta:int; public function DynamiteView(model:GameModel){ super(model); this.dynamite = Dynamite(model); this.sprite = Resources.get("dynamite_sprite").clone(); this.sprite_delta = 1; this.prev_life = 1; this.sparkle_offset = new Point(7, (-(this.sprite.height) + 24)); this.sparkle_line = new Point(0, -22); this.sparkles = []; this.sparkle_timer = new Timer(25); } override public function draw(frame:Frame):void{ var sparkle:Sparkle; var pos:Point = this.get_pos(frame); if (pos == null){ return; }; if ((((this.dynamite.life < (Dynamite.DEC * 18))) && (!((this.dynamite.life == this.prev_life))))){ this.prev_life = this.dynamite.life; this.sprite.nr = (this.sprite.nr + this.sprite_delta); if (this.sprite.nr < 0){ this.sprite.nr = 0; this.sprite_delta = 1; } else { if (this.sprite.nr >= 4){ this.sprite.nr = 3; this.sprite_delta = -1; Event.dynamite_tick(); }; }; }; while (this.sparkle_timer.tick(frame.time_sec)) { this.sparkle_tick(frame); }; pos = new Point((pos.x + frame.X_OFFSET), (pos.y + frame.Y_OFFSET)); this.sprite.draw(frame.surface, pos.x, pos.y); for each (sparkle in this.sparkles) { sparkle.draw(frame); }; } public function sparkle_tick(frame:Frame):void{ var sparkle:Sparkle; var pos:Point; var i:int; if (this.dynamite.life > (Dynamite.DEC * 18)){ pos = this.get_pos(frame); pos.x = (pos.x + (this.sparkle_offset.x + (this.sparkle_line.x * this.dynamite.life))); pos.y = (pos.y + (this.sparkle_offset.y + (this.sparkle_line.y * this.dynamite.life))); i = 0; while (i < 3) { this.sparkles.push(new Sparkle(pos)); i++; }; }; var new_sparkles:Array = []; for each (sparkle in this.sparkles) { sparkle.tick(); if (!sparkle.is_dead()){ new_sparkles.push(sparkle); }; }; this.sparkles = new_sparkles; } } }//package view
Section 90
//EnteranceTopView (view.EnteranceTopView) package view { import koon.gfx.*; import flash.geom.*; import koon.frame.*; import model.*; public class EnteranceTopView extends TileView { protected var enterance:Enterance; public function EnteranceTopView(model:GameModel){ super(model); this.enterance = Enterance(model); } override public function get z():int{ return ((((-(this.enterance.pos.x) * 16) + (this.enterance.pos.y * 16)) + 32)); } override public function draw(frame:Frame):void{ var tile_surf:IDrawable; var pos:Point = this.get_pos(frame); if (this.enterance.is_north_exit()){ tile_surf = IDrawable(Resources.get("exittopnorth_surf")); tile_surf.draw(frame.surface, pos.x, pos.y); } else { tile_surf = IDrawable(Resources.get("exittopeast_surf")); tile_surf.draw(frame.surface, pos.x, pos.y); }; } } }//package view
Section 91
//EnteranceView (view.EnteranceView) package view { import koon.gfx.*; import flash.geom.*; import koon.frame.*; import model.*; public class EnteranceView extends TileView { protected var enterance:Enterance; public function EnteranceView(model:GameModel){ super(model); this.enterance = Enterance(model); } override public function get z():int{ return ((((-(this.enterance.pos.x) * 16) + (this.enterance.pos.y * 16)) - 16)); } override public function draw(frame:Frame):void{ var tile_surf:IDrawable; var pos:Point = this.get_pos(frame); if (this.enterance.is_north_exit()){ tile_surf = IDrawable(Resources.get("exitbotnorth_surf")); tile_surf.draw(frame.surface, pos.x, pos.y); } else { tile_surf = IDrawable(Resources.get("exitboteast_surf")); tile_surf.draw(frame.surface, pos.x, pos.y); }; } } }//package view
Section 92
//GoldCarView (view.GoldCarView) package view { import koon.gfx.*; import flash.geom.*; import koon.frame.*; import model.*; import flash.utils.*; public class GoldCarView extends PickupContainerView { protected var motionblur_timer:Timer; protected var sprite:SpriteFilm; protected var motionblur_cnt:int; protected var goldcar:GoldCar; protected var ghost_sprite:SpriteFilm; protected var alpha_surfs:Dictionary; protected var motionblur:Array; public function GoldCarView(model:GameModel){ super(model); this.goldcar = GoldCar(model); this.sprite = SpriteFilm(Resources.get((("car" + (this.goldcar.nr + 1)) + "_sprite"))).clone(); this.motionblur = []; this.motionblur_cnt = 0; this.motionblur_timer = new Timer(25); this.alpha_surfs = new Dictionary(); this.ghost_sprite = null; } override public function get_pickup_pos(frame:Frame):Point{ if (this.goldcar.pos == null){ return (null); }; var point:Point = this.get_pos(frame).get_screen_position(); return (new Point(point.x, (point.y - 20))); } override public function draw(frame:Frame):void{ var diff:Number; var alpha:Number; var ghost:Array; if (this.goldcar.pos == null){ return; }; var pos:TrailPosition = this.get_pos(frame); this.align_car_to_track(pos); while (this.motionblur_timer.tick(frame.time_sec)) { this.motionblur_tick(pos); }; if (getQualifiedClassName(this.goldcar.modifier) == "model::Oiler"){ diff = (1 / (this.motionblur.length + 1)); alpha = (0 + (diff * 2)); for each (ghost in this.motionblur) { if (this.alpha_surfs[alpha] == null){ this.alpha_surfs[alpha] = this.sprite.surface.get_blended(alpha); }; SpriteFilm(ghost[1]).surface = this.alpha_surfs[alpha]; SpriteFilm(ghost[1]).draw(frame.surface, (Point(ghost[0]).x + frame.X_OFFSET), (Point(ghost[0]).y + frame.Y_OFFSET)); alpha = (alpha + diff); }; }; var screen_pos:Point = pos.get_screen_position(); screen_pos.x = (screen_pos.x + frame.X_OFFSET); screen_pos.y = (screen_pos.y + frame.Y_OFFSET); this.sprite.draw(frame.surface, screen_pos.x, screen_pos.y); } override public function get z():int{ if (this.goldcar.pos == null){ return (-999); }; return (this.goldcar.pos.get_screen_position().y); } public function get_pos(frame:Frame):TrailPosition{ return (this.goldcar.pos.plus((this.goldcar.speed * frame.xtrapol))); } public function align_car_to_track(pos:TrailPosition):void{ var in_sprite:int; var out_sprite:int; var in_dir:Direction; var out_dir:Direction; var interpol:Number; if (pos == null){ return; }; if (pos.tile.type == Tile.FLAT){ in_dir = pos.tile.trail.get_in_direction(); out_dir = pos.tile.trail.get_out_direction(); if ((((in_dir == Direction.EAST)) || ((in_dir == Direction.WEST)))){ in_sprite = 0; } else { in_sprite = 3; }; if ((((out_dir == Direction.EAST)) || ((out_dir == Direction.WEST)))){ out_sprite = 0; } else { out_sprite = 3; }; if ((((in_dir == Direction.EAST)) && ((out_dir == Direction.SOUTH)))){ in_sprite = 6; }; if ((((out_dir == Direction.EAST)) && ((in_dir == Direction.SOUTH)))){ out_sprite = 6; }; if ((((in_dir == Direction.WEST)) && ((out_dir == Direction.NORTH)))){ in_sprite = 6; }; if ((((out_dir == Direction.WEST)) && ((in_dir == Direction.NORTH)))){ out_sprite = 6; }; interpol = (Math.abs(pos.progress) / Number(pos.tile.get_length())); this.sprite.nr = (int(((in_sprite * (1 - interpol)) + (out_sprite * interpol))) % 6); } else { if ((((pos.tile.type == Tile.NORTH_SLOPE_TOP)) || ((pos.tile.type == Tile.NORTH_SLOPE_BOT)))){ this.sprite.nr = 8; } else { if ((((pos.tile.type == Tile.EAST_SLOPE_TOP)) || ((pos.tile.type == Tile.EAST_SLOPE_BOT)))){ this.sprite.nr = 6; } else { if ((((pos.tile.type == Tile.SOUTH_SLOPE_TOP)) || ((pos.tile.type == Tile.SOUTH_SLOPE_BOT)))){ this.sprite.nr = 9; } else { if ((((pos.tile.type == Tile.WEST_SLOPE_TOP)) || ((pos.tile.type == Tile.WEST_SLOPE_BOT)))){ this.sprite.nr = 7; }; }; }; }; }; } override public function get_submodels():Array{ var result:Array = new Array(); if (this.goldcar.collectible != null){ result.push(this.goldcar.collectible); }; if (this.goldcar.modifier != null){ result.push(this.goldcar.modifier); }; return (result); } public function motionblur_tick(pos:TrailPosition):void{ if (getQualifiedClassName(this.goldcar.modifier) == "model::Oiler"){ if (this.motionblur_cnt == 0){ this.motionblur.push([pos.get_screen_position(), this.sprite.clone()]); }; this.motionblur_cnt = ((this.motionblur_cnt + 1) % 2); while (this.motionblur.length > 3) { this.motionblur.splice(0, 1); }; } else { this.motionblur = []; }; } } }//package view
Section 93
//LevelView (view.LevelView) package view { import koon.gfx.*; import flash.geom.*; import koon.frame.*; import model.*; import flash.utils.*; public class LevelView extends GameView { protected var level:Level; protected var background:Surface;// = null public function LevelView(model:GameModel){ super(model); this.level = Level(model); } override public function get_submodels():Array{ return (level.tiles); } protected function draw_background(frame:Frame):void{ var tile:Tile; var x:int; var y:int; var pos:Point; var tile_surf:IDrawable; for each (tile in this.level.tiles) { if (getQualifiedClassName(tile) != "model::Enterance"){ x = (((tile.pos.x * 32) + (tile.pos.y * 32)) + frame.X_OFFSET); y = (((-(tile.pos.x) * 16) + (tile.pos.y * 16)) + frame.Y_OFFSET); pos = new Point(x, y); tile_surf = IDrawable(Resources.get((("tile" + tile.type) + "_surf"))); if (tile.type == Tile.FLAT){ SpriteFilm(tile_surf).nr = 0; }; tile_surf.draw(frame.surface, pos.x, pos.y); }; }; } override public function get z():int{ return (-8000); } override public function draw(frame:Frame):void{ if (frame.optimize_speed){ if (this.background == null){ this.init_background(); }; this.background.draw(frame.surface, 0, 0); } else { this.draw_background(frame); }; } protected function init_background():void{ var tile:Tile; var x:int; var y:int; var pos:Point; var tile_surf:IDrawable; this.background = Surface.create_surface(640, 480); this.background.fill(null, 0); var frame:Frame = new Frame(this.background, 0, 0); for each (tile in this.level.tiles) { if (getQualifiedClassName(tile) != "model::Enterance"){ x = (((tile.pos.x * 32) + (tile.pos.y * 32)) + frame.X_OFFSET); y = (((-(tile.pos.x) * 16) + (tile.pos.y * 16)) + frame.Y_OFFSET); pos = new Point(x, y); tile_surf = IDrawable(Resources.get((("tile" + tile.type) + "_surf"))); if (tile.type == Tile.FLAT){ SpriteFilm(tile_surf).nr = int((Math.random() * 5)); }; tile_surf.draw(frame.surface, pos.x, pos.y); }; }; } } }//package view
Section 94
//OilerView (view.OilerView) package view { import koon.gfx.*; import koon.frame.*; import model.*; import koon.geo.*; public class OilerView extends PickupView { public var animTimer:LoopAnimationTimer; public var sprite:SpriteFilm; public var oiler:Oiler; public function OilerView(model:GameModel){ super(model); this.oiler = Oiler(model); this.sprite = Resources.get("oiler_sprite").clone(); this.animTimer = new LoopAnimationTimer(2, 0, this.sprite.max_x); this.animTimer.set_frame(0, int((Math.random() * this.sprite.max_x))); } override public function draw(frame:Frame):void{ var pos:Vec2D; if (((!((this.get_pos(frame) == null))) && ((Oiler(this.oiler).goldcar == null)))){ this.sprite.nr = this.animTimer.get_frame(frame.time_sec); pos = Vec2D.from_point(this.get_pos(frame)).plus(new Vec2D(frame.X_OFFSET, frame.Y_OFFSET)); this.sprite.draw(frame.surface, pos.x, pos.y); }; } } }//package view
Section 95
//PickupContainerView (view.PickupContainerView) package view { import flash.geom.*; import koon.frame.*; public class PickupContainerView extends GameView { public function PickupContainerView(model:GameModel){ super(model); } public function get_pickup_pos(frame:Frame):Point{ return (null); } } }//package view
Section 96
//PickupView (view.PickupView) package view { import flash.geom.*; import koon.frame.*; import model.*; import koon.util.*; public class PickupView extends GameView { public var jump_pos:Point; public var pos:Point; protected var pickup:Pickup; public function PickupView(model:GameModel){ super(model); this.pickup = Pickup(model); } override public function get z():int{ if (this.pos == null){ return (-999); }; return ((this.pos.y + 64)); } public function get_pos(frame:Frame):Point{ var x:int; var y:int; var height:int; this.pos = null; if ((((this.pickup.container == null)) || ((this.pickup.container.views == null)))){ return (null); }; this.pos = PickupContainerView(this.pickup.container.views[0]).get_pickup_pos(frame); if (this.pickup.jump_cnt != -256){ if (this.jump_pos == null){ this.jump_pos = this.pos; }; x = Koon.lin_ipol(this.pickup.jump_cnt, this.jump_pos.x, this.pos.x); y = Koon.lin_ipol(this.pickup.jump_cnt, this.jump_pos.y, this.pos.y); height = this.pickup.jump_cnt; if (this.pickup.jump_cnt > 0.5){ height = (1 - this.pickup.jump_cnt); }; this.pos = new Point(x, (y - (30 * height))); } else { this.jump_pos = null; }; return (this.pos); } } }//package view
Section 97
//PlayfieldView (view.PlayfieldView) package view { import koon.frame.*; import model.*; public class PlayfieldView extends GameView { protected var playfield:Playfield; public function PlayfieldView(model:GameModel){ super(playfield); this.playfield = Playfield(model); } override public function draw(frame:Frame):void{ var draw_models:Array = new Array(); draw_models = draw_models.concat(this.playfield.goldcars); draw_models.push(this.playfield.level); frame.draw_z(draw_models); if (this.playfield.explosion != null){ this.playfield.explosion.draw(frame); }; } } }//package view
Section 98
//Sparkle (view.Sparkle) package view { import koon.gfx.*; import flash.geom.*; import koon.frame.*; public class Sparkle { public var move:Point; public var pos:Point; public var center:Point; public var surf:Surface; public var life:int; public function Sparkle(pos:Point){ super(); this.pos = new Point(pos.x, pos.y); this.life = (10 + int((Math.random() * 2))); this.move = new Point(((Math.random() * 5) - 2.5), (Math.random() * -2.5)); this.surf = Surface(Resources.get("sparkle_surf")); this.center = new Point((5 / 2), (5 / 2)); } public function draw(frame:Frame):void{ var pos:Point = new Point(((this.pos.x + this.center.x) + frame.X_OFFSET), ((this.pos.y + this.center.y) + frame.Y_OFFSET)); this.surf.draw(frame.surface, pos.x, pos.y); } public function is_dead():Boolean{ return ((this.life <= 0)); } public function tick():void{ this.life = (this.life - 1); this.pos.x = (this.pos.x + this.move.x); this.pos.y = (this.pos.y + this.move.y); this.move.y = (this.move.y + 0.1); } } }//package view
Section 99
//TileView (view.TileView) package view { import koon.gfx.*; import flash.geom.*; import koon.frame.*; import model.*; public class TileView extends PickupContainerView { protected var tile:Tile; public function TileView(model:GameModel){ super(model); this.tile = Tile(model); } override public function get z():int{ return ((((-(this.tile.pos.x) * 16) + (this.tile.pos.y * 16)) - 28)); } override public function draw(frame:Frame):void{ var pos:Point; var trail_surf:IDrawable; var selected_surf:IDrawable; if (this.tile.type == Tile.FLAT){ pos = new Point((((this.tile.pos.x * 32) + (this.tile.pos.y * 32)) + frame.X_OFFSET), (((-(this.tile.pos.x) * 16) + (this.tile.pos.y * 16)) + frame.Y_OFFSET)); if (this.tile.is_selected){ selected_surf = IDrawable(Resources.get("selected_tile_surf")); selected_surf.draw(frame.surface, pos.x, pos.y); }; trail_surf = IDrawable(Resources.get((("trail" + this.tile.trail.type) + "_surf"))); trail_surf.draw(frame.surface, pos.x, pos.y); }; if (this.tile.pickup != null){ frame.draw(GameModel(this.tile.pickup)); }; } override public function get_pickup_pos(frame:Frame):Point{ var center:Point = this.tile.get_center(); return (new Point(center.x, center.y)); } public function get_pos(frame:Frame):Point{ var x:int = (((this.tile.pos.x * 32) + (this.tile.pos.y * 32)) + frame.X_OFFSET); var y:int = (((-(this.tile.pos.x) * 16) + (this.tile.pos.y * 16)) + frame.Y_OFFSET); return (new Point(x, y)); } } }//package view
Section 100
//GameData (GameData) package { import flash.events.*; import model.*; import control.*; import flash.net.*; import flash.ui.*; public class GameData { public var quest:RandomQuest; public var feature_first:int; public var promo_amount:String; public var player_name:String;// = null public var promo_enabled:Boolean;// = false public var skill_level:SkillLevel; public var feature_div:int; public var promo_progress:int; public var goldcars:Array; public function GameData(){ super(); this.goldcars = [new HumanController(new GoldCar(null, 0), Keyboard.SPACE)]; this.quest = new RandomQuest(2); this.skill_level = new SkillLevel(0.3); this.retrieve_promo(); } private function securityErrorPromoHandler(event:SecurityErrorEvent):void{ trace(("Promo securityErrorHandler: " + event)); } private function completePromoHandler(event:Event):void{ var loader:URLLoader = URLLoader(event.target); var xml:XML = new XML(loader.data); if (xml.onein > 0){ this.promo_enabled = (int((Math.random() * xml.onein)) == 0); this.promo_progress = xml.progress; this.promo_amount = xml.amount; }; this.feature_first = int(xml.featurefirst); this.feature_div = int(xml.featurediv); } private function ioErrorPromoHandler(event:IOErrorEvent):void{ trace(("Promo ioErrorHandler: " + event)); } public function get_quest():RandomQuest{ return (this.quest); } public function retrieve_promo():void{ var loader:URLLoader = new URLLoader(); loader.addEventListener(Event.COMPLETE, completePromoHandler); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorPromoHandler); loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorPromoHandler); var request:URLRequest = new URLRequest("http://www.koonsolo.com/mysticmine/flashpromo.xml"); loader.load(request); //unresolved jump var _slot1 = error; trace("Unable to load requested document."); this.is_loaded = true; } } }//package
Section 101
//Highscore (Highscore) package { public class Highscore { public var score:int; public var place:int; public var name:String; public function Highscore(score:XML){ super(); this.place = score.place; this.name = score.name; this.score = score.score; } } }//package
Section 102
//IGameState (IGameState) package { import koon.input.*; import koon.gfx.*; public interface IGameState { function tick(:UserInput):void; function render(_arg1:Surface, _arg2:Number, _arg3:Number):void; function is_done():Boolean; } }//package
Section 103
//LevelStats (LevelStats) package { import flash.events.*; import koon.util.*; import flash.net.*; public class LevelStats { public var highscores:Array; public var scenario:int; public var level_nr:int; public var score_avg:Number; public var opponent_nr:int; public var is_saved:Boolean;// = false public var score_max:Number; public var is_loaded:Boolean;// = false public var pickup:int; public function LevelStats(scenario:int, level:int, pickup:int, opponents:int){ super(); this.scenario = scenario; this.level_nr = level; this.pickup = pickup; this.opponent_nr = opponents; this.score_avg = -1; this.score_max = -1; this.is_loaded = false; this.is_saved = false; this.retrieve_goals(); } protected function configureGetListeners(dispatcher:IEventDispatcher):void{ dispatcher.addEventListener(Event.COMPLETE, completeGetHandler); dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorGetHandler); dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorGetHandler); } protected function configureSetListeners(dispatcher:IEventDispatcher):void{ dispatcher.addEventListener(Event.COMPLETE, completeSetHandler); dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorSetHandler); dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorSetHandler); } private function securityErrorSetHandler(event:SecurityErrorEvent):void{ trace(("securityErrorHandler: " + event)); this.highscores = null; this.is_saved = true; } public function get_goal(skill:Number):int{ if ((((this.score_avg == -1)) && ((this.score_max == -1)))){ return (-1); }; if (skill < 0.5){ return (((skill * 2) * this.score_avg)); }; return (((((skill - 0.5) * 2) * (this.score_max - this.score_avg)) + this.score_avg)); } private function completeSetHandler(event:Event):void{ var score:XML; var loader:URLLoader = URLLoader(event.target); this.highscores = new Array(); var xml:XML = new XML(loader.data); var scores:XMLList = xml.highscore; for each (score in scores) { this.highscores.push(new Highscore(score)); }; this.is_saved = true; } private function securityErrorGetHandler(event:SecurityErrorEvent):void{ trace(("securityErrorHandler: " + event)); this.is_loaded = true; } public function get_skill(score:int):Number{ if ((((this.score_avg <= 0)) || ((this.score_max <= 0)))){ return (1); }; if (score < this.score_avg){ return (((Number(score) / this.score_avg) * 0.5)); }; if (this.score_max > this.score_avg){ return ((0.5 + (((Number(score) - this.score_avg) / (this.score_max - this.score_avg)) * 0.5))); }; return ((0.5 + ((Number(score) / this.score_max) * 0.5))); } private function ioErrorSetHandler(event:IOErrorEvent):void{ trace(("ioErrorHandler: " + event)); this.highscores = null; this.is_saved = true; } private function completeGetHandler(event:Event):void{ var score:XML; var loader:URLLoader = URLLoader(event.target); var xml:XML = new XML(loader.data); this.score_max = xml.max; this.score_avg = xml.avg; this.highscores = new Array(); var scores:XMLList = xml.highscore; for each (score in scores) { this.highscores.push(new Highscore(score)); }; this.is_loaded = true; } private function ioErrorGetHandler(event:IOErrorEvent):void{ trace(("ioErrorHandler: " + event)); this.is_loaded = true; } public function add_score(name:String, score:int):void{ var name = name; var score = score; var loader:URLLoader = new URLLoader(); this.configureSetListeners(loader); var pw:String = SHA1.encrypt((((((String(this.scenario) + String(this.level_nr)) + String(this.pickup)) + String(this.opponent_nr)) + name) + String(score))); var request:URLRequest = new URLRequest(((((((((((((("http://www.koonsolo.com/mysticmine/scores/setscore.php?scenario=" + this.scenario) + "&level=") + this.level_nr) + "&pickup=") + this.pickup) + "&opponents=") + this.opponent_nr) + "&name=") + escape(name)) + "&score=") + score) + "&pw=") + pw)); loader.load(request); //unresolved jump var _slot1 = error; trace("Unable to load requested document."); this.is_saved = true; } protected function retrieve_goals():void{ var loader:URLLoader = new URLLoader(); this.configureGetListeners(loader); var request:URLRequest = new URLRequest(((((((("http://www.koonsolo.com/mysticmine/scores/getscore.php?scenario=" + this.scenario) + "&level=") + this.level_nr) + "&pickup=") + this.pickup) + "&opponents=") + this.opponent_nr)); loader.load(request); //unresolved jump var _slot1 = error; trace("Unable to load requested document."); this.is_loaded = true; } } }//package
Section 104
//Monorail (Monorail) package { import koon.input.*; import koon.gfx.*; import flash.geom.*; import koon.frame.*; import model.*; import koon.app.*; import koon.snd.*; import view.*; public class Monorail extends Game { private var menu_music:Music; private var state:IGameState; private var game:MonorailGame; private var game_data:GameData; private var menu:MonorailMenu; public function Monorail():void{ super(); ViewRepository.register_views(Playfield, [PlayfieldView]); ViewRepository.register_views(Level, [LevelView]); ViewRepository.register_views(Tile, [TileView]); ViewRepository.register_views(Enterance, [EnteranceView, EnteranceTopView]); ViewRepository.register_views(GoldCar, [GoldCarView]); ViewRepository.register_views(Coin, [CoinView]); ViewRepository.register_views(Diamond, [DiamondView]); ViewRepository.register_views(Dynamite, [DynamiteView]); ViewRepository.register_views(Balloon, [BalloonView]); ViewRepository.register_views(Oiler, [OilerView]); this.game_data = new GameData(); this.game = new MonorailGame(game_data); this.menu = new MonorailMenu(game_data); this.state = this.menu; Sound.set_global_volume(0.8); Music.volume = 0.4; this.menu_music = Music(Resources.get("menu_music")); this.menu_music.play(); } override public function render(surface:Surface, xtrapol:Number, time_sec:Number):void{ surface.fill(new Rectangle(0, 0, 640, 480), 0); this.state.render(surface, xtrapol, time_sec); if (Sound.our_sound_volume > 0){ Surface(Resources.get("speaker_surf")).draw(surface, 22, 460); } else { Surface(Resources.get("speaker_no_surf")).draw(surface, 22, 460); }; if (Music.volume > 0){ Surface(Resources.get("note_surf")).draw(surface, 2, 460); } else { Surface(Resources.get("note_no_surf")).draw(surface, 2, 460); }; } override public function tick(inp:UserInput):void{ if (this.state == this.game){ if (!this.game.is_started){ if (this.game_data.get_quest().to_next_level()){ this.game.restart(this.game_data); }; } else { if (this.game.is_done()){ if (this.game.state == MonorailGame.STATE_DONE){ if (this.game_data.get_quest().to_next_level()){ this.game.restart(this.game_data); }; } else { if (this.game.state == MonorailGame.STATE_MENU){ this.state = this.menu; } else { if (this.game.state == MonorailGame.STATE_QUIT){ }; }; }; }; }; } else { if (this.state == this.menu){ if (this.menu.is_done()){ this.state = this.game; this.menu_music.stop(); }; }; }; this.state.tick(userinput); if (((((inp.mouse.went_down(Mouse.LEFT)) && ((inp.mouse.pos.x < 20)))) && ((inp.mouse.pos.y > 460)))){ if (Music.volume > 0){ Music.volume = 0; } else { Music.volume = 0.4; }; } else { if (((((inp.mouse.went_down(Mouse.LEFT)) && ((inp.mouse.pos.x < 42)))) && ((inp.mouse.pos.y > 460)))){ if (Sound.our_sound_volume > 0){ Sound.set_global_volume(0); } else { Sound.set_global_volume(0.8); }; }; }; } } }//package
Section 105
//MonorailGame (MonorailGame) package { import koon.input.*; import koon.gfx.*; import koon.frame.*; import model.*; import control.*; import hud.*; import koon.snd.*; import event.*; public class MonorailGame implements IGameState { public var playfield:Playfield; public var ingame_menu:Object; public var begin_timeout:int;// = 0 public var scenario:Scenario; public var state:int; public var game_data:GameData; public var controller:GroundControl; public var is_paused:Boolean;// = false public var music:Array; public var is_started:Boolean;// = false public var hudje:Hud; public var music_index:int; public static const STATE_GAME:int = 2; public static const STATE_TOTAL:int = 6; public static const STATE_MENU:int = 3; public static const STATE_DONE:int = 7; public static const STATE_STATS:int = 5; public static const STATE_NAME:int = 8; public static const STATE_BEGIN:int = 1; public static const STATE_QUIT:int = 4; public static const STATE_INTRO:int = 0; public function MonorailGame(game_data:GameData){ super(); this.is_started = false; this.music = [Music(Resources.get("music0")), Music(Resources.get("music1"))]; this.music_index = 0; } public function render(surface:Surface, xtrapol:Number, time_sec:Number):void{ if (!this.is_started){ return; }; var frame:Frame = new Frame(surface, xtrapol, time_sec); frame.draw(this.playfield); this.hudje.draw(frame); Event.draw(frame); } public function restart(game_data:GameData):void{ this.game_data = game_data; this.state = STATE_INTRO; this.scenario = game_data.get_quest().create_scenario(game_data.skill_level.value); this.playfield = this.scenario.playfield; this.controller = new GroundControl(this.playfield); this.init_goldcars(); this.hudje = new Hud(this.scenario, this.controller, this.game_data); this.hudje.start_intro_screen(); this.begin_timeout = (25 * 3); this.is_started = true; } public function init_goldcars():void{ var controller:Controller; var iq:Number; var goldcar_names:Array = new Array(); var controllers:Array = new Array(); for each (controller in this.game_data.goldcars) { goldcar_names.push(""); controllers.push(controller); }; for each (iq in this.game_data.get_quest().get_opponent_iqs()) { goldcar_names.push(""); controllers.push(new AiController(null, iq)); }; this.playfield.add_goldcars(goldcar_names); this.controller.add_controllers(controllers); } public function tick(inp:UserInput):void{ var random_spawn:Boolean; var spawns_left:Boolean; var skill:Number; var skill2:Number; if (!this.is_started){ return; }; if ((((this.ingame_menu == null)) && (!(this.is_paused)))){ if (this.state == MonorailGame.STATE_INTRO){ if (this.hudje.is_ready()){ this.hudje.end_info(); this.state = MonorailGame.STATE_BEGIN; Music(this.music[this.music_index]).play(); }; } else { if (this.state == MonorailGame.STATE_BEGIN){ if ((this.begin_timeout % 50) == 0){ random_spawn = true; spawns_left = this.playfield.spawn_next_goldcar(random_spawn); if (spawns_left){ this.begin_timeout = (this.begin_timeout + 50); }; }; this.controller.tick(inp); this.playfield.tick(); this.scenario.tick(); this.begin_timeout = (this.begin_timeout - 1); if (this.begin_timeout <= 0){ this.state = MonorailGame.STATE_GAME; }; } else { if (this.state == MonorailGame.STATE_GAME){ this.controller.tick(inp); this.playfield.tick(); this.scenario.tick(); if (this.scenario.is_finished()){ if (this.game_data.player_name != null){ this.game_data.get_quest().save_score(this.scenario, this.game_data.player_name); skill = this.game_data.get_quest().get_completed_skill(this.scenario); this.game_data.skill_level.update(skill); if (this.scenario.has_won()){ this.hudje.start_win_screen(); } else { this.hudje.start_lose_screen(); }; if (((this.game_data.promo_enabled) && ((this.game_data.promo_progress == this.game_data.quest.progress_cnt)))){ this.hudje.append_coupon_screen(); }; this.state = MonorailGame.STATE_STATS; } else { this.hudje.start_name_screen(); this.state = MonorailGame.STATE_NAME; }; Music(this.music[this.music_index]).stop(); this.music_index = ((this.music_index + 1) % 2); if (((!((this.playfield.dynamite == null))) && (!((this.playfield.dynamite.fuse_sound == null))))){ this.playfield.dynamite.fuse_sound.stop(); }; }; } else { if (this.state == MonorailGame.STATE_NAME){ if (this.hudje.is_ready()){ this.game_data.get_quest().save_score(this.scenario, this.game_data.player_name); skill2 = this.game_data.get_quest().get_completed_skill(this.scenario); this.game_data.skill_level.update(skill2); if (this.scenario.has_won()){ this.hudje.start_win_screen(); } else { this.hudje.start_lose_screen(); }; this.state = MonorailGame.STATE_STATS; }; } else { if (this.state == MonorailGame.STATE_STATS){ if (this.hudje.is_ready()){ if (this.scenario.has_won()){ this.state = MonorailGame.STATE_DONE; } else { this.state = MonorailGame.STATE_DONE; }; }; }; }; }; }; }; this.hudje.tick(inp); }; Event.update(); } public function is_done():Boolean{ return ((((((this.state == MonorailGame.STATE_DONE)) || ((this.state == MonorailGame.STATE_MENU)))) || ((this.state == MonorailGame.STATE_QUIT)))); } } }//package
Section 106
//MonorailMenu (MonorailMenu) package { import koon.input.*; import koon.gfx.*; import flash.geom.*; import koon.frame.*; import koon.gui.*; import menu.*; import flash.net.*; public class MonorailMenu implements IGameState { public var download_btn:Button; public var gui_state:GuiState; public var play_btn:Button; public var _is_done:Boolean; public var car_anim:CarAnimation; public var scores_btn:Button; public function MonorailMenu(game_data:GameData){ super(); this.gui_state = new GuiState(); this.play_btn = new Button(new Rectangle(430, 150, 150, 40)); this.play_btn.view = new ButtonImageView(this.play_btn, SpriteFilm(Resources.get("button01_sprite"))); this.play_btn.view.set_label("Play!", new Font("edmunds", 24, 4294967295)); this.scores_btn = new Button(new Rectangle(430, 210, 150, 40)); this.scores_btn.view = new ButtonImageView(this.scores_btn, SpriteFilm(Resources.get("button01_sprite"))); this.scores_btn.view.set_label("Highscores", new Font("edmunds", 24, 4294967295)); this.download_btn = new Button(new Rectangle(((640 - 250) + 53), ((480 - 160) + 71), 139, 69)); this.download_btn.view = new ButtonView(this.download_btn); this._is_done = false; this.car_anim = new CarAnimation(); } public function render(surface:Surface, xtrapol:Number, time_sec:Number):void{ Surface(Resources.get("mainmenu")).draw(surface, 0, 0); this.car_anim.draw(surface, xtrapol, time_sec); var frame:Frame = new Frame(surface, xtrapol, time_sec); this.play_btn.draw(frame); this.scores_btn.draw(frame); Surface(Resources.get("add_main")).draw(surface, (640 - 250), (480 - 160)); } public function is_done():Boolean{ return (_is_done); } public function tick(inp:UserInput):void{ this.play_btn.tick(inp, this.gui_state); this.scores_btn.tick(inp, this.gui_state); this.download_btn.tick(inp, this.gui_state); if (this.play_btn.went_down){ this._is_done = true; }; if (this.scores_btn.went_down){ navigateToURL(new URLRequest("http://www.koonsolo.com/mysticmine/flashscores.php?utm_source=flash&utm_medium=flash&utm_campaign=flashmenu")); }; if (this.download_btn.went_down){ navigateToURL(new URLRequest("http://www.koonsolo.com/mysticmine/flashpromo.php?utm_source=flash&utm_medium=flash&utm_campaign=flashmenu")); }; this.car_anim.tick(inp); } } }//package
Section 107
//Preloader (Preloader) package { import flash.events.*; import koon.util.*; import flash.display.*; import flash.text.*; import flash.utils.*; public class Preloader extends MovieClip { public var textfield:TextField; public function Preloader(){ super(); addEventListener(Event.ENTER_FRAME, checkFrame); loaderInfo.addEventListener(ProgressEvent.PROGRESS, progress); this.textfield = new TextField(); this.textfield.x = 160; this.textfield.y = 200; this.textfield.width = 400; this.textfield.textColor = 4294967295; this.textfield.defaultTextFormat = new TextFormat(null, 24); this.textfield.text = "Loading Mystic Mine..."; this.addChild(this.textfield); MochiBot.track(this, "fe81d8f7"); } private function progress(e:ProgressEvent):void{ this.textfield.text = (("Loading Mystic Mine... (" + int(((e.bytesLoaded * 100) / e.bytesTotal))) + "%)"); } private function startup():void{ stop(); loaderInfo.removeEventListener(ProgressEvent.PROGRESS, progress); var mainClass:Class = (getDefinitionByName("Monorail") as Class); addChild((new (mainClass) as DisplayObject)); } private function checkFrame(e:Event):void{ if (currentFrame == totalFrames){ removeEventListener(Event.ENTER_FRAME, checkFrame); startup(); }; } } }//package
Section 108
//RandomQuest (RandomQuest) package { import model.*; public class RandomQuest { public var to_learn:Array; public var available_pickups:Array; public var current_level:LevelStats;// = null public var max_opponent_nr:int; public var progress_cnt:int; public var max_level_nr:int; public var available_scenarios:Array; protected var learn_cnt:int; public var next_level:LevelStats;// = null public var current_learn:int; protected var next_learn:int; public static const SCENARIO_COIN_X:int = 2; public static const LEARN_PASS_DIAMOND:int = 2; public static const LEARN_OILER:int = 5; public static const SCENARIO_DIAMOND:int = 3; public static const PICKUP_BALLOON:int = 1; public static const LEARN_DYNAMITE:int = 3; protected static const MIN_LEVEL:int = 0; public static const LEARN_DIAMOND:int = 1; public static const PICKUP_NONE:int = 0; public static const PICKUP_OILER:int = 3; public static const SCENARIO_ALL:int = 4; protected static const MAX_LEVEL:int = 22; public static const SCENARIO_COIN_1:int = 1; public static const LEARN_SWITCH:int = 0; public static const SCENARIO_DYNAMITE:int = 5; public static const LEARN_BALLOON:int = 4; public function RandomQuest(max_opponent_nr:int=0){ to_learn = [LEARN_DIAMOND, LEARN_DYNAMITE, LEARN_BALLOON, LEARN_OILER]; super(); this.available_pickups = [PICKUP_NONE]; this.available_scenarios = [SCENARIO_COIN_1, SCENARIO_COIN_X]; this.max_level_nr = 3; this.max_opponent_nr = max_opponent_nr; this.next_level = this.get_new_levelstats(-1); this.current_learn = -1; this.next_learn = LEARN_SWITCH; this.learn_cnt = 0; this.progress_cnt = 0; } public function to_next_level():Boolean{ this.progress_cnt = (this.progress_cnt + 1); if (this.next_level.is_loaded){ this.current_level = this.next_level; this.current_learn = this.next_learn; this.next_level = this.get_new_levelstats(this.current_level.level_nr); return (true); }; return (false); } public function set_available_items(pickups:Array, scenarios:Array):void{ this.available_pickups = pickups; this.available_scenarios = scenarios; } public function save_score(scenario:Scenario, player_name:String):void{ this.current_level.add_score(player_name, GoldCar(scenario.playfield.goldcars[0]).score); } public function get_new_levelstats(prev_level_nr:int):LevelStats{ var opponents:int; var i:int; var scenario:int = this._get_random_item(this.available_scenarios); var level:int = prev_level_nr; while (level == prev_level_nr) { level = (int((Math.random() * (this.max_level_nr - RandomQuest.MIN_LEVEL))) + RandomQuest.MIN_LEVEL); }; var pickup:int = this._get_random_item(this.available_pickups); if (scenario != SCENARIO_DYNAMITE){ opponents = (Math.random() * (this.max_opponent_nr + 1)); if (this.progress_cnt < 3){ opponents = 0; }; } else { opponents = ((Math.random() * this.max_opponent_nr) + 1); }; this.max_level_nr = Math.min((this.max_level_nr + 1), MAX_LEVEL); this.next_learn = -1; if (this.to_learn.length > 0){ this.learn_cnt = (this.learn_cnt + 1); if (this.learn_cnt > 1){ i = (Math.random() * this.to_learn.length); this.next_learn = this.to_learn[i]; this.to_learn.splice(i, 1); switch (this.next_learn){ case LEARN_DIAMOND: this.available_scenarios.push(SCENARIO_DIAMOND); this.available_scenarios.push(SCENARIO_DIAMOND); this.available_scenarios.push(SCENARIO_ALL); this.available_scenarios.push(SCENARIO_ALL); this.to_learn.push(LEARN_PASS_DIAMOND); scenario = SCENARIO_DIAMOND; pickup = PICKUP_NONE; opponents = 0; break; case LEARN_PASS_DIAMOND: scenario = SCENARIO_DIAMOND; pickup = PICKUP_NONE; opponents = 1; break; case LEARN_DYNAMITE: this.available_scenarios.push(SCENARIO_DYNAMITE); scenario = SCENARIO_DYNAMITE; pickup = PICKUP_NONE; opponents = 1; break; case LEARN_BALLOON: this.available_pickups.push(PICKUP_BALLOON); scenario = SCENARIO_COIN_X; pickup = PICKUP_BALLOON; opponents = 0; break; case LEARN_OILER: this.available_pickups.push(PICKUP_OILER); pickup = PICKUP_OILER; break; }; this.learn_cnt = 0; }; if ((((scenario == SCENARIO_DIAMOND)) && ((this.to_learn.indexOf(LEARN_PASS_DIAMOND) >= 0)))){ opponents = 0; }; }; return (new LevelStats(scenario, level, pickup, opponents)); } public function _get_random_item(items:Array):int{ return (int(items[int((Math.random() * items.length))])); } public function get_opponent_iqs():Array{ var result:Array = new Array(); var i:int; while (i < this.current_level.opponent_nr) { result.push(1); i++; }; return (result); } public function create_scenario(skill:Number=1):Scenario{ var scenario:Scenario; var TIMEOUT = 60; var goal:int = this.current_level.get_goal(skill); var pickup:Array = new Array(); switch (this.current_level.pickup){ case PICKUP_BALLOON: pickup = [Balloon]; break; case PICKUP_OILER: pickup = [Oiler]; break; }; switch (this.current_level.scenario){ case SCENARIO_COIN_1: scenario = new ScenarioCoinCollect(TIMEOUT, goal, 1, pickup); break; case SCENARIO_COIN_X: scenario = new ScenarioCoinCollect(TIMEOUT, goal, 5, pickup); break; case SCENARIO_DIAMOND: scenario = new ScenarioDiamondCollect(TIMEOUT, (goal / 10), 1, pickup); break; case SCENARIO_ALL: scenario = new ScenarioCollectAll(TIMEOUT, goal, pickup); break; case SCENARIO_DYNAMITE: scenario = new ScenarioBlowup(TIMEOUT, goal, pickup); break; }; scenario.restart(); scenario.playfield = new Playfield(); scenario.playfield.load(this.current_level.level_nr); return (scenario); } public function get_completed_skill(scenario:Scenario):Number{ var score:int = GoldCar(scenario.playfield.goldcars[0]).score; return (this.current_level.get_skill(score)); } } }//package
Section 109
//Resources (Resources) package { import koon.gfx.*; import flash.geom.*; import flash.display.*; import model.*; import flash.utils.*; import flash.text.*; import koon.snd.*; import koon.res.*; public class Resources extends ResourceManager { private static const IntrocarPng:Class = Resources_IntrocarPng; private static const ExitbotSouthPng:Class = Resources_ExitbotSouthPng; private static const SpeakerNoPng:Class = Resources_SpeakerNoPng; private static const Level012Class:Class = Resources_Level012Class; private static const CarhitWav:Class = Resources_CarhitWav; private static const Level004Class:Class = Resources_Level004Class; private static const Level020Class:Class = Resources_Level020Class; private static const OilPng:Class = Resources_OilPng; private static const ClockWav:Class = Resources_ClockWav; private static const DiamondWav:Class = Resources_DiamondWav; private static const Level009Class:Class = Resources_Level009Class; private static const Level001Class:Class = Resources_Level001Class; private static const Level017Class:Class = Resources_Level017Class; private static const AddEndPng:Class = Resources_AddEndPng; private static const CopperPng:Class = Resources_CopperPng; private static const HeartlandMp3:Class = Resources_HeartlandMp3; private static const Level006Class:Class = Resources_Level006Class; private static const Level014Class:Class = Resources_Level014Class; private static const Car2Png:Class = Resources_Car2Png; private static const MainmenuPng:Class = Resources_MainmenuPng; private static const ExittopPng:Class = Resources_ExittopPng; private static const SparklePng:Class = Resources_SparklePng; private static const DiamondPng:Class = Resources_DiamondPng; private static const Button01Png:Class = Resources_Button01Png; private static const BreakneckMp3:Class = Resources_BreakneckMp3; private static const TileflatPng:Class = Resources_TileflatPng; private static const Level019Class:Class = Resources_Level019Class; private static const Level003Class:Class = Resources_Level003Class; private static const TruckstopMp3:Class = Resources_TruckstopMp3; private static const Level011Class:Class = Resources_Level011Class; private static const Edmunds:Class = Resources_Edmunds; private static const CoinWav:Class = Resources_CoinWav; private static const TilesPng:Class = Resources_TilesPng; private static const Level016Class:Class = Resources_Level016Class; private static const CollectWav:Class = Resources_CollectWav; private static const Level008Class:Class = Resources_Level008Class; private static const Level000Class:Class = Resources_Level000Class; private static const ExittopSouthPng:Class = Resources_ExittopSouthPng; private static const IntrocarManPng:Class = Resources_IntrocarManPng; private static const TilehillPng:Class = Resources_TilehillPng; private static const ExitbotPng:Class = Resources_ExitbotPng; private static const BalloonPng:Class = Resources_BalloonPng; private static const Level005Class:Class = Resources_Level005Class; private static const Car3Png:Class = Resources_Car3Png; private static const PickupWav:Class = Resources_PickupWav; private static const DynamitePng:Class = Resources_DynamitePng; private static const PaperDialogPng:Class = Resources_PaperDialogPng; private static const NoteNoPng:Class = Resources_NoteNoPng; private static const NotePng:Class = Resources_NotePng; private static const Level013Class:Class = Resources_Level013Class; private static const Level021Class:Class = Resources_Level021Class; private static const IntrocarHatPng:Class = Resources_IntrocarHatPng; private static const ExplosionWav:Class = Resources_ExplosionWav; private static const Level018Class:Class = Resources_Level018Class; private static const Level010Class:Class = Resources_Level010Class; private static const ClockRingWav:Class = Resources_ClockRingWav; private static const AddCouponPng:Class = Resources_AddCouponPng; private static const SpeakerPng:Class = Resources_SpeakerPng; private static const HudPng:Class = Resources_HudPng; private static const IntrocarHatFrontPng:Class = Resources_IntrocarHatFrontPng; private static const DynamiteFuseWav:Class = Resources_DynamiteFuseWav; private static const IntrocarCarPng:Class = Resources_IntrocarCarPng; private static const Level002Class:Class = Resources_Level002Class; private static const Level007Class:Class = Resources_Level007Class; private static const Level015Class:Class = Resources_Level015Class; private static const Car1Png:Class = Resources_Car1Png; private static const ExplosionPng:Class = Resources_ExplosionPng; private static const AddMainPng:Class = Resources_AddMainPng; private static const RailswitchWav:Class = Resources_RailswitchWav; protected static var resources:Dictionary = new Dictionary(); public function Resources(){ super(); } public static function get(path:String):Object{ var image:Bitmap; var surf:Surface; var spr:SpriteFilm; var font:Font; if (resources[path] == null){ switch (path){ case "hud_surf": image = new Resources.HudPng(); resources[path] = new Surface(image.bitmapData); break; case "mainmenu": image = new Resources.MainmenuPng(); resources[path] = new Surface(image.bitmapData); break; case "introcar_sprite": image = new Resources.IntrocarPng(); spr = new SpriteFilm(new Surface(image.bitmapData)); spr.set_div(5, 1); spr.center = new Point((-154 * 0.8), (-380 * 0.8)); resources[path] = spr; break; case "introcar_car": image = new Resources.IntrocarCarPng(); surf = new Surface(image.bitmapData); resources[path] = new SubSurf(surf, null, new Point((-321 * 0.8), (-135 * 0.8))); break; case "introcar_hat": image = new Resources.IntrocarHatPng(); surf = new Surface(image.bitmapData); resources[path] = new SubSurf(surf, null, new Point((-316 * 0.8), (-72 * 0.8))); break; case "introcar_hat_front": image = new Resources.IntrocarHatFrontPng(); surf = new Surface(image.bitmapData); resources[path] = new SubSurf(surf, null, new Point((-316 * 0.8), (-72 * 0.8))); break; case "introcar_man": image = new Resources.IntrocarManPng(); surf = new Surface(image.bitmapData); resources[path] = new SubSurf(surf, null, new Point((-251 * 0.8), (-101 * 0.8))); break; case "button01_sprite": image = new Resources.Button01Png(); spr = new SpriteFilm(new Surface(image.bitmapData)); spr.set_div(1, 2); spr.center = new Point(0, 0); resources[path] = spr; break; case "note_surf": image = new Resources.NotePng(); resources[path] = new Surface(image.bitmapData); break; case "note_no_surf": image = new Resources.NoteNoPng(); resources[path] = new Surface(image.bitmapData); break; case "speaker_surf": image = new Resources.SpeakerPng(); resources[path] = new Surface(image.bitmapData); break; case "speaker_no_surf": image = new Resources.SpeakerNoPng(); resources[path] = new Surface(image.bitmapData); break; case "add_main": image = new Resources.AddMainPng(); resources[path] = new Surface(image.bitmapData); break; case "add_end": image = new Resources.AddEndPng(); resources[path] = new Surface(image.bitmapData); break; case "add_coupon": image = new Resources.AddCouponPng(); resources[path] = new Surface(image.bitmapData); break; case "tile0_surf": image = new Resources.TileflatPng(); spr = new SpriteFilm(new Surface(image.bitmapData)); spr.set_dimension(69, 69); spr.center = new Point(3, 3); resources[path] = spr; break; case "tiles_surf": image = new Resources.TilesPng(); resources[path] = new Surface(image.bitmapData); break; case "tilehill_surf": image = new Resources.TilehillPng(); resources[path] = new Surface(image.bitmapData); break; case "sparkle_surf": image = new Resources.SparklePng(); resources[path] = new Surface(image.bitmapData); break; case "selected_tile_surf": resources[path] = new SubSurf(Surface(Resources.get("tiles_surf")), new Rectangle(192, 0, 64, 32)); break; case "trail0_surf": resources[path] = new SubSurf(Surface(Resources.get("tiles_surf")), new Rectangle(64, 0, 64, 32)); break; case "trail1_surf": resources[path] = new SubSurf(Surface(Resources.get("tiles_surf")), new Rectangle(0, 0, 64, 32)); break; case "trail2_surf": resources[path] = new SubSurf(Surface(Resources.get("tiles_surf")), new Rectangle(128, 32, 64, 32)); break; case "trail3_surf": resources[path] = new SubSurf(Surface(Resources.get("tiles_surf")), new Rectangle(128, 0, 64, 32)); break; case "trail4_surf": resources[path] = new SubSurf(Surface(Resources.get("tiles_surf")), new Rectangle(0, 32, 64, 32)); break; case "trail5_surf": resources[path] = new SubSurf(Surface(Resources.get("tiles_surf")), new Rectangle(64, 32, 64, 32)); break; case "tile1_surf": resources[path] = new SubSurf(Surface(Resources.get("tilehill_surf")), new Rectangle(317, 0, 82, 85), new Point(-16, 3)); break; case "tile2_surf": resources[path] = new SubSurf(Surface(Resources.get("tilehill_surf")), new Rectangle(266, 0, 51, 85), new Point(3, 19)); break; case "tile3_surf": resources[path] = new SubSurf(Surface(Resources.get("tilehill_surf")), new Rectangle(399, 0, 83, 85), new Point(35, 3)); break; case "tile4_surf": resources[path] = new SubSurf(Surface(Resources.get("tilehill_surf")), new Rectangle(482, 0, 50, 85), new Point(-16, 19)); break; case "tile5_surf": resources[path] = new SubSurf(Surface(Resources.get("tilehill_surf")), new Rectangle(0, 0, 83, 85), new Point(35, 3)); break; case "tile6_surf": resources[path] = new SubSurf(Surface(Resources.get("tilehill_surf")), new Rectangle(83, 0, 50, 85), new Point(-16, 51)); break; case "tile7_surf": resources[path] = new SubSurf(Surface(Resources.get("tilehill_surf")), new Rectangle(184, 0, 82, 85), new Point(-16, 3)); break; case "tile8_surf": resources[path] = new SubSurf(Surface(Resources.get("tilehill_surf")), new Rectangle(133, 0, 51, 85), new Point(3, 51)); break; case "exitboteast_surf": image = new Resources.ExitbotPng(); surf = new Surface(image.bitmapData); resources[path] = new SubSurf(surf, null, new Point(3, 36)); break; case "exitbotnorth_surf": image = new Resources.ExitbotSouthPng(); surf = new Surface(image.bitmapData); resources[path] = new SubSurf(surf, null, new Point(3, 36)); break; case "exittopeast_surf": image = new Resources.ExittopPng(); surf = new Surface(image.bitmapData); resources[path] = new SubSurf(surf, null, new Point(5, 41)); break; case "exittopnorth_surf": image = new Resources.ExittopSouthPng(); surf = new Surface(image.bitmapData); resources[path] = new SubSurf(surf, null, new Point(5, 41)); break; case "paperdialog_surf": image = new Resources.PaperDialogPng(); surf = new Surface(image.bitmapData); resources[path] = new SubSurf(surf, null, new Point(5, 41)); break; case "car1_sprite": image = new Resources.Car1Png(); spr = new SpriteFilm(new Surface(image.bitmapData)); spr.set_div(10, 1); spr.center = new Point(24, 31); resources[path] = spr; break; case "car2_sprite": image = new Resources.Car2Png(); spr = new SpriteFilm(new Surface(image.bitmapData)); spr.set_div(10, 1); spr.center = new Point(28, 35); resources[path] = spr; break; case "car3_sprite": image = new Resources.Car3Png(); spr = new SpriteFilm(new Surface(image.bitmapData)); spr.set_div(10, 1); spr.center = new Point(26, 30); resources[path] = spr; break; case "balloon_sprite": image = new Resources.BalloonPng(); spr = new SpriteFilm(new Surface(image.bitmapData)); spr.set_div(1, 1); spr.center = new Point(15, 31); resources[path] = spr; break; case "copper_sprite": image = new Resources.CopperPng(); spr = new SpriteFilm(new Surface(image.bitmapData)); spr.set_div(9, 1); spr.center = new Point(11, 19); resources[path] = spr; break; case "diamond_sprite": image = new Resources.DiamondPng(); spr = new SpriteFilm(new Surface(image.bitmapData)); spr.set_div(4, 1); spr.center = new Point(14, 24); resources[path] = spr; break; case "dynamite_sprite": image = new Resources.DynamitePng(); spr = new SpriteFilm(new Surface(image.bitmapData)); spr.set_div(4, 1); spr.center = new Point(11, 52); resources[path] = spr; break; case "explosion_sprite": image = new Resources.ExplosionPng(); spr = new SpriteFilm(new Surface(image.bitmapData)); spr.set_div(5, 1); spr.center = new Point(75, 70); resources[path] = spr; break; case "oiler_sprite": image = new Resources.OilPng(); spr = new SpriteFilm(new Surface(image.bitmapData)); spr.set_div(2, 1); spr.center = new Point(21, 31); resources[path] = spr; break; case "carhit_sound": resources[path] = new Sound(new Resources.CarhitWav()); break; case "clock_sound": resources[path] = new Sound(new Resources.ClockWav()); break; case "clockring_sound": resources[path] = new Sound(new Resources.ClockRingWav()); break; case "coin_sound": resources[path] = new Sound(new Resources.CoinWav()); break; case "collect_sound": resources[path] = new Sound(new Resources.CollectWav()); break; case "diamond_sound": resources[path] = new Sound(new Resources.DiamondWav()); break; case "explosion_sound": resources[path] = new Sound(new Resources.ExplosionWav()); break; case "dynamitefuse_sound": resources[path] = new Sound(new Resources.DynamiteFuseWav()); break; case "pickup_sound": resources[path] = new Sound(new Resources.PickupWav()); break; case "railswitch_sound": resources[path] = new Sound(new Resources.RailswitchWav()); break; case "menu_music": resources[path] = new Music(new Resources.HeartlandMp3()); break; case "music0": resources[path] = new Music(new Resources.BreakneckMp3()); break; case "music1": resources[path] = new Music(new Resources.TruckstopMp3()); break; case "edmunds": resources[path] = new Edmunds(); }; }; return (resources[path]); } public static function get_level(nr:int):Level{ var level_file:ByteArray; switch (nr){ case 0: level_file = ByteArray(new Level000Class()); break; case 1: level_file = ByteArray(new Level001Class()); break; case 2: level_file = ByteArray(new Level002Class()); break; case 3: level_file = ByteArray(new Level003Class()); break; case 4: level_file = ByteArray(new Level004Class()); break; case 5: level_file = ByteArray(new Level005Class()); break; case 6: level_file = ByteArray(new Level006Class()); break; case 7: level_file = ByteArray(new Level007Class()); break; case 8: level_file = ByteArray(new Level008Class()); break; case 9: level_file = ByteArray(new Level009Class()); break; case 10: level_file = ByteArray(new Level010Class()); break; case 11: level_file = ByteArray(new Level011Class()); break; case 12: level_file = ByteArray(new Level012Class()); break; case 13: level_file = ByteArray(new Level013Class()); break; case 14: level_file = ByteArray(new Level014Class()); break; case 15: level_file = ByteArray(new Level015Class()); break; case 16: level_file = ByteArray(new Level016Class()); break; case 17: level_file = ByteArray(new Level017Class()); break; case 18: level_file = ByteArray(new Level018Class()); break; case 19: level_file = ByteArray(new Level019Class()); break; case 20: level_file = ByteArray(new Level020Class()); break; case 21: level_file = ByteArray(new Level021Class()); break; }; return (Level.load(level_file)); } } }//package
Section 110
//Resources_AddCouponPng (Resources_AddCouponPng) package { import mx.core.*; public class Resources_AddCouponPng extends BitmapAsset { } }//package
Section 111
//Resources_AddEndPng (Resources_AddEndPng) package { import mx.core.*; public class Resources_AddEndPng extends BitmapAsset { } }//package
Section 112
//Resources_AddMainPng (Resources_AddMainPng) package { import mx.core.*; public class Resources_AddMainPng extends BitmapAsset { } }//package
Section 113
//Resources_BalloonPng (Resources_BalloonPng) package { import mx.core.*; public class Resources_BalloonPng extends BitmapAsset { } }//package
Section 114
//Resources_BreakneckMp3 (Resources_BreakneckMp3) package { import mx.core.*; public class Resources_BreakneckMp3 extends SoundAsset { } }//package
Section 115
//Resources_Button01Png (Resources_Button01Png) package { import mx.core.*; public class Resources_Button01Png extends BitmapAsset { } }//package
Section 116
//Resources_Car1Png (Resources_Car1Png) package { import mx.core.*; public class Resources_Car1Png extends BitmapAsset { } }//package
Section 117
//Resources_Car2Png (Resources_Car2Png) package { import mx.core.*; public class Resources_Car2Png extends BitmapAsset { } }//package
Section 118
//Resources_Car3Png (Resources_Car3Png) package { import mx.core.*; public class Resources_Car3Png extends BitmapAsset { } }//package
Section 119
//Resources_CarhitWav (Resources_CarhitWav) package { import mx.core.*; public class Resources_CarhitWav extends SoundAsset { } }//package
Section 120
//Resources_ClockRingWav (Resources_ClockRingWav) package { import mx.core.*; public class Resources_ClockRingWav extends SoundAsset { } }//package
Section 121
//Resources_ClockWav (Resources_ClockWav) package { import mx.core.*; public class Resources_ClockWav extends SoundAsset { } }//package
Section 122
//Resources_CoinWav (Resources_CoinWav) package { import mx.core.*; public class Resources_CoinWav extends SoundAsset { } }//package
Section 123
//Resources_CollectWav (Resources_CollectWav) package { import mx.core.*; public class Resources_CollectWav extends SoundAsset { } }//package
Section 124
//Resources_CopperPng (Resources_CopperPng) package { import mx.core.*; public class Resources_CopperPng extends BitmapAsset { } }//package
Section 125
//Resources_DiamondPng (Resources_DiamondPng) package { import mx.core.*; public class Resources_DiamondPng extends BitmapAsset { } }//package
Section 126
//Resources_DiamondWav (Resources_DiamondWav) package { import mx.core.*; public class Resources_DiamondWav extends SoundAsset { } }//package
Section 127
//Resources_DynamiteFuseWav (Resources_DynamiteFuseWav) package { import mx.core.*; public class Resources_DynamiteFuseWav extends SoundAsset { } }//package
Section 128
//Resources_DynamitePng (Resources_DynamitePng) package { import mx.core.*; public class Resources_DynamitePng extends BitmapAsset { } }//package
Section 129
//Resources_Edmunds (Resources_Edmunds) package { import mx.core.*; public class Resources_Edmunds extends FontAsset { } }//package
Section 130
//Resources_ExitbotPng (Resources_ExitbotPng) package { import mx.core.*; public class Resources_ExitbotPng extends BitmapAsset { } }//package
Section 131
//Resources_ExitbotSouthPng (Resources_ExitbotSouthPng) package { import mx.core.*; public class Resources_ExitbotSouthPng extends BitmapAsset { } }//package
Section 132
//Resources_ExittopPng (Resources_ExittopPng) package { import mx.core.*; public class Resources_ExittopPng extends BitmapAsset { } }//package
Section 133
//Resources_ExittopSouthPng (Resources_ExittopSouthPng) package { import mx.core.*; public class Resources_ExittopSouthPng extends BitmapAsset { } }//package
Section 134
//Resources_ExplosionPng (Resources_ExplosionPng) package { import mx.core.*; public class Resources_ExplosionPng extends BitmapAsset { } }//package
Section 135
//Resources_ExplosionWav (Resources_ExplosionWav) package { import mx.core.*; public class Resources_ExplosionWav extends SoundAsset { } }//package
Section 136
//Resources_HeartlandMp3 (Resources_HeartlandMp3) package { import mx.core.*; public class Resources_HeartlandMp3 extends SoundAsset { } }//package
Section 137
//Resources_HudPng (Resources_HudPng) package { import mx.core.*; public class Resources_HudPng extends BitmapAsset { } }//package
Section 138
//Resources_IntrocarCarPng (Resources_IntrocarCarPng) package { import mx.core.*; public class Resources_IntrocarCarPng extends BitmapAsset { } }//package
Section 139
//Resources_IntrocarHatFrontPng (Resources_IntrocarHatFrontPng) package { import mx.core.*; public class Resources_IntrocarHatFrontPng extends BitmapAsset { } }//package
Section 140
//Resources_IntrocarHatPng (Resources_IntrocarHatPng) package { import mx.core.*; public class Resources_IntrocarHatPng extends BitmapAsset { } }//package
Section 141
//Resources_IntrocarManPng (Resources_IntrocarManPng) package { import mx.core.*; public class Resources_IntrocarManPng extends BitmapAsset { } }//package
Section 142
//Resources_IntrocarPng (Resources_IntrocarPng) package { import mx.core.*; public class Resources_IntrocarPng extends BitmapAsset { } }//package
Section 143
//Resources_Level000Class (Resources_Level000Class) package { import mx.core.*; public class Resources_Level000Class extends ByteArrayAsset { } }//package
Section 144
//Resources_Level001Class (Resources_Level001Class) package { import mx.core.*; public class Resources_Level001Class extends ByteArrayAsset { } }//package
Section 145
//Resources_Level002Class (Resources_Level002Class) package { import mx.core.*; public class Resources_Level002Class extends ByteArrayAsset { } }//package
Section 146
//Resources_Level003Class (Resources_Level003Class) package { import mx.core.*; public class Resources_Level003Class extends ByteArrayAsset { } }//package
Section 147
//Resources_Level004Class (Resources_Level004Class) package { import mx.core.*; public class Resources_Level004Class extends ByteArrayAsset { } }//package
Section 148
//Resources_Level005Class (Resources_Level005Class) package { import mx.core.*; public class Resources_Level005Class extends ByteArrayAsset { } }//package
Section 149
//Resources_Level006Class (Resources_Level006Class) package { import mx.core.*; public class Resources_Level006Class extends ByteArrayAsset { } }//package
Section 150
//Resources_Level007Class (Resources_Level007Class) package { import mx.core.*; public class Resources_Level007Class extends ByteArrayAsset { } }//package
Section 151
//Resources_Level008Class (Resources_Level008Class) package { import mx.core.*; public class Resources_Level008Class extends ByteArrayAsset { } }//package
Section 152
//Resources_Level009Class (Resources_Level009Class) package { import mx.core.*; public class Resources_Level009Class extends ByteArrayAsset { } }//package
Section 153
//Resources_Level010Class (Resources_Level010Class) package { import mx.core.*; public class Resources_Level010Class extends ByteArrayAsset { } }//package
Section 154
//Resources_Level011Class (Resources_Level011Class) package { import mx.core.*; public class Resources_Level011Class extends ByteArrayAsset { } }//package
Section 155
//Resources_Level012Class (Resources_Level012Class) package { import mx.core.*; public class Resources_Level012Class extends ByteArrayAsset { } }//package
Section 156
//Resources_Level013Class (Resources_Level013Class) package { import mx.core.*; public class Resources_Level013Class extends ByteArrayAsset { } }//package
Section 157
//Resources_Level014Class (Resources_Level014Class) package { import mx.core.*; public class Resources_Level014Class extends ByteArrayAsset { } }//package
Section 158
//Resources_Level015Class (Resources_Level015Class) package { import mx.core.*; public class Resources_Level015Class extends ByteArrayAsset { } }//package
Section 159
//Resources_Level016Class (Resources_Level016Class) package { import mx.core.*; public class Resources_Level016Class extends ByteArrayAsset { } }//package
Section 160
//Resources_Level017Class (Resources_Level017Class) package { import mx.core.*; public class Resources_Level017Class extends ByteArrayAsset { } }//package
Section 161
//Resources_Level018Class (Resources_Level018Class) package { import mx.core.*; public class Resources_Level018Class extends ByteArrayAsset { } }//package
Section 162
//Resources_Level019Class (Resources_Level019Class) package { import mx.core.*; public class Resources_Level019Class extends ByteArrayAsset { } }//package
Section 163
//Resources_Level020Class (Resources_Level020Class) package { import mx.core.*; public class Resources_Level020Class extends ByteArrayAsset { } }//package
Section 164
//Resources_Level021Class (Resources_Level021Class) package { import mx.core.*; public class Resources_Level021Class extends ByteArrayAsset { } }//package
Section 165
//Resources_MainmenuPng (Resources_MainmenuPng) package { import mx.core.*; public class Resources_MainmenuPng extends BitmapAsset { } }//package
Section 166
//Resources_NoteNoPng (Resources_NoteNoPng) package { import mx.core.*; public class Resources_NoteNoPng extends BitmapAsset { } }//package
Section 167
//Resources_NotePng (Resources_NotePng) package { import mx.core.*; public class Resources_NotePng extends BitmapAsset { } }//package
Section 168
//Resources_OilPng (Resources_OilPng) package { import mx.core.*; public class Resources_OilPng extends BitmapAsset { } }//package
Section 169
//Resources_PaperDialogPng (Resources_PaperDialogPng) package { import mx.core.*; public class Resources_PaperDialogPng extends BitmapAsset { } }//package
Section 170
//Resources_PickupWav (Resources_PickupWav) package { import mx.core.*; public class Resources_PickupWav extends SoundAsset { } }//package
Section 171
//Resources_RailswitchWav (Resources_RailswitchWav) package { import mx.core.*; public class Resources_RailswitchWav extends SoundAsset { } }//package
Section 172
//Resources_SparklePng (Resources_SparklePng) package { import mx.core.*; public class Resources_SparklePng extends BitmapAsset { } }//package
Section 173
//Resources_SpeakerNoPng (Resources_SpeakerNoPng) package { import mx.core.*; public class Resources_SpeakerNoPng extends BitmapAsset { } }//package
Section 174
//Resources_SpeakerPng (Resources_SpeakerPng) package { import mx.core.*; public class Resources_SpeakerPng extends BitmapAsset { } }//package
Section 175
//Resources_TileflatPng (Resources_TileflatPng) package { import mx.core.*; public class Resources_TileflatPng extends BitmapAsset { } }//package
Section 176
//Resources_TilehillPng (Resources_TilehillPng) package { import mx.core.*; public class Resources_TilehillPng extends BitmapAsset { } }//package
Section 177
//Resources_TilesPng (Resources_TilesPng) package { import mx.core.*; public class Resources_TilesPng extends BitmapAsset { } }//package
Section 178
//Resources_TruckstopMp3 (Resources_TruckstopMp3) package { import mx.core.*; public class Resources_TruckstopMp3 extends SoundAsset { } }//package
Section 179
//Scenario (Scenario) package { import flash.geom.*; import model.*; import flash.utils.*; import koon.app.*; public class Scenario { public var completed_time:int; public var is_multiplayer:Boolean; public var playfield:Playfield; public var goal:int; public var title:String; public var timeout:int; public var ontime:Boolean; public var pickups:Array; public function Scenario(timeout:int, goal:int, pickups:Array, is_multiplayer:Boolean=true){ super(); if (timeout >= 0){ this.timeout = (timeout * Game.TICKS_PER_SECOND); } else { this.timeout = -1; }; this.goal = goal; this.completed_time = 0; this.pickups = pickups; this.is_multiplayer = is_multiplayer; this.ontime = true; this.restart(); } public function restart():void{ } public function get_type_id():int{ return (-1); } public function update_goldcar_amounts():void{ var goldcar:GoldCar; var ranking:Array; var inc:int; var amount:int; var prev_score:int; var goldcars:Array; var gc:GoldCar; if ((((this.playfield.goldcars.length == 1)) || (!(this.is_multiplayer)))){ for each (goldcar in this.playfield.goldcars) { if (this.goal > 0){ goldcar.amount = Math.max(0, Math.min(3, ((goldcar.score * 4) / this.goal))); }; }; } else { ranking = this.playfield.get_goldcar_ranking(); if (ranking.length > 1){ inc = (3 / Math.min(3, (ranking.lenth - 1))); } else { inc = 3; }; amount = Math.min(3, ranking[0][0].score); prev_score = ranking[0][0].score; for each (goldcars in ranking) { amount = (amount - Math.min(inc, (prev_score - goldcars[0].score))); for each (gc in goldcars) { gc.amount = Math.max(0, amount); }; prev_score = goldcars[0].score; }; }; } public function tick():void{ var sum_pickups:int; var pickup_class:Class; var i:int; this.handle_explosions(); if (this.timeout > 0){ this.timeout = (this.timeout - 1); }; this.completed_time = (this.completed_time + 1); if (((!((this.pickups == null))) && ((this.pickups.length > 0)))){ sum_pickups = 0; for each (pickup_class in this.pickups) { sum_pickups = (sum_pickups + this.playfield.get_pickup_count(pickup_class)); }; if ((((sum_pickups < 1)) && ((int((Math.random() * (Game.TICKS_PER_SECOND * 1))) == 0)))){ i = (Math.random() * this.pickups.length); this.playfield.spawn_pickup(new (this.pickups[i])); }; }; this.update_goldcar_amounts(); } public function clone():Scenario{ return (new Scenario((this.timeout / Game.TICKS_PER_SECOND), this.goal, this.pickups, this.is_multiplayer)); } public function is_finished():Boolean{ var _local1:GoldCar; if (this.timeout == 0){ return (true); }; return (false); return (false); } public function has_won():Boolean{ if (this.goal >= 0){ return ((this.playfield.goldcars[0].score >= this.goal)); }; return (true); } public function handle_explosions():void{ var goldcar:GoldCar; var old_score:int; var pos:Point; var end_tiles:Array; var i:int; for each (goldcar in this.playfield.goldcars) { if (getQualifiedClassName(goldcar.collectible) == "model::Dynamite"){ if (Dynamite(goldcar.collectible).explode()){ old_score = goldcar.score; goldcar.score = (goldcar.score / 2); pos = goldcar.pos.get_screen_position(); end_tiles = new Array(); i = 0; while (i < (old_score - goldcar.score)) { end_tiles.push(this.playfield.level.get_random_flat_tile()); i++; }; this.playfield.explosion = new Explosion(pos, end_tiles); goldcar.collectible = null; }; }; }; } public function get_timeout():int{ if (this.timeout >= 0){ return ((this.timeout / Game.TICKS_PER_SECOND)); }; return (-1); } public function get description():String{ return ("Description..."); } public function get mission_txt():String{ return ("Your mission is..."); } } }//package
Section 180
//ScenarioBlowup (ScenarioBlowup) package { import flash.geom.*; import model.*; import flash.utils.*; import koon.app.*; public class ScenarioBlowup extends Scenario { public var seconds_tick:int; public var explosion_timeout:int; public function ScenarioBlowup(timeout:int, goal:int, pickups:Array, is_multiplayer:Boolean=true){ super(timeout, goal, pickups, is_multiplayer); this.title = "Pass the Dynamite"; } override public function handle_explosions():void{ var goldcar:GoldCar; var old_score:int; var c:GoldCar; var pos:Point; for each (goldcar in this.playfield.goldcars) { if (getQualifiedClassName(goldcar.collectible) == "model::Dynamite"){ if (Dynamite(goldcar.collectible).explode()){ old_score = goldcar.score; for each (c in this.playfield.goldcars) { c.score = (c.score + 50); }; goldcar.score = (goldcar.score - 50); pos = goldcar.pos.get_screen_position(); this.playfield.explosion = new Explosion(pos, new Array()); this.explosion_timeout = (25 * 2); goldcar.collectible = null; }; }; }; } override public function tick():void{ var cars:Array; var goldcar:GoldCar; if (this.explosion_timeout <= 0){ if (this.playfield.get_pickup_count(Dynamite) < 1){ cars = this.playfield.goldcars; this.playfield.spawn_dynamite_on_car(cars[0]); }; } else { this.explosion_timeout = (this.explosion_timeout - 1); }; seconds_tick = ((seconds_tick + 1) % Game.TICKS_PER_SECOND); if ((((seconds_tick == 0)) && ((this.playfield.get_pickup_count(Dynamite) > 0)))){ for each (goldcar in this.playfield.goldcars) { if (getQualifiedClassName(goldcar.collectible) != "model::Dynamite"){ goldcar.score = (goldcar.score + 1); }; }; }; super.tick(); } override public function get mission_txt():String{ var goldcar_score:int; var goldcar_score2:int; if (this.goal >= 0){ goldcar_score = this.playfield.goldcars[0].score; if (goldcar_score < this.goal){ return ((("Avoid the dynamite for " + (this.goal - goldcar_score)) + " more points.")); }; return ((("All dynamites avoided, " + (goldcar_score - this.goal)) + " bonus points")); } else { goldcar_score2 = this.playfield.goldcars[0].score; }; return ((goldcar_score2 + " points collected.")); } override public function get_type_id():int{ return (5); } override public function get description():String{ var seconds:int = (this.timeout / Game.TICKS_PER_SECOND); if (this.goal >= 0){ return ((((("Avoid the dynamite during " + seconds) + " seconds and collect") + this.goal) + " points.")); }; return ((("Avoid the dynamite during " + seconds) + " seconds.")); } override public function clone():Scenario{ return (new ScenarioBlowup((this.timeout / Game.TICKS_PER_SECOND), this.goal, this.pickups, this.is_multiplayer)); } override public function restart():void{ this.explosion_timeout = 0; this.seconds_tick = 0; } } }//package
Section 181
//ScenarioCoinCollect (ScenarioCoinCollect) package { import model.*; import koon.app.*; public class ScenarioCoinCollect extends Scenario { public var max_gold:int; public var coin_start_cnt:int; public function ScenarioCoinCollect(timeout:int, goal:int, max_spawn:int, pickups:Array, is_multiplayer:Boolean=true, ontime:Boolean=true){ super(timeout, goal, pickups, is_multiplayer); this.max_gold = max_spawn; this.title = "Coin Collect"; this.ontime = ontime; this.coin_start_cnt = goal; } override public function tick():void{ if (this.playfield.get_pickup_count(Coin) < this.max_gold){ this.playfield.spawn_pickup(new Coin()); }; super.tick(); } override public function get mission_txt():String{ var goldcar_score:int; var goldcar_score2:int; if (this.goal >= 0){ goldcar_score = this.playfield.goldcars[0].score; if (goldcar_score < this.goal){ return ((("Collect " + (this.goal - goldcar_score)) + " more coins")); }; return ((("All coins collected, " + (goldcar_score - this.goal)) + " bonus points")); } else { goldcar_score2 = this.playfield.goldcars[0].score; }; return ((goldcar_score2 + " coins collected.")); } override public function get_type_id():int{ if (this.max_gold == 1){ return (1); }; return (2); } override public function get description():String{ var seconds:int = (this.timeout / Game.TICKS_PER_SECOND); if (this.goal >= 0){ return ((((("Collect " + this.goal) + " coins in ") + seconds) + " seconds.")); }; return ((("Collect coins in " + seconds) + " seconds.")); } override public function clone():Scenario{ return (new ScenarioCoinCollect((this.timeout / Game.TICKS_PER_SECOND), this.goal, this.max_gold, this.pickups, this.is_multiplayer, this.ontime)); } } }//package
Section 182
//ScenarioCollectAll (ScenarioCollectAll) package { import model.*; import koon.app.*; public class ScenarioCollectAll extends Scenario { public function ScenarioCollectAll(timeout:int, goal:int, pickups:Array, is_multiplayer:Boolean=true){ super(timeout, goal, pickups, is_multiplayer); this.title = "Collect Frenzy"; } override public function get mission_txt():String{ var goldcar_score:int; var goldcar_score2:int; if (this.goal >= 0){ goldcar_score = this.playfield.goldcars[0].score; if (goldcar_score < this.goal){ return ((("Collect " + (this.goal - goldcar_score)) + " more points")); }; return ((("All points collected, " + (goldcar_score - this.goal)) + " bonus points")); } else { goldcar_score2 = this.playfield.goldcars[0].score; }; return ((goldcar_score2 + " points collected.")); } override public function get description():String{ var seconds:int = (this.timeout / Game.TICKS_PER_SECOND); if (this.goal >= 0){ return ((((("Collect " + this.goal) + " points in ") + seconds) + " seconds.")); }; return ((("Collect points in " + seconds) + " seconds.")); } override public function clone():Scenario{ return (new ScenarioCollectAll((this.timeout / Game.TICKS_PER_SECOND), this.goal, this.pickups, this.is_multiplayer)); } override public function get_type_id():int{ return (4); } override public function tick():void{ if (this.playfield.get_pickup_count(Coin) < 6){ this.playfield.spawn_pickup(new Coin()); }; if (this.playfield.get_pickup_count(Diamond) < 2){ this.playfield.spawn_pickup(new Diamond()); }; super.tick(); } } }//package
Section 183
//ScenarioDiamondCollect (ScenarioDiamondCollect) package { import model.*; import koon.app.*; public class ScenarioDiamondCollect extends Scenario { public var max_diamonds:int; public function ScenarioDiamondCollect(timeout:int, goal:int, max_diamonds:int, pickups:Array, is_multiplayer:Boolean=true){ var goalTen:int = goal; if (goalTen >= 0){ goalTen = (goalTen * 10); }; super(timeout, goalTen, pickups, is_multiplayer); this.max_diamonds = max_diamonds; this.title = "Diamond Collect"; } override public function tick():void{ var diamond_cnt:int = this.playfield.get_pickup_count(Diamond); if (diamond_cnt < this.max_diamonds){ this.playfield.spawn_pickup(new Diamond()); }; super.tick(); } override public function get_type_id():int{ return (3); } override public function get description():String{ var seconds:int = (this.timeout / Game.TICKS_PER_SECOND); if (this.goal >= 0){ return ((((("Collect " + (this.goal / 10)) + " diamonds in ") + seconds) + " seconds.")); }; return ((("Collect diamonds in " + seconds) + " seconds.")); } override public function clone():Scenario{ var goal:int = this.goal; if (goal >= 0){ goal = (goal / 10); }; return (new ScenarioDiamondCollect((this.timeout / Game.TICKS_PER_SECOND), goal, this.max_diamonds, this.pickups, this.is_multiplayer)); } override public function get mission_txt():String{ var goldcar_score:int; var goldcar_score2:int; if (this.goal >= 0){ goldcar_score = this.playfield.goldcars[0].score; if (goldcar_score < this.goal){ return ((("Collect " + ((this.goal - goldcar_score) / 10)) + " more diamonds")); }; return ((("All diamonds collected, " + (goldcar_score - this.goal)) + " bonus points")); } else { goldcar_score2 = this.playfield.goldcars[0].score; }; return (((!NULL! / !NULL!) + " diamonds collected.")); } } }//package
Section 184
//SkillLevel (SkillLevel) package { public class SkillLevel { public var value:Number; public var old_value:Number; public static const NAMES:Array = ["The Best", "Expert", "Master", "Experienced", "Professional", "Amateur", "Apprentice", "Beginner"]; public function SkillLevel(value:Number){ super(); this.value = value; this.old_value = this.value; } public function update(value:Number):void{ this.old_value = this.value; var average:Number = ((this.value + value) / 2); var INC_DEC_LIMIT:Number = 0.25; if ((average - this.value) > INC_DEC_LIMIT){ this.value = (this.value + INC_DEC_LIMIT); } else { if ((this.value - average) > INC_DEC_LIMIT){ this.value = (this.value - INC_DEC_LIMIT); } else { this.value = average; }; }; } public function get name():String{ if (this.value >= 1){ return (_slot1.NAMES[0]); }; if (this.value >= 0.9){ return (_slot1.NAMES[1]); }; if (this.value >= 0.8){ return (_slot1.NAMES[2]); }; if (this.value >= 0.7){ return (_slot1.NAMES[3]); }; if (this.value >= 0.6){ return (_slot1.NAMES[4]); }; if (this.value >= 0.5){ return (_slot1.NAMES[5]); }; if (this.value >= 0.4){ return (_slot1.NAMES[6]); }; return (_slot1.NAMES[7]); } } }//package

Library Items

Symbol 1 Sound {Resources_ExplosionWav} [Resources_ExplosionWav]
Symbol 2 Sound {Resources_PickupWav} [Resources_PickupWav]
Symbol 3 Sound {Resources_CoinWav} [Resources_CoinWav]
Symbol 4 Sound {Resources_BreakneckMp3} [Resources_BreakneckMp3]
Symbol 5 Sound {Resources_RailswitchWav} [Resources_RailswitchWav]
Symbol 6 Sound {Resources_DiamondWav} [Resources_DiamondWav]
Symbol 7 Sound {Resources_TruckstopMp3} [Resources_TruckstopMp3]
Symbol 8 Sound {Resources_HeartlandMp3} [Resources_HeartlandMp3]
Symbol 9 Sound {Resources_DynamiteFuseWav} [Resources_DynamiteFuseWav]
Symbol 10 Sound {Resources_ClockRingWav} [Resources_ClockRingWav]
Symbol 11 Sound {Resources_CollectWav} [Resources_CollectWav]
Symbol 12 Sound {Resources_CarhitWav} [Resources_CarhitWav]
Symbol 13 Sound {Resources_ClockWav} [Resources_ClockWav]
Symbol 14 BinaryData {Resources_Level010Class}
Symbol 15 Font {Resources_Edmunds}
Symbol 16 Bitmap {Resources_PaperDialogPng}
Symbol 17 Bitmap {Resources_BalloonPng}
Symbol 18 Bitmap {Resources_IntrocarManPng}
Symbol 19 BinaryData {Resources_Level014Class}
Symbol 20 Bitmap {Resources_Car2Png}
Symbol 21 Bitmap {Resources_DiamondPng}
Symbol 22 Bitmap {Resources_DynamitePng}
Symbol 23 Bitmap {Resources_AddEndPng}
Symbol 24 BinaryData {Resources_Level005Class}
Symbol 25 Bitmap {Resources_SpeakerNoPng}
Symbol 26 Bitmap {Resources_Car3Png}
Symbol 27 BinaryData {Resources_Level003Class}
Symbol 28 Bitmap {Resources_Button01Png}
Symbol 29 BinaryData {Resources_Level000Class}
Symbol 30 Bitmap {Resources_MainmenuPng}
Symbol 31 BinaryData {Resources_Level013Class}
Symbol 32 BinaryData {Resources_Level021Class}
Symbol 33 BinaryData {Resources_Level015Class}
Symbol 34 Bitmap {Resources_TileflatPng}
Symbol 35 BinaryData {Resources_Level004Class}
Symbol 36 Bitmap {Resources_SpeakerPng}
Symbol 37 Bitmap {Resources_CopperPng}
Symbol 38 Bitmap {Resources_ExittopSouthPng}
Symbol 39 BinaryData {Resources_Level018Class}
Symbol 40 Bitmap {Resources_TilesPng}
Symbol 41 BinaryData {Resources_Level006Class}
Symbol 42 BinaryData {Resources_Level009Class}
Symbol 43 BinaryData {Resources_Level016Class}
Symbol 44 Bitmap {Resources_IntrocarCarPng}
Symbol 45 Bitmap {Resources_TilehillPng}
Symbol 46 Bitmap {Resources_Car1Png}
Symbol 47 Bitmap {Resources_IntrocarPng}
Symbol 48 BinaryData {Resources_Level020Class}
Symbol 49 Bitmap {Resources_AddMainPng}
Symbol 50 BinaryData {Resources_Level012Class}
Symbol 51 Bitmap {Resources_NotePng}
Symbol 52 Bitmap {Resources_ExitbotSouthPng}
Symbol 53 BinaryData {Resources_Level007Class}
Symbol 54 BinaryData {Resources_Level011Class}
Symbol 55 Bitmap {Resources_SparklePng}
Symbol 56 BinaryData {Resources_Level002Class}
Symbol 57 Bitmap {Resources_NoteNoPng}
Symbol 58 BinaryData {Resources_Level008Class}
Symbol 59 Bitmap {Resources_HudPng}
Symbol 60 BinaryData {Resources_Level019Class}
Symbol 61 BinaryData {Resources_Level001Class}
Symbol 62 Bitmap {Resources_IntrocarHatPng}
Symbol 63 Bitmap {Resources_ExittopPng}
Symbol 64 BinaryData {Resources_Level017Class}
Symbol 65 Bitmap {Resources_ExitbotPng}
Symbol 66 Bitmap {Resources_OilPng}
Symbol 67 Bitmap {Resources_AddCouponPng}
Symbol 68 Bitmap {Resources_ExplosionPng}
Symbol 69 Bitmap {Resources_IntrocarHatFrontPng}

Special Tags

FileAttributes (69)Timeline Frame 1Access network only, Metadata present, AS3.
SWFMetaData (77)Timeline Frame 1459 bytes "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'><rdf:Description rdf:about='' xmlns ..."
ScriptLimits (65)Timeline Frame 1MaxRecursionDepth: 1000, ScriptTimeout: 60 seconds
ExportAssets (56)Timeline Frame 2Symbol 1 as "Resources_ExplosionWav"
ExportAssets (56)Timeline Frame 2Symbol 2 as "Resources_PickupWav"
ExportAssets (56)Timeline Frame 2Symbol 3 as "Resources_CoinWav"
ExportAssets (56)Timeline Frame 2Symbol 4 as "Resources_BreakneckMp3"
ExportAssets (56)Timeline Frame 2Symbol 5 as "Resources_RailswitchWav"
ExportAssets (56)Timeline Frame 2Symbol 6 as "Resources_DiamondWav"
ExportAssets (56)Timeline Frame 2Symbol 7 as "Resources_TruckstopMp3"
ExportAssets (56)Timeline Frame 2Symbol 8 as "Resources_HeartlandMp3"
ExportAssets (56)Timeline Frame 2Symbol 9 as "Resources_DynamiteFuseWav"
ExportAssets (56)Timeline Frame 2Symbol 10 as "Resources_ClockRingWav"
ExportAssets (56)Timeline Frame 2Symbol 11 as "Resources_CollectWav"
ExportAssets (56)Timeline Frame 2Symbol 12 as "Resources_CarhitWav"
ExportAssets (56)Timeline Frame 2Symbol 13 as "Resources_ClockWav"
EnableDebugger2 (64)Timeline Frame 131 bytes "u.$1$3x$K6up4nSikOdy4ckSIl/uO.."
DebugMX1 (63)Timeline Frame 1
SerialNumber (41)Timeline Frame 1

Labels

"Preloader"Frame 1
"start"Frame 2




http://swfchan.com/48/235052/info.shtml
Created: 16/5 -2020 02:46:36 Last modified: 16/5 -2020 02:46:36 Server time: 09/05 -2024 23:40:41