Section 1
//Ball (com.bri.mousecontrolled.Ball)
package com.bri.mousecontrolled {
import flash.display.*;
public dynamic class Ball extends MovieClip {
}
}//package com.bri.mousecontrolled
Section 2
//KeyObject (com.bri.wizardstick.utils.KeyObject)
package com.bri.wizardstick.utils {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.ui.*;
public dynamic class KeyObject extends Proxy {
private static var keysDown:Object;
private static var stage:Stage;
public function KeyObject(_arg1:Stage){
construct(_arg1);
}
private function keyPressed(_arg1:KeyboardEvent):void{
keysDown[_arg1.keyCode] = true;
}
public function construct(_arg1:Stage):void{
KeyObject.stage = _arg1;
keysDown = new Object();
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
_arg1.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
return (((_arg1 in Keyboard)) ? Keyboard[_arg1] : -1);
}
public function isDown(_arg1:uint):Boolean{
return (Boolean((_arg1 in keysDown)));
}
private function keyReleased(_arg1:KeyboardEvent):void{
delete keysDown[_arg1.keyCode];
}
public function deconstruct():void{
stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.removeEventListener(KeyboardEvent.KEY_UP, keyReleased);
keysDown = new Object();
KeyObject.stage = null;
}
}
}//package com.bri.wizardstick.utils
Section 3
//Engine (com.bri.wizardstick.Engine)
package com.bri.wizardstick {
import flash.display.*;
public class Engine extends MovieClip {
public function Engine():void{
var _local1:Ground;
var _local2:int;
var _local3:int;
var _local4:Hero;
var _local5:FractalTree;
var _local6:FractalBush;
super();
stage.quality = StageQuality.LOW;
_local1 = new Ground(stage);
addChild(_local1);
_local2 = 0;
while (_local2 < 5) {
_local5 = new FractalTree();
_local5.y = (Math.floor((Math.random() * 10)) + 150);
_local5.x = ((_local2 * Math.floor((Math.random() * 480))) + 10);
addChild(_local5);
_local2++;
};
_local3 = 0;
while (_local3 < 10) {
_local6 = new FractalBush();
_local6.y = (Math.floor((Math.random() * 10)) + 150);
_local6.x = ((_local2 * Math.floor((Math.random() * 480))) + 10);
addChild(_local6);
_local3++;
};
_local4 = new Hero(stage);
addChild(_local4);
_local4.x = 200;
_local4.y = 170;
}
}
}//package com.bri.wizardstick
Section 4
//FractalBush (com.bri.wizardstick.FractalBush)
package com.bri.wizardstick {
import flash.display.*;
public class FractalBush extends Sprite {
private var max_size:Number;
private var branch_length:Number;
private var max_sub_branch:Number;
private var trunkColors:Array;
private var leafColors:Array;
private var max_sub_angle:Number;
public function FractalBush(_arg1:Number=8, _arg2:Number=9, _arg3:Number=6, _arg4:Number=7.85398163397448):void{
trunkColors = new Array();
leafColors = new Array();
super();
trunkColors = [0, 0, 0x666600];
leafColors = [0x336600, 7111242, 0, 0];
max_sub_branch = _arg1;
max_sub_angle = _arg2;
max_size = _arg3;
branch_length = _arg4;
makeBranch(0, 0, branch_length, (-(Math.PI) / 2), max_size);
}
private function makeBranch(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:int;
var _local11:Number;
var _local12:Number;
var _local13:Number;
if (_arg5 > 0){
if (_arg5 <= 6){
this.graphics.lineStyle(_arg5, leafColors[Math.round((Math.random() * (leafColors.length - 1)))]);
} else {
this.graphics.lineStyle(_arg5, trunkColors[Math.round((Math.random() * (trunkColors.length - 1)))]);
};
this.graphics.moveTo(_arg1, _arg2);
_local6 = (_arg1 + (_arg3 * Math.cos(_arg4)));
_local7 = (_arg2 + (_arg3 * Math.sin(_arg4)));
this.graphics.lineTo(_local6, _local7);
_local8 = ((Math.random() * (max_sub_branch - 1)) + 2);
_local9 = (0.5 + (Math.random() / 4));
_local10 = 0;
while (_local10 < _local8) {
_local11 = (_arg3 * _local9);
_local12 = ((_arg4 + (Math.random() * max_sub_angle)) - (max_sub_angle / 2));
_local13 = (_arg5 - 2);
makeBranch(_local6, _local7, _local11, _local12, _local13);
_local10++;
};
};
}
}
}//package com.bri.wizardstick
Section 5
//FractalTree (com.bri.wizardstick.FractalTree)
package com.bri.wizardstick {
import flash.display.*;
public class FractalTree extends Sprite {
private var max_size:Number;
private var branch_length:Number;
private var max_sub_branch:Number;
private var trunkColors:Array;
private var leafColors:Array;
private var coolHeight:Number;
private var coolSize:Number;
private var max_sub_angle:Number;
public function FractalTree(_arg1:Number=8, _arg2:Number=3.14159265358979):void{
trunkColors = new Array();
leafColors = new Array();
coolHeight = (Math.floor((Math.random() * 81)) + 10);
coolSize = (Math.floor((Math.random() * 5)) + 4);
super();
trunkColors = [0x333333, 2493697, 0x3300];
leafColors = [0, 0x3300, 0x333333, 0x6600];
max_sub_branch = _arg1;
max_sub_angle = _arg2;
branch_length = (coolHeight + (Math.PI / 2));
makeBranch(0, 0, branch_length, (-(Math.PI) / 2), coolSize);
}
private function makeBranch(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:int;
var _local11:Number;
var _local12:Number;
var _local13:Number;
if (_arg5 > 0){
if (_arg5 <= 3){
this.graphics.lineStyle(_arg5, leafColors[Math.round((Math.random() * (leafColors.length - 1)))]);
this.graphics.moveTo(_arg1, _arg2);
} else {
this.graphics.lineStyle(_arg5, trunkColors[Math.round((Math.random() * (trunkColors.length - 1)))]);
this.graphics.curveTo(_arg1, _arg2, (_arg1 + (Math.floor((Math.random() * 21)) - 10)), (_arg2 - (Math.floor((Math.random() * 11)) + 10)));
};
_local6 = (_arg1 + (_arg3 * Math.cos(_arg4)));
_local7 = (_arg2 + (_arg3 * Math.sin(_arg4)));
this.graphics.lineTo(_local6, _local7);
_local8 = ((Math.random() * (max_sub_branch - 1)) + 2);
_local9 = (0.314 + (Math.random() / 3.14));
_local10 = 0;
while (_local10 < _local8) {
_local11 = (_arg3 * _local9);
_local12 = ((_arg4 + (Math.random() * max_sub_angle)) - (max_sub_angle / 2));
_local13 = (_arg5 - 2);
makeBranch(_local6, _local7, _local11, _local12, _local13);
_local10++;
};
};
}
}
}//package com.bri.wizardstick
Section 6
//Ground (com.bri.wizardstick.Ground)
package com.bri.wizardstick {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class Ground extends MovieClip {
var stageRef:Stage;
public function Ground(_arg1:Stage):void{
x = (_arg1.stageWidth / 2);
y = (_arg1.stageHeight / 2);
this.stageRef = _arg1;
addEventListener(Event.ENTER_FRAME, loop, false, 0, true);
}
private function loop(_arg1:Event):void{
var _local2:String;
var _local3:Array;
var _local4:Array;
var _local5:Array;
var _local6:Matrix;
var _local7:String;
var _local8:Sprite;
var _local9:Graphics;
_local2 = GradientType.LINEAR;
_local3 = [1316116, 0x3300];
_local4 = [1, 1];
_local5 = [0, 0xFF];
_local6 = new Matrix();
_local6.createGradientBox(500, 150, 90, 0, 0);
_local7 = SpreadMethod.PAD;
_local8 = new Sprite();
_local9 = _local8.graphics;
_local9.beginGradientFill(_local2, _local3, _local4, _local5, _local6, _local7);
_local9.drawRect(-250, 0, 500, 150);
addChild(_local8);
}
}
}//package com.bri.wizardstick
Section 7
//Hero (com.bri.wizardstick.Hero)
package com.bri.wizardstick {
import flash.display.*;
import flash.events.*;
import com.bri.wizardstick.utils.*;
import flash.ui.*;
public class Hero extends MovieClip {
var gravityConstant:Number;// = 3
var speed:Number;// = 5
var key:KeyObject;
var stageRef:Stage;
var jumpConstant:Number;// = -35
public function Hero(_arg1:Stage):void{
speed = 5;
jumpConstant = -35;
gravityConstant = 3;
super();
addFrameScript(0, frame1, 2, frame3);
x = (_arg1.stageWidth / 2);
y = (_arg1.stageHeight / 2);
key = new KeyObject(_arg1);
this.stageRef = _arg1;
addEventListener(Event.ENTER_FRAME, loop, false, 0, true);
}
function frame1(){
stop();
}
function frame3(){
stop();
}
private function loop(_arg1:Event):void{
x = (x - ((x - stageRef.mouseX) / speed));
if (x > stageRef.mouseX){
scaleX = 1;
} else {
scaleX = -1;
};
if (x < (stageRef.mouseX - 2)){
if (this.currentLabel != "walk"){
this.gotoAndPlay("walk");
};
} else {
if (x > (stageRef.mouseX + 2)){
if (this.currentLabel != "walk"){
this.gotoAndPlay("walk");
};
} else {
if (this.currentLabel != "stand"){
this.gotoAndPlay("stand");
};
};
};
if (y > 169){
if (key.isDown(Keyboard.SPACE)){
};
} else {
y = (y + gravityConstant);
};
if (y > 170){
y = 170;
};
}
}
}//package com.bri.wizardstick
Section 8
//Ship (com.bri.wizardstick.Ship)
package com.bri.wizardstick {
import flash.display.*;
import flash.events.*;
import com.bri.wizardstick.utils.*;
import flash.utils.*;
import flash.ui.*;
public class Ship extends MovieClip {
private var friction:Number;// = 0.0098
private var power;// = 0.3
private var canFire:Boolean;// = true
private var gravity:Number;// = 1
private var key:KeyObject;
private var maxspeed:Number;// = 0.1
private var speed:Number;// = 0.02
private var yspeed;// = 0
private var friction2;// = 0.95
private var fireTimer:Timer;
private var stageRef:Stage;
private var canWalk:Boolean;// = true
public var vx:Number;// = 0
public var vy:Number;// = 0
private var xspeed;// = 0
public function Ship(_arg1:Stage):void{
gravity = 1;
speed = 0.02;
vx = 0;
vy = 0;
friction = 0.0098;
maxspeed = 0.1;
power = 0.3;
yspeed = 0;
xspeed = 0;
friction2 = 0.95;
canFire = true;
canWalk = true;
super();
addEventListener(Event.ACTIVATE, onActivate);
addEventListener(Event.DEACTIVATE, onDeactivate);
this.stageRef = _arg1;
key = new KeyObject(_arg1);
fireTimer = new Timer(600, 1);
fireTimer.addEventListener(TimerEvent.TIMER, fireTimerHandler, false, 0, true);
addEventListener(Event.ENTER_FRAME, loop, false, 0, true);
}
public function takeHit2():void{
vx = (vx * -1);
vy = (vy * -1);
}
public function loop(_arg1:Event):void{
if (canWalk){
if (key.isDown(Keyboard.LEFT)){
if (this.currentLabel != "walk"){
this.gotoAndPlay("walk");
};
scaleX = 1;
} else {
if (key.isDown(Keyboard.RIGHT)){
if (this.currentLabel != "walk"){
this.gotoAndPlay("walk");
};
scaleX = -1;
} else {
if (key.isDown(Keyboard.UP)){
if (this.currentLabel != "up"){
this.gotoAndPlay("up");
};
} else {
if (key.isDown(Keyboard.DOWN)){
if (this.currentLabel != "down"){
this.gotoAndPlay("down");
};
} else {
if (this.currentLabel != "stand"){
this.gotoAndPlay("stand");
};
};
};
};
};
};
if (key.isDown(Keyboard.SPACE)){
vx = 0;
vy = 0;
};
x = (x + vx);
y = (y + vy);
if (vx > maxspeed){
vx = maxspeed;
} else {
if (vx < -(maxspeed)){
vx = -(maxspeed);
};
};
if (vy > maxspeed){
vy = maxspeed;
} else {
if (vy < -(maxspeed)){
vy = -(maxspeed);
};
};
if (x > (stageRef.stageWidth - 18)){
x = (stageRef.stageWidth - 18);
vx = -(vx);
scaleX = (scaleX * -1);
} else {
if (x < 18){
x = 18;
vx = -(vx);
scaleX = (scaleX * -1);
};
};
if (y > (stageRef.stageHeight - 26)){
y = (stageRef.stageHeight - 26);
vy = -(vy);
} else {
if (y < 10){
y = 10;
vy = -(vy);
};
};
}
private function onDeactivate(_arg1:Event):void{
speed = 0;
vx = 0;
vy = 0;
friction = 0;
maxspeed = 0;
}
private function fireTimerHandler(_arg1:TimerEvent):void{
canFire = true;
canWalk = true;
}
public function takeHit():void{
if (this.currentLabel != "destroyed"){
this.gotoAndPlay("destroyed");
};
vx = (vx * -1);
vy = (vy * -1);
}
private function onActivate(_arg1:Event):void{
speed = 2;
vx = 0;
vy = 0;
friction = 0.98;
maxspeed = 13;
}
}
}//package com.bri.wizardstick