Section 1
//MainTimeline (bunnyboom_fla.MainTimeline)
package bunnyboom_fla {
import flash.events.*;
import flash.text.*;
import flash.display.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var txt_level:TextField;
public var xseb:Number;
public var life:Number;
public var points:Number;
public var loader:Loader;
public var myFont:Font;
public var stoneLevel:Boolean;
public var paramObj:Object;
public var carrots:TextField;
public var gameisover:Boolean;
public var carrot:Carrot;
public var level:Number;
public var keyloop:Number;
public var txt_points:TextField;
public var deflevel:Number;
public var request:URLRequest;
public var starter:Starter;
public var carrots_tf:TextFormat;
public var api_url:String;
public var keycode:Array;
public var kongregate;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
public function GameOver(){
stoneLevel = true;
gameisover = true;
gotoAndStop(3);
kongSubmit(points, level);
}
public function loadComplete(_arg1:Event):void{
kongregate = _arg1.target.content;
kongregate.services.connect();
trace(("\n" + kongregate.services));
trace(("\n" + kongregate.user));
trace(("\n" + kongregate.scores));
trace(("\n" + kongregate.stats));
}
public function keypress(_arg1:KeyboardEvent){
if (_arg1.keyCode == 32){
gotoAndStop(2);
};
}
public function levelup(_arg1:Event){
var levelUp:Levelup;
var levelUpFinish:Function;
var event = _arg1;
if (deflevel != level){
levelUpFinish = function (_arg1:Event=null){
if (levelUp.currentFrame == 15){
levelUp.removeEventListener(Event.ENTER_FRAME, levelUpFinish);
removeChild(levelUp);
};
};
levelUp = new Levelup();
levelUp.x = (txt_level.x - (levelUp.width / 2));
levelUp.y = (txt_level.y - (levelUp.height / 2));
addChild(levelUp);
levelUp.addEventListener(Event.ENTER_FRAME, levelUpFinish);
deflevel = level;
};
}
public function levelUp(_arg1:Event){
if (stoneLevel == false){
if (0 < points){
level = 1;
xseb = 3;
};
if (10 < points){
level = 2;
xseb = 3.5;
};
if (25 < points){
level = 3;
xseb = 4;
};
if (150 < points){
level = 4;
xseb = 4.5;
};
if (800 < points){
level = 5;
xseb = 5;
};
if (2000 < points){
level = 6;
xseb = 6;
};
if (3500 < points){
level = 7;
xseb = 7;
};
if (5000 < points){
level = 8;
xseb = 8;
};
if (7500 < points){
level = 9;
xseb = 8.5;
};
if (10000 < points){
level = 10;
xseb = 9;
};
if (50000 < points){
level = 11;
xseb = 10;
};
if (100000 < points){
level = 12;
xseb = 12;
};
if (200000 < points){
level = 12;
xseb = 15;
};
};
}
function frame3(){
stop();
}
function frame1(){
stop();
stage.addEventListener(KeyboardEvent.KEY_DOWN, keypress);
}
function frame2(){
stop();
paramObj = LoaderInfo(root.loaderInfo).parameters;
api_url = ((paramObj.api_path) || ("http://www.kongregate.com/flash/API_AS3_Local.swf"));
trace(("API path: " + api_url));
request = new URLRequest(api_url);
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader.load(request);
this.addChild(loader);
BunnyMaker();
starter = new Starter();
starter.alpha = 0;
starter.x = 0;
starter.y = 305;
carrot = new Carrot();
carrot.x = 524;
carrot.y = 273;
addChild(carrot);
gameisover = false;
keyloop = 0;
keycode = new Array();
xseb = 3;
life = 3;
stoneLevel = false;
carrots = new TextField();
txt_points = new TextField();
txt_points.x = 375;
txt_points.y = -1.5;
points = 0;
myFont = new Pixelate();
carrots_tf = new TextFormat();
carrots_tf.font = myFont.fontName;
carrots_tf.size = 15;
carrots_tf.color = 12074764;
carrots.x = 508.6;
carrots.y = 25;
txt_level = new TextField();
txt_level.x = 316.5;
txt_level.y = 130.1;
level = 1;
deflevel = 1;
stage.addEventListener(Event.ENTER_FRAME, Texts);
txt_level.selectable = false;
carrots.selectable = false;
txt_points.selectable = false;
carrots.setTextFormat(carrots_tf);
addChild(carrots);
addChild(txt_points);
addChild(txt_level);
stage.addEventListener(Event.ENTER_FRAME, gameOver);
stage.addEventListener(Event.ENTER_FRAME, levelup);
stage.addEventListener(Event.ENTER_FRAME, levelUp);
}
public function kongSubmit(_arg1:int, _arg2:int):void{
kongregate.stats.submit("Scores", _arg1);
kongregate.stats.submit("Level", _arg2);
}
public function BunnyMaker(){
var keynum:Number;
var bunny:Bunny;
var char:TextField;
var hit:Boolean;
var carrotHit:Boolean;
var added:Boolean;
var charAdded:Boolean;
var charStop:Boolean;
var bunnyDead:Boolean;
var isgameover:Function;
var moveBunny:Function;
var bunnyMaking:Function;
var charMaking:Function;
var keyPressed:Function;
var charDie:Function;
var hitCarrot:Function;
var bunnyDie:Function;
var randomChar:Function;
if (gameisover == false){
isgameover = function (_arg1:Event){
if (gameisover){
if (bunnyDead == false){
bunnyDie();
points = (points - level);
charDie();
bunny.removeEventListener(Event.ENTER_FRAME, isgameover);
};
};
};
moveBunny = function (_arg1:Event){
bunny.x = (bunny.x + xseb);
};
bunnyMaking = function (_arg1:Event){
if (bunny.hitTestObject(starter)){
if (hit == false){
BunnyMaker();
hit = true;
};
};
};
charMaking = function (_arg1:Event){
var tformat:TextFormat;
var moveChar:Function;
var e = _arg1;
if (charAdded == false){
moveChar = function (_arg1:Event){
if (added == false){
addChild(char);
added = true;
};
if (charStop == false){
char.x = (bunny.x - 30);
char.y = (bunny.y - (bunny.height * 2));
};
};
char.text = randomChar();
char.selectable = false;
tformat = new TextFormat();
tformat.font = myFont.fontName;
tformat.size = 26;
tformat.color = 0x6600;
char.setTextFormat(tformat);
bunny.addEventListener(Event.ENTER_FRAME, moveChar);
charAdded = true;
};
};
keyPressed = function (_arg1:KeyboardEvent=null){
if (_arg1.keyCode == keycode[keynum]){
if (bunnyDead == false){
bunnyDie();
charDie();
stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
};
};
};
charDie = function (){
charStop = true;
removeChild(char);
};
hitCarrot = function (_arg1:Event=null){
if (bunny.hitTestObject(carrot)){
if (bunnyDead == false){
if (carrotHit == false){
bunnyDie();
charDie();
life--;
carrotHit = true;
bunnyDead = true;
bunny.removeEventListener(Event.ENTER_FRAME, hitCarrot);
};
};
};
};
bunnyDie = function (){
var boom:Boom;
var boomFinish:Function;
boomFinish = function (_arg1:Event=null){
if (boom.currentFrame == 14){
boom.removeEventListener(Event.ENTER_FRAME, boomFinish);
removeChild(boom);
};
};
bunnyDead = true;
points = (points + level);
bunny.alpha = 0;
boom = new Boom();
boom.x = (bunny.x - bunny.width);
boom.y = 290;
addChild(boom);
removeChild(bunny);
boom.addEventListener(Event.ENTER_FRAME, boomFinish);
};
randomChar = function (){
var _local1:Array;
var _local2:Array;
var _local3:Number;
var _local4:String;
_local1 = new Array("Q", "W", "E", "R", "T", "Z", "U", "I", "O", "P", "A", "S", "D", "F", "G", "H", "J", "K", "L", "Y", "X", "C", "V", "B", "N", "M");
_local2 = new Array(81, 87, 69, 82, 84, 90, 85, 73, 79, 80, 65, 83, 68, 70, 71, 72, 74, 75, 76, 89, 88, 67, 86, 66, 78, 77);
_local3 = Math.floor((Math.random() * 26));
keycode[keyloop] = _local2[_local3];
keynum = keyloop;
keyloop++;
_local4 = _local1[_local3];
return (_local4);
};
keynum = new Number();
bunny = new Bunny();
char = new TextField();
hit = false;
carrotHit = false;
added = false;
charAdded = false;
charStop = false;
bunnyDead = false;
bunny.x = (-1 * bunny.width);
bunny.y = 305;
addChild(bunny);
bunny.addEventListener(Event.ENTER_FRAME, isgameover);
bunny.addEventListener(Event.ENTER_FRAME, moveBunny);
bunny.addEventListener(Event.ENTER_FRAME, bunnyMaking);
bunny.addEventListener(Event.ENTER_FRAME, charMaking);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
bunny.addEventListener(Event.ENTER_FRAME, hitCarrot);
};
}
public function Texts(_arg1:Event){
txt_level.text = level.toString();
txt_level.setTextFormat(carrots_tf);
txt_points.text = points.toString();
txt_points.setTextFormat(carrots_tf);
carrots.text = life.toString();
carrots.setTextFormat(carrots_tf);
}
public function gameOver(_arg1:Event){
if (life == 0){
GameOver();
stage.removeEventListener(Event.ENTER_FRAME, gameOver);
};
}
}
}//package bunnyboom_fla
Section 2
//Boom (Boom)
package {
import flash.display.*;
public dynamic class Boom extends MovieClip {
}
}//package
Section 3
//Bunny (Bunny)
package {
import flash.display.*;
public dynamic class Bunny extends MovieClip {
}
}//package
Section 4
//Carrot (Carrot)
package {
import flash.display.*;
public dynamic class Carrot extends MovieClip {
}
}//package
Section 5
//Levelup (Levelup)
package {
import flash.display.*;
public dynamic class Levelup extends MovieClip {
}
}//package
Section 6
//Pixelate (Pixelate)
package {
import flash.text.*;
public dynamic class Pixelate extends Font {
}
}//package
Section 7
//Starter (Starter)
package {
import flash.display.*;
public dynamic class Starter extends MovieClip {
}
}//package