Game Release: Bradley Braves the Air
Categories: Animation, Coding, There

Shiny Pixel Studios has released Bradley Braves the Air! I developed this game in Flash with ActionScript. Other members of the team contributed with artwork, sound, and the game website.

Bradley Braves the Air: GUI

60+ Variables

60+ variables of all kinds laid the groundwork for Bradley Braves the Air. Below is an example of variables and function triggered by an timer event to create green clouds.

// --------------- CLOUDS ----------------
var cloudSize;
var cloudHeight;
var cloudWidth;
function makeGreenClouds(evt:TimerEvent):void {
     // The equasion excecuted by these variables produces a slight
     difference in the size of each green cloud.
     cloudSize = (10/randomNumber(8, 10));
     cloudHeight = 70 * cloudSize;
     cloudWidth = 125 * cloudSize;
     var cloud:GreenCloud = new GreenCloud(stage, bradley, cloudWidth, cloudHeight);
     stage.addChild(cloud);
}
//---------------------------------------

Classes

Classes allowed me to set specific behaviors and properties to particular game elements.

Eight classes were developed for Bradley Brave the Air: a class for the bear, boosters, white and green clouds, planes, billboards, background, and a global variable container class that allowed variables to be passed among these classes and the main code.

// ------------- BILLBOARDS --------------
package  {

	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.display.Stage;
	import GlobalVarContainer;

	public class Billboard extends MovieClip {

		private var stageRef:Stage;
		private var percent;

		public function Billboard(stageRef:Stage) {
			// constructor code
			this.stageRef = stageRef;
			// By fixing the position of the Billboard class, I assure
                        that each instance of the Billboard class will appear in the
                        same location. These values become a common property
                        of each instance.
			this.x = 650;
			this.y = 415;
			// By importing the GlobalVarContainer class above, I have
                        access to any variables stored in the class. Here I use it to
                        advance the percentage amount on each Billboard for the
                        duration of the game.
			percent = GlobalVarContainer.vars.percent;
			this.gotoAndStop(percent);
			this.addEventListener(Event.ENTER_FRAME, loop, false, 0, true);
		}

		private function loop(e:Event) {
			// An enter_frame loop in a class aids in animation. This line of
                        code forces each instance to slowly move across the stage giving
                        the appearance that the bear is moving through the environement.
			this.x -= 2;
			if (this.x < -10) {
				removeSelf();
			}
			if (percent == 10) {
				GlobalVarContainer.vars.game = "off";
				removeSelf();
			}
		}

		private function removeSelf():void {
			this.removeEventListener(Event.ENTER_FRAME, loop);
			if (stageRef.contains(this)) {
				stageRef.removeChild(this);
			}
		}
	}
}
//---------------------------------------
Click here to visit the game’s page.

Click here to learn more about the team.

Leave a Reply