/****************************
Program: SWITCH
Author: Tiina Vuorenmaa
Date: 06/11/2009
Class: FS297 - Portfolio I
****************************/
// UPDATES
// 11/06/2010: Changing code to an external class
package
{
// IMPORTS
//main imports
import flash.display.MovieClip;
import flash.display.Loader;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.events.ProgressEvent;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundTransform;
import flash.net.SharedObject;
import flash.net.URLRequest;
import flash.net.navigateToURL;
import flash.ui.Keyboard;
import flash.ui.Mouse;
import flash.utils.Timer;
import flash.media.SoundMixer;
import flash.geom.ColorTransform;
//import tween class
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.*;
//if I have time to get tweener to replace tweens??
// Tweener is a non-native class and must be imported
//import caurina.transitions.Tweener;
//curve modifiers for the tweening of the fireballs
//import caurina.transitions.properties.CurveModifiers;
public class Main extends MovieClip
{
/**** VARIABLES ****/
//center x variable
private var xCenter:Number = 455;
private var pongDone:Boolean = false;
private var exploreDone:Boolean = false;
private var flowDone:Boolean = false;
private var feastDone:Boolean = false;
//what world are we on?
private var worldEarth:Boolean = false;
private var worldAlien:Boolean = false;
private var worldMedi:Boolean = false;
//variable for what page we're on
// introPage, avatarPage, worldPage, portalPage, pongPage, feastPage, flowPage, explorePage, licensePage, finalPage
private var currentPage:String = "introPage";
//what avatar is selected
private var currentChar:String = "None";
//on avatar selection screen: what avatar is upfront?
private var humanUpFront:Boolean = false;
private var fictionalUpFront:Boolean = false;
private var thingUpFront:Boolean = false;
//on avatar selection screen: what character is up front?
private var michaelUpFront:Boolean = false;
private var jeffUpFront:Boolean = false;
private var rachelUpFront:Boolean = false;
private var moniqueUpFront:Boolean = false;
private var takashiUpFront:Boolean = false;
private var masterChiefUpFront:Boolean = false;
private var gollumUpFront:Boolean = false;
private var martianUpFront:Boolean = false;
private var claireUpFront:Boolean = false;
private var laraUpFront:Boolean = false;
private var duckieUpFront:Boolean = false;
private var coneUpFront:Boolean = false;
private var carUpFront:Boolean = false;
private var cubeUpFront:Boolean = false;
private var stilettoUpFront:Boolean = false;
//on world selection screen: what world is upfront?
private var earthUpFront:Boolean = false;
private var alienUpFront:Boolean = false;
private var mediUpFront:Boolean = false;
//when about to play a game, what infobar page are we on?
private var onSecondText:Boolean = false;
/*** TASK VARIABLES ***/
//pong variables
private var xPongBallMovement:Number = new Number();
private var yPongBallMovement:Number = new Number();
private var key:Number = new Number();
private var paddleSpeed:Number = 15;
private var pongScore:int = 0;
//flow variables
private var flowScore:int = 0;
private var flowTimer:Timer = new Timer(1000,30);
private var outOfTime:Boolean = false;
private var gameStarted:Boolean = false;
private var followMouseDistY:Number = new Number();
private var followMouseDistX:Number = new Number();
private var flowObjectMCArray:Array = new Array();
//feast variables
private var feastScore:int = 100;
//explore variables
private var exploreScore:int = 0;
private var exploreTimer:Timer = new Timer(1000,30);
private var outOfTimeExplore:Boolean = false;
private var gameStartedExplore:Boolean = false;
private var exploreObjectMCArray:Array = new Array();
private var exploreObjectXArray:Array = new Array();
private var exploreObjectYArray:Array = new Array();
//text messages
//when selecting an avatar
private var humanAvatarText:String;
private var humanAvatarQuestion:String;
private var fictionalAvatarText:String;
private var fictionalAvatarQuestion:String;
private var thingAvatarText:String;
private var thingAvatarQuestion:String;
//character information
private var michaelInfo:String;
private var rachelInfo:String;
private var jeffInfo:String;
private var takashiInfo:String;
private var moniqueInfo:String;
private var duckieInfo:String;
private var carInfo:String;
private var coneInfo:String;
private var cubeInfo:String;
private var stilettoInfo:String;
private var mChiefInfo:String;
private var gollumInfo:String;
private var martianInfo:String;
private var claireInfo:String;
private var laraInfo:String;
//when selecting a world
private var earthWorldText:String;
private var earthWorldQuestion:String;
private var mediWorldText:String;
private var mediWorldQuestion:String;
private var alienWorldText:String;
private var alienWorldQuestion:String;
//when changing the bkgimage
private var bkgImageLoader:Loader;
private var bkgImageURL:String;
private var bkgColorTransform:ColorTransform;
private var bkgImageTint:uint;
//intro text for the tasks
private var pongIntroText1:String;
private var pongIntroText2:String;
//private var pongInstructions:String ="Use the Keyboard to move the paddles. R (up) and F (down) for the left paddle and U (up) and J (down) for the right paddle.";
private var exploreIntroText1:String;
private var exploreIntroText2:String;
private var exploreInstructions:String;
private var flowIntroText1:String;
private var flowIntroText2:String;
private var flowInstructions:String;
private var licenseIntroText1:String;
private var licenseIntroText2:String;
private var noLicenseYetText:String;
private var feastIntroText1:String;
private var feastIntroText2:String;
private var feastInstructions:String;
private var finalIntroText1:String;
private var finalIntroText2:String;
private var finalInstructions:String;
//location variables for utilities
private var utilWorldBtnYOff:Number = 0;
private var utilWorldBtnY1:Number = 153.6;
private var utilWorldBtnY2:Number = 223.3;
//util character boxes
private var utilCharX:Number = 848.5;
private var utilCharYOff:Number = -300;
private var utilCharYOn:Number = 15.1;
private var utilWorldX:Number = 760.6;
private var utilWorldYOff:Number = -300;
private var utilWorldYOn:Number = 15.1;
//location variables for utilities
private var utilTaskBtnYOff:Number = 0;
private var utilTaskBtnY1:Number = 127.5;
private var utilTaskBtnY2:Number = 155.4;
private var utilTaskBtnY3:Number = 183.4;
private var utilTaskBtnY4:Number = 211.4;
private var utilTaskBtnY5:Number = 239.3;
//location variables for utilities
private var utilHumanBtnYOff:Number = 0;
private var utilHumanBtnY1:Number = 180.3;
private var utilHumanBtnY2:Number = 246.8;
private var utilHumanBtnY3:Number = 313.9;
private var utilHumanBtnY4:Number = 380.9;
private var utilHumanBtnY5:Number = 448;
//location variables for utilities
private var utilFictionalBtnYOff:Number = 0;
private var utilFictionalBtnY1:Number = 206.7;
private var utilFictionalBtnY2:Number = 274.1;
private var utilFictionalBtnY3:Number = 341.4;
private var utilFictionalBtnY4:Number = 408.6;
private var utilFictionalBtnY5:Number = 475.7;
//location variables for utilities
private var utilThingBtnYOff:Number = 0;
private var utilThingBtnY1:Number = 234.7;
private var utilThingBtnY2:Number = 301.8;
private var utilThingBtnY3:Number = 368.9;
private var utilThingBtnY4:Number = 436.0;
private var utilThingBtnY5:Number = 503.1;
//location variables for utilities
private var utilHumanBtnY:Number = 11.1;
private var utilFictionalBtnYUp:Number = 38.3;
private var utilThingBtnYUp:Number = 65.5;
private var utilFictionalBtnYDown:Number = 308.9;
private var utilThingBtnYDown:Number = 336.1;
private var utilFictionalBtnYDown2:Number = 376;
private var utilThingBtnYDown2:Number = 403.2;
//tweens
//moving the info bar for each task
private var moveUpInfoBar:Tween;
private var moveDownInfoBar:Tween;
//moving the drop down menus
private var dropDownUtilTask:Tween;
private var moveUpUtilTask:Tween;
private var dropDownUtilWorld:Tween;
private var moveUpUtilWorld:Tween;
private var dropDownUtilChar:Tween;
private var moveUpUtilChar:Tween;
private var dropDownUtilHuman:Tween;
private var moveUpUtilHuman:Tween;
private var dropDownUtilFictional:Tween;
private var moveUpUtilFictional:Tween;
private var dropDownUtilThing:Tween;
private var moveUpUtilThing:Tween;
//drop down fictional and thing buttons when the above buttons are clicked
private var dropDownUtilFictionalBtn:Tween;
private var dropDownUtilThingBtn:Tween;
private var dropDownUtilFictionalBtn2:Tween;
private var dropDownUtilThingBtn2:Tween;
//moving the avatars around
//human
private var humanAvatarCenter2Left:Tween;
private var humanAvatarCenter2Right:Tween;
private var humanAvatarLeft2Center:Tween;
private var humanAvatarRight2Center:Tween;
private var humanAvatarRight2Left:Tween;
private var humanAvatarLeft2Right:Tween;
private var humanAvatarBack:Tween;
private var humanAvatarForward:Tween;
//fictional
private var fictionalAvatarCenter2Left:Tween;
private var fictionalAvatarCenter2Right:Tween;
private var fictionalAvatarLeft2Center:Tween;
private var fictionalAvatarRight2Center:Tween;
private var fictionalAvatarRight2Left:Tween;
private var fictionalAvatarLeft2Right:Tween;
private var fictionalAvatarBack:Tween;
private var fictionalAvatarForward:Tween;
//thing
private var thingAvatarCenter2Left:Tween;
private var thingAvatarCenter2Right:Tween;
private var thingAvatarLeft2Center:Tween;
private var thingAvatarRight2Center:Tween;
private var thingAvatarRight2Left:Tween;
private var thingAvatarLeft2Right:Tween;
private var thingAvatarBack:Tween;
private var thingAvatarForward:Tween;
//shrinking and growing human avatar
private var humanAvatarShrinkWidth:Tween;
private var humanAvatarShrinkHeight:Tween;
private var humanAvatarGrowWidth:Tween;
private var humanAvatarGrowHeight:Tween;
//shrinking and growing fictional avatar
private var fictionalAvatarShrinkWidth:Tween;
private var fictionalAvatarShrinkHeight:Tween;
private var fictionalAvatarGrowWidth:Tween;
private var fictionalAvatarGrowHeight:Tween;
//shrinking and growing thing avatar
private var thingAvatarShrinkWidth:Tween;
private var thingAvatarShrinkHeight:Tween;
private var thingAvatarGrowWidth:Tween;
private var thingAvatarGrowHeight:Tween;
//turning the platforms on or off
//human
private var humanAvatarPlatformOff:Tween;
private var humanAvatarPlatformOn:Tween;
//fictional
private var fictionalAvatarPlatformOff:Tween;
private var fictionalAvatarPlatformOn:Tween;
//thing
private var thingAvatarPlatformOff:Tween;
private var thingAvatarPlatformOn:Tween;
//fade avatars in or out
//human
private var humanAvatarFadeOut:Tween;
private var humanAvatarFadeIn:Tween;
//fictional
private var fictionalAvatarFadeOut:Tween;
private var fictionalAvatarFadeIn:Tween;
//thing
private var thingAvatarFadeOut:Tween;
private var thingAvatarFadeIn:Tween;
//moving the worlds around
//earth
private var earthWorldCenter2Left:Tween;
private var earthWorldCenter2Right:Tween;
private var earthWorldLeft2Center:Tween;
private var earthWorldRight2Center:Tween;
private var earthWorldRight2Left:Tween;
private var earthWorldLeft2Right:Tween;
private var earthWorldBack:Tween;
private var earthWorldForward:Tween;
//medi
private var mediWorldCenter2Left:Tween;
private var mediWorldCenter2Right:Tween;
private var mediWorldLeft2Center:Tween;
private var mediWorldRight2Center:Tween;
private var mediWorldRight2Left:Tween;
private var mediWorldLeft2Right:Tween;
private var mediWorldBack:Tween;
private var mediWorldForward:Tween;
//alien
private var alienWorldCenter2Left:Tween;
private var alienWorldCenter2Right:Tween;
private var alienWorldLeft2Center:Tween;
private var alienWorldRight2Center:Tween;
private var alienWorldRight2Left:Tween;
private var alienWorldLeft2Right:Tween;
private var alienWorldBack:Tween;
private var alienWorldForward:Tween;
//shrinking and growing earth world
private var earthWorldShrinkWidth:Tween;
private var earthWorldShrinkHeight:Tween;
private var earthWorldGrowWidth:Tween;
private var earthWorldGrowHeight:Tween;
//shrinking and growing medi dungeon
private var mediWorldShrinkWidth:Tween;
private var mediWorldShrinkHeight:Tween;
private var mediWorldGrowWidth:Tween;
private var mediWorldGrowHeight:Tween;
//shrinking and growing alien planet
private var alienWorldShrinkWidth:Tween;
private var alienWorldShrinkHeight:Tween;
private var alienWorldGrowWidth:Tween;
private var alienWorldGrowHeight:Tween;
//turning the platforms on or off
//earth
private var earthWorldPlatformOff:Tween;
private var earthWorldPlatformOn:Tween;
//medi
private var mediWorldPlatformOff:Tween;
private var mediWorldPlatformOn:Tween;
//alien
private var alienWorldPlatformOff:Tween;
private var alienWorldPlatformOn:Tween;
//fade avatars in or out
//earth
private var earthWorldFadeOut:Tween;
private var earthWorldFadeIn:Tween;
//medi
private var mediWorldFadeOut:Tween;
private var mediWorldFadeIn:Tween;
//alien
private var alienWorldFadeOut:Tween;
private var alienWorldFadeIn:Tween;
private var moveUpBkgColor:Tween;
private var moveUpBkgImage:Tween;
////////// FUNCTIONS //////////
public function Main():void
{
setUpText();
setUpTweens();
setUpVariables();
//start the site going
goToAvatarPage();
}
function setUpTweens():void
{
//tweens arguments
// (object, the parameter, the type of tween, from where, to where, how long, true);
//moving the bkg color and image holder
moveUpBkgColor = new Tween(theBkgColor,"y",Strong.easeOut,685,0,1,true);
moveUpBkgColor.stop();
moveUpBkgImage = new Tween(bkgImageHolder,"y",Strong.easeOut,685,0,1,true);
moveUpBkgImage.stop();
//moving the info bar for each task
moveUpInfoBar = new Tween(taskInfoBar,"y",Strong.easeOut,725,601,1,true);
moveUpInfoBar.stop();
moveDownInfoBar = new Tween(taskInfoBar,"y",Strong.easeIn,601,725,1,true);
moveDownInfoBar.stop();
//moving the drop down menus
dropDownUtilTask = new Tween(utilTaskButtons,"y",Strong.easeOut,-300,-30.4,1,true);
dropDownUtilTask.stop();
moveUpUtilTask = new Tween(utilTaskButtons,"y",Strong.easeIn,-30.4,-300,1,true);
moveUpUtilTask.stop();
dropDownUtilWorld = new Tween(utilWorldButtons,"y",Strong.easeOut,-300,-67.8,1,true);
dropDownUtilWorld.stop();
moveUpUtilWorld = new Tween(utilWorldButtons,"y",Strong.easeIn,-67.8,-300,1,true);
moveUpUtilWorld.stop();
dropDownUtilChar = new Tween(utilCharButtons,"y",Strong.easeOut,-200,85.9,1,true);
dropDownUtilChar.stop();
moveUpUtilChar = new Tween(utilCharButtons,"y",Strong.easeIn,85.9,-200,1,true);
moveUpUtilChar.stop();
dropDownUtilHuman = new Tween(utilHumanButtons,"y",Strong.easeOut,-400,-67.8,.5,true);
dropDownUtilHuman.stop();
moveUpUtilHuman = new Tween(utilHumanButtons,"y",Strong.easeIn,-67.8,-400,.5,true);
moveUpUtilHuman.stop();
dropDownUtilFictional = new Tween(utilFictionalButtons,"y",Strong.easeOut,-400,-67.8,.5,true);
dropDownUtilFictional.stop();
moveUpUtilFictional = new Tween(utilFictionalButtons,"y",Strong.easeIn,-67.8,-400,.5,true);
moveUpUtilFictional.stop();
dropDownUtilThing = new Tween(utilThingButtons,"y",Strong.easeOut,-400,-67.8,.5,true);
dropDownUtilThing.stop();
moveUpUtilThing = new Tween(utilThingButtons,"y",Strong.easeIn,-67.8,-400,.5,true);
moveUpUtilThing.stop();
//drop down fictional and thing buttons when the above buttons are clicked
dropDownUtilFictionalBtn = new Tween(utilCharButtons.utilFictional,"y",Strong.easeOut,utilFictionalBtnYUp,utilFictionalBtnYDown,.5,true);
dropDownUtilFictionalBtn.stop();
dropDownUtilFictionalBtn2 = new Tween(utilCharButtons.utilFictional,"y",Strong.easeOut,utilFictionalBtnYUp,utilFictionalBtnYDown2,.5,true);
dropDownUtilFictionalBtn2.stop();
dropDownUtilThingBtn = new Tween(utilCharButtons.utilThing,"y",Strong.easeOut,utilThingBtnYUp,utilThingBtnYDown,.5,true);
dropDownUtilThingBtn.stop();
dropDownUtilThingBtn2 = new Tween(utilCharButtons.utilThing,"y",Strong.easeOut,utilThingBtnYUp,utilThingBtnYDown2,.5,true);
dropDownUtilThingBtn2.stop();
//moving the avatars around
//human
humanAvatarCenter2Left = new Tween(humanAvatar,"x",Strong.easeOut,282,152,1,true);
humanAvatarCenter2Left.stop();
humanAvatarCenter2Right = new Tween(humanAvatar,"x",Strong.easeOut,282,412,1,true);
humanAvatarCenter2Right.stop();
humanAvatarLeft2Center = new Tween(humanAvatar,"x",Strong.easeOut,152,282,1,true);
humanAvatarLeft2Center.stop();
humanAvatarRight2Center = new Tween(humanAvatar,"x",Strong.easeOut,412,282,1,true);
humanAvatarRight2Center.stop();
humanAvatarRight2Left = new Tween(humanAvatar,"x",Strong.easeOut,412,152,1,true);
humanAvatarRight2Left.stop();
humanAvatarLeft2Right = new Tween(humanAvatar,"x",Strong.easeOut,152,412,1,true);
humanAvatarLeft2Right.stop();
humanAvatarBack = new Tween(humanAvatar,"y",Strong.easeOut,597.3,497.3,1,true);
humanAvatarBack.stop();
humanAvatarForward = new Tween(humanAvatar,"y",Strong.easeOut,497.3,597.3,1,true);
humanAvatarForward.stop();
//fictional
fictionalAvatarCenter2Left = new Tween(fictionalAvatar,"x",Strong.easeOut,282,152,1,true);
fictionalAvatarCenter2Left.stop();
fictionalAvatarCenter2Right = new Tween(fictionalAvatar,"x",Strong.easeOut,282,412,1,true);
fictionalAvatarCenter2Right.stop();
fictionalAvatarLeft2Center = new Tween(fictionalAvatar,"x",Strong.easeOut,152,282,1,true);
fictionalAvatarLeft2Center.stop();
fictionalAvatarRight2Center = new Tween(fictionalAvatar,"x",Strong.easeOut,412,282,1,true);
fictionalAvatarRight2Center.stop();
fictionalAvatarRight2Left = new Tween(fictionalAvatar,"x",Strong.easeOut,412,152,1,true);
fictionalAvatarRight2Left.stop();
fictionalAvatarLeft2Right = new Tween(fictionalAvatar,"x",Strong.easeOut,152,412,1,true);
fictionalAvatarLeft2Right.stop();
fictionalAvatarBack = new Tween(fictionalAvatar,"y",Strong.easeOut,597.3,497.3,1,true);
fictionalAvatarBack.stop();
fictionalAvatarForward = new Tween(fictionalAvatar,"y",Strong.easeOut,497.3,597.3,1,true);
fictionalAvatarForward.stop();
//thing
thingAvatarCenter2Left = new Tween(thingAvatar,"x",Strong.easeOut,282,152,1,true);
thingAvatarCenter2Left.stop();
thingAvatarCenter2Right = new Tween(thingAvatar,"x",Strong.easeOut,282,412,1,true);
thingAvatarCenter2Right.stop();
thingAvatarLeft2Center = new Tween(thingAvatar,"x",Strong.easeOut,152,282,1,true);
thingAvatarLeft2Center.stop();
thingAvatarRight2Center = new Tween(thingAvatar,"x",Strong.easeOut,412,282,1,true);
thingAvatarRight2Center.stop();
thingAvatarRight2Left = new Tween(thingAvatar,"x",Strong.easeOut,412,152,1,true);
thingAvatarRight2Left.stop();
thingAvatarLeft2Right = new Tween(thingAvatar,"x",Strong.easeOut,152,412,1,true);
thingAvatarLeft2Right.stop();
thingAvatarBack = new Tween(thingAvatar,"y",Strong.easeOut,597.3,497.3,1,true);
thingAvatarBack.stop();
thingAvatarForward = new Tween(thingAvatar,"y",Strong.easeOut,497.3,597.3,1,true);
thingAvatarForward.stop();
//shrinking and growing human avatar
humanAvatarShrinkWidth = new Tween(humanAvatar,"width",Strong.easeOut,206,206 * .5,1,true);
humanAvatarShrinkWidth.stop();
humanAvatarShrinkHeight = new Tween(humanAvatar,"height",Strong.easeOut,425.3,425.3 * .5,1,true);
humanAvatarShrinkHeight.stop();
humanAvatarGrowWidth = new Tween(humanAvatar,"width",Strong.easeOut,206 * .5,206,1,true);
humanAvatarGrowWidth.stop();
humanAvatarGrowHeight = new Tween(humanAvatar,"height",Strong.easeOut,425.3 * .5,425.3,1,true);
humanAvatarGrowHeight.stop();
//shrinking and growing fictional avatar
fictionalAvatarShrinkWidth = new Tween(fictionalAvatar,"width",Strong.easeOut,280,280 * .5,1,true);
fictionalAvatarShrinkWidth.stop();
fictionalAvatarShrinkHeight = new Tween(fictionalAvatar,"height",Strong.easeOut,433,433 * .5,1,true);
fictionalAvatarShrinkHeight.stop();
fictionalAvatarGrowWidth = new Tween(fictionalAvatar,"width",Strong.easeOut,280 * .5,280,1,true);
fictionalAvatarGrowWidth.stop();
fictionalAvatarGrowHeight = new Tween(fictionalAvatar,"height",Strong.easeOut,433 * .5,433,1,true);
fictionalAvatarGrowHeight.stop();
//shrinking and growing thing avatar
thingAvatarShrinkWidth = new Tween(thingAvatar,"width",Strong.easeOut,285,285 * .5,1,true);
thingAvatarShrinkWidth.stop();
thingAvatarShrinkHeight = new Tween(thingAvatar,"height",Strong.easeOut,203.8,203.8 * .5,1,true);
thingAvatarShrinkHeight.stop();
thingAvatarGrowWidth = new Tween(thingAvatar,"width",Strong.easeOut,285 * .5,285,1,true);
thingAvatarGrowWidth.stop();
thingAvatarGrowHeight = new Tween(thingAvatar,"height",Strong.easeOut,203.8 * .5,203.8,1,true);
thingAvatarGrowHeight.stop();
//turning the platforms on or off
//human
humanAvatarPlatformOff = new Tween(humanAvatar.humanPlatformOn,"alpha",Strong.easeOut,1,0,1,true);
humanAvatarPlatformOff.stop();
humanAvatarPlatformOn = new Tween(humanAvatar.humanPlatformOn,"alpha",Strong.easeOut,0,1,1,true);
humanAvatarPlatformOn.stop();
//fictional
fictionalAvatarPlatformOff = new Tween(fictionalAvatar.fictionalPlatformOn,"alpha",Strong.easeOut,1,0,1,true);
fictionalAvatarPlatformOff.stop();
fictionalAvatarPlatformOn = new Tween(fictionalAvatar.fictionalPlatformOn,"alpha",Strong.easeOut,0,1,1,true);
fictionalAvatarPlatformOn.stop();
//thing
thingAvatarPlatformOff = new Tween(thingAvatar.thingPlatformOn,"alpha",Strong.easeOut,1,0,1,true);
thingAvatarPlatformOff.stop();
thingAvatarPlatformOn = new Tween(thingAvatar.thingPlatformOn,"alpha",Strong.easeOut,0,1,1,true);
thingAvatarPlatformOn.stop();
//fade avatars in or out
//human
humanAvatarFadeOut = new Tween(humanAvatar,"alpha",Strong.easeOut,1,0.5,1,true);
humanAvatarFadeOut.stop();
humanAvatarFadeIn = new Tween(humanAvatar,"alpha",Strong.easeOut,0.5,1,1,true);
humanAvatarFadeIn.stop();
//fictional
fictionalAvatarFadeOut = new Tween(fictionalAvatar,"alpha",Strong.easeOut,1,0.5,1,true);
fictionalAvatarFadeOut.stop();
fictionalAvatarFadeIn = new Tween(fictionalAvatar,"alpha",Strong.easeOut,0.5,1,1,true);
fictionalAvatarFadeIn.stop();
//thing
thingAvatarFadeOut = new Tween(thingAvatar,"alpha",Strong.easeOut,1,0.5,1,true);
thingAvatarFadeOut.stop();
thingAvatarFadeIn = new Tween(thingAvatar,"alpha",Strong.easeOut,0.5,1,1,true);
thingAvatarFadeIn.stop();
//moving the worlds around
//earth
earthWorldCenter2Left = new Tween(earthWorld,"x",Strong.easeOut,282,152,1,true);
earthWorldCenter2Left.stop();
earthWorldCenter2Right = new Tween(earthWorld,"x",Strong.easeOut,282,412,1,true);
earthWorldCenter2Right.stop();
earthWorldLeft2Center = new Tween(earthWorld,"x",Strong.easeOut,152,282,1,true);
earthWorldLeft2Center.stop();
earthWorldRight2Center = new Tween(earthWorld,"x",Strong.easeOut,412,282,1,true);
earthWorldRight2Center.stop();
earthWorldRight2Left = new Tween(earthWorld,"x",Strong.easeOut,412,152,1,true);
earthWorldRight2Left.stop();
earthWorldLeft2Right = new Tween(earthWorld,"x",Strong.easeOut,152,412,1,true);
earthWorldLeft2Right.stop();
earthWorldBack = new Tween(earthWorld,"y",Strong.easeOut,597.3,497.3,1,true);
earthWorldBack.stop();
earthWorldForward = new Tween(earthWorld,"y",Strong.easeOut,497.3,597.3,1,true);
earthWorldForward.stop();
//medi
mediWorldCenter2Left = new Tween(mediWorld,"x",Strong.easeOut,282,152,1,true);
mediWorldCenter2Left.stop();
mediWorldCenter2Right = new Tween(mediWorld,"x",Strong.easeOut,282,412,1,true);
mediWorldCenter2Right.stop();
mediWorldLeft2Center = new Tween(mediWorld,"x",Strong.easeOut,152,282,1,true);
mediWorldLeft2Center.stop();
mediWorldRight2Center = new Tween(mediWorld,"x",Strong.easeOut,412,282,1,true);
mediWorldRight2Center.stop();
mediWorldRight2Left = new Tween(mediWorld,"x",Strong.easeOut,412,152,1,true);
mediWorldRight2Left.stop();
mediWorldLeft2Right = new Tween(mediWorld,"x",Strong.easeOut,152,412,1,true);
mediWorldLeft2Right.stop();
mediWorldBack = new Tween(mediWorld,"y",Strong.easeOut,597.3,497.3,1,true);
mediWorldBack.stop();
mediWorldForward = new Tween(mediWorld,"y",Strong.easeOut,497.3,597.3,1,true);
mediWorldForward.stop();
//alien
alienWorldCenter2Left = new Tween(alienWorld,"x",Strong.easeOut,282,152,1,true);
alienWorldCenter2Left.stop();
alienWorldCenter2Right = new Tween(alienWorld,"x",Strong.easeOut,282,412,1,true);
alienWorldCenter2Right.stop();
alienWorldLeft2Center = new Tween(alienWorld,"x",Strong.easeOut,152,282,1,true);
alienWorldLeft2Center.stop();
alienWorldRight2Center = new Tween(alienWorld,"x",Strong.easeOut,412,282,1,true);
alienWorldRight2Center.stop();
alienWorldRight2Left = new Tween(alienWorld,"x",Strong.easeOut,412,152,1,true);
alienWorldRight2Left.stop();
alienWorldLeft2Right = new Tween(alienWorld,"x",Strong.easeOut,152,412,1,true);
alienWorldLeft2Right.stop();
alienWorldBack = new Tween(alienWorld,"y",Strong.easeOut,597.3,497.3,1,true);
alienWorldBack.stop();
alienWorldForward = new Tween(alienWorld,"y",Strong.easeOut,497.3,597.3,1,true);
alienWorldForward.stop();
//shrinking and growing earth world
earthWorldShrinkWidth = new Tween(earthWorld,"width",Strong.easeOut,289,289 * .5,1,true);
earthWorldShrinkWidth.stop();
earthWorldShrinkHeight = new Tween(earthWorld,"height",Strong.easeOut,303.1,303.1 * .5,1,true);
earthWorldShrinkHeight.stop();
earthWorldGrowWidth = new Tween(earthWorld,"width",Strong.easeOut,289 * .5,289,1,true);
earthWorldGrowWidth.stop();
earthWorldGrowHeight = new Tween(earthWorld,"height",Strong.easeOut,303.1 * .5,303.1,1,true);
earthWorldGrowHeight.stop();
//shrinking and growing medi dungeon
mediWorldShrinkWidth = new Tween(mediWorld,"width",Strong.easeOut,232,232 * .5,1,true);
mediWorldShrinkWidth.stop();
mediWorldShrinkHeight = new Tween(mediWorld,"height",Strong.easeOut,339.4,339.4 * .5,1,true);
mediWorldShrinkHeight.stop();
mediWorldGrowWidth = new Tween(mediWorld,"width",Strong.easeOut,232 * .5,232,1,true);
mediWorldGrowWidth.stop();
mediWorldGrowHeight = new Tween(mediWorld,"height",Strong.easeOut,339.4 * .5,339.4,1,true);
mediWorldGrowHeight.stop();
//shrinking and growing alien planet
alienWorldShrinkWidth = new Tween(alienWorld,"width",Strong.easeOut,289,289 * .5,1,true);
alienWorldShrinkWidth.stop();
alienWorldShrinkHeight = new Tween(alienWorld,"height",Strong.easeOut,302.6,302.6 * .5,1,true);
alienWorldShrinkHeight.stop();
alienWorldGrowWidth = new Tween(alienWorld,"width",Strong.easeOut,289 * .5,289,1,true);
alienWorldGrowWidth.stop();
alienWorldGrowHeight = new Tween(alienWorld,"height",Strong.easeOut,302.6 * .5,302.6,1,true);
alienWorldGrowHeight.stop();
//turning the platforms on or off
//earth
earthWorldPlatformOff = new Tween(earthWorld.earthPlatformOn,"alpha",Strong.easeOut,1,0,1,true);
earthWorldPlatformOff.stop();
earthWorldPlatformOn = new Tween(earthWorld.earthPlatformOn,"alpha",Strong.easeOut,0,1,1,true);
earthWorldPlatformOn.stop();
//medi
mediWorldPlatformOff = new Tween(mediWorld.mediPlatformOn,"alpha",Strong.easeOut,1,0,1,true);
mediWorldPlatformOff.stop();
mediWorldPlatformOn = new Tween(mediWorld.mediPlatformOn,"alpha",Strong.easeOut,0,1,1,true);
mediWorldPlatformOn.stop();
//alien
alienWorldPlatformOff = new Tween(alienWorld.alienPlatformOn,"alpha",Strong.easeOut,1,0,1,true);
alienWorldPlatformOff.stop();
alienWorldPlatformOn = new Tween(alienWorld.alienPlatformOn,"alpha",Strong.easeOut,0,1,1,true);
alienWorldPlatformOn.stop();
//fade avatars in or out
//earth
earthWorldFadeOut = new Tween(earthWorld,"alpha",Strong.easeOut,1,0.5,1,true);
earthWorldFadeOut.stop();
earthWorldFadeIn = new Tween(earthWorld,"alpha",Strong.easeOut,0.5,1,1,true);
earthWorldFadeIn.stop();
//medi
mediWorldFadeOut = new Tween(mediWorld,"alpha",Strong.easeOut,1,0.5,1,true);
mediWorldFadeOut.stop();
mediWorldFadeIn = new Tween(mediWorld,"alpha",Strong.easeOut,0.5,1,1,true);
mediWorldFadeIn.stop();
//alien
alienWorldFadeOut = new Tween(alienWorld,"alpha",Strong.easeOut,1,0.5,1,true);
alienWorldFadeOut.stop();
alienWorldFadeIn = new Tween(alienWorld,"alpha",Strong.easeOut,0.5,1,1,true);
alienWorldFadeIn.stop();
}//end setUpTweens function
function setUpText():void
{
humanAvatarText = "Sherry Turkle found that gamers like customizing their character. The avatar tended to be a more perfect version of their real-world (RL) self. This can be a form of escape or a personification of a goal.";
humanAvatarQuestion = "What do you think?";
fictionalAvatarText = "The fascination with video games is the control and ability to choose. Being able to inhabit someone elses mind and make different choices is a thrilling prospect. ";
fictionalAvatarQuestion = "What would you have done if you are...?";
thingAvatarText = "The nature of video games and computer in general are not bound by the rules of the physical world. Therefore, a character can be anything within the limits of the programmers imagination. Soon, the users will be the programmers.";
thingAvatarQuestion = "Will there be any limits then?";
michaelInfo = "22" + "\n" + "Male" + "\n" + "Santa Monica, CA" + "\n" + "Basketball" + "\n" + "College Student" + "\n" + "Stupid drivers" + "\n" + "Midnite Blue" + "\n" + "Playing the Piano";
rachelInfo = "18" + "\n" + "Female" + "\n" + "Boston, MA" + "\n" + "Volleyball" + "\n" + "High School Student" + "\n" + "None" + "\n" + "Bubblegum Pink" + "\n" + "Tying a cherry stem with her tongue";
jeffInfo = "21" + "\n" + "Male" + "\n" + "Medford, OR" + "\n" + "Football" + "\n" + "Pizza Delivery Guy" + "\n" + "Girls who don\'t call back" + "\n" + "Red" + "\n" + "Belching the Pledge of Allegiance";
takashiInfo = "26" + "\n" + "Male" + "\n" + "San Francisco, CA" + "\n" + "Robotics" + "\n" + "Computer Programmer" + "\n" + "Casual gamers" + "\n" + "Olive Green" + "\n" + "Playing the Guitar";
moniqueInfo = "29" + "\n" + "Female" + "\n" + "Venice, CA" + "\n" + "Rock Climbing" + "\n" + "Registered Nurse" + "\n" + "Nail biting" + "\n" + "Burgundy" + "\n" + "Playing the Violin";
duckieInfo = "39" + "\n" + "Male" + "\n" + "Bathtub" + "\n" + "Making bubbles" + "\n" + "Floater" + "\n" + "Cold water" + "\n" + "Yellow" + "\n" + "Squirting";
carInfo = "5" + "\n" + "Female" + "\n" + "Toy Chest" + "\n" + "Drifting" + "\n" + "Racer" + "\n" + "Being left behind" + "\n" + "Blue" + "\n" + "Doing wheelies";
coneInfo = "85" + "\n" + "Male" + "\n" + "Street" + "\n" + "Nothing" + "\n" + "Traffic Block" + "\n" + "Stupid drivers" + "\n" + "Orange" + "\n" + "Being stacked";
cubeInfo = "29" + "\n" + "Female" + "\n" + "Desk" + "\n" + "Doing Math" + "\n" + "Paper Weight" + "\n" + "Collecting dust" + "\n" + "Purple" + "\n" + "Pissing people off";
stilettoInfo = "79" + "\n" + "Female" + "\n" + "Closet" + "\n" + "Dancing" + "\n" + "Torture Device" + "\n" + "Gum on the floor" + "\n" + "Red" + "\n" + "Killing cockroaches";
mChiefInfo = "35" + "\n" + "Male" + "\n" + "Sierra 117" + "\n" + "Creating machinima" + "\n" + "Spartan" + "\n" + "The Covenant" + "\n" + "Green" + "\n" + "Killing";
gollumInfo = "500" + "\n" + "Male" + "\n" + "MiddleEarth" + "\n" + "Manipulating Smeagol" + "\n" + "Keeper of the Precious" + "\n" + "Thieves" + "\n" + "Gold" + "\n" + "Being double-jointed";
martianInfo = "N/A" + "\n" + "N/A" + "\n" + "N/A" + "\n" + "Anal probing" + "\n" + "Destroyer of Worlds" + "\n" + "Satellite overcrowding" + "\n" + "Green" + "\n" + "Telekinesis";
claireInfo = "16" + "\n" + "Female" + "\n" + "Odessa, TX" + "\n" + "Cheerleading" + "\n" + "High School Student" + "\n" + "Being Normal" + "\n" + "White" + "\n" + "Healing";
laraInfo = "28" + "\n" + "Female" + "\n" + "London, England" + "\n" + "Horseback Riding" + "\n" + "Archeologist" + "\n" + "Obnoxious Tomb Raiders" + "\n" + "Black" + "\n" + "Sharp shooting";
earthWorldText = "Computers have entered almost every aspect of daily life. Will they become life itself? In 1984, Turkle hoped that the real-world and the computer world of simulation will be accessible to each other. ";
earthWorldQuestion = "Do you think this is true now?";
mediWorldText = "The rule-governed worlds of video games have a basis in Dungeons & Dragons(D&D). These role-playing games had many intricate rules. The existence of these rules in video games can be like a measuring stick for gamers to reevaluate their state of mind. ";
mediWorldQuestion = "Is the real world like this?";
alienWorldText = "The rule-governed worlds of video games are similar to science fiction. Science fiction is based in the rules of science, but are expanded and pushed to unknown limits by the writer. Turkle noticed that having an escape from real world worries made video games similar to meditation. ";
alienWorldQuestion = "How do you like to meditate?";
pongIntroText1 = "Video games force the player to be in a highly-focused state of mind. In a video game, the player can perfect a part of himself/herself by perfecting his/her score. Its you against yourself with the game as the measuring stick.";
pongIntroText2 = "Your goal in this Pong Challenge is to last for one minute playing against yourself. Hit the ball against the edges for more points!";
exploreIntroText1 = "Sherry Turkle believed that video games were not mindless entertainment, but that in order to win or finish the game, gamers would have to find out the logic behind the game. This is a form of learning how to learn.";
exploreIntroText2 = "Try learning how to learn while exploring this world. Each world has different rules. If you switch to another world, you\'ll have to complete this task again. ";
exploreInstructions = "Click on the items and see what happens. Once you understand the rules of this world, click I Solved It!";
flowIntroText1 = "Sherry Turkle noticed that popular games could bring players into a Zen-like or altered state of mind in which they could focus only on the game. This point was called the FLOW. ";
flowIntroText2 = "An interactive media such as video games find the FLOW in a balance of challenge and variety. Too much variety, and the user is confused. Too much of a challenge, and the user gives up. Too little of either, and the user is bored.";
flowInstructions = "Click on the objects to find the FLOW hidden within them. You have 30 seconds. Be careful when the task becomes chaotic";
licenseIntroText1 = "Sherry Turkle noticed that gamers lived in a competitive community driven by a desire to master the games and recognize their achievements. Many gamers did not get recognition in the real world, but are able to find it in video games.";
licenseIntroText2 = "Here you can find recognition for finishing the tasks. Plus, you get to bring this recognition into the real world by printing your own License to Switch.";
noLicenseYetText = "License Registration is locked until the other tasks are completed";
feastIntroText1 = "In the real world, there are few things that you can control, but in a video game, you make the choices. This can seem like a tempting diversion since a game allows the player to make choices they normally dont make in the real world. ";
feastIntroText2 = "Games also allows the player a safe environment to try things they were afraid to do in the real world. Taste some interesting sweets and libations and find out what happens. You can always set the resest button.";
feastInstructions = "Choose a food or drink by clicking on it and see how your avatar changes... or not!";
finalIntroText1 = "Final Battle Intro Text. ";
finalIntroText2 = "Final Intro Text 2";
finalInstructions = "Destroy the monster to let Sherry Turkle free.";
}
function setUpVariables():void
{
//bkg image
bkgImageHolder.y = 0;
//cache both as bitmap
bkgImageHolder.bkgImage.cacheAsBitmap = true;
bkgImageHolder.bkgImageMask.cacheAsBitmap = true;
//create the mask
bkgImageHolder.bkgImage.mask = bkgImageHolder.bkgImageMask;
flowTimer.reset();
exploreTimer.reset();
utilHumanButtons.y = -400;
utilFictionalButtons.y = -400;
utilThingButtons.y = -400;
utilCharButtons.y = -300;
utilTaskButtons.y = -300;
utilWorldButtons.y = -300;
utilCharButtons.utilHuman.y = utilHumanBtnY;
utilCharButtons.utilFictional.y = utilFictionalBtnYUp;
utilCharButtons.utilThing.y = utilThingBtnYUp;
//starting locations
taskInfoBar.y = 785;
taskNotify.x = 455;
taskNotify.pongInstructions.alpha = 0;
taskNotify.startGameButton.y = 184;
taskInfoBar.exploreSolvedButton.y = 500;
taskInfoBar.resetAvatarButton.y = 500;
taskInfoBar.quitGameButton.y = 500;
taskNotify.exploreEarthRule.y = 1000;
taskNotify.exploreAlienRule.y = 1000;
taskNotify.exploreMediRule.y = 1000;
//feast stuff
feastLayout.x = 455;
feastLayout.y = -600;
//bring down the two foods
feastLayout.feast1Right.x = 197.2;
feastLayout.feast1Right.y = -600;
feastLayout.feast1Left.x = -197.2;
feastLayout.feast1Left.y = -600;
feastLayout.feast2Right.x = 197.2;
feastLayout.feast2Right.y = -600;
feastLayout.feast2Left.x = -197.2;
feastLayout.feast2Left.y = -600;
feastLayout.feast1Right.x = 197.2;
feastLayout.feast2Right.y = -600;
feastLayout.feast2Left.x = -197.2;
feastLayout.feast2Left.y = -600;
feastMask.x = 455.2;
feastMask.y = 800;
feastAvatar.x = 450;
feastAvatar.y = 800;
switchLicense.x = 455;
switchLicense.y = 1000;
//worlds
earthWorld.x = -412;
mediWorld.x = -412;
alienWorld.x = -412;
utilMichael.x = utilCharX;
utilJeff.x = utilCharX;
utilRachel.x = utilCharX;
utilMonique.x = utilCharX;
utilTakashi.x = utilCharX;
utilMasterChief.x = utilCharX;
utilMartian.x = utilCharX;
utilGollum.x = utilCharX;
utilLara.x = utilCharX;
utilClaire.x = utilCharX;
utilCar.x = utilCharX;
utilCone.x = utilCharX;
utilDuckie.x = utilCharX;
utilCube.x = utilCharX;
utilStiletto.x = utilCharX;
utilMichael.y = utilCharYOff;
utilJeff.y = utilCharYOff;
utilRachel.y = utilCharYOff;
utilTakashi.y = utilCharYOff;
utilMonique.y = utilCharYOff;
utilMasterChief.y = utilCharYOff;
utilMartian.y = utilCharYOff;
utilGollum.y = utilCharYOff;
utilLara.y = utilCharYOff;
utilClaire.y = utilCharYOff;
utilCar.y = utilCharYOff;
utilCone.y = utilCharYOff;
utilDuckie.y = utilCharYOff;
utilCube.y = utilCharYOff;
utilStiletto.y = utilCharYOff;
utilMedi.x = utilWorldX;
utilEarth.x = utilWorldX;
utilAlien.x = utilWorldX;
utilEarth.y = utilWorldYOff;
utilMedi.y = utilWorldYOff;
utilAlien.y = utilWorldYOff;
//task portal signs
earthTaskSigns.x = xCenter;
earthTaskSigns.y = 1368;
mediTaskSigns.x = xCenter;
mediTaskSigns.y = 1350;
alienTaskSigns.x = xCenter;
alienTaskSigns.y = 1347;
}
//remove flow objects
//text when game over
function removeFlowObjects():void
{
for (var i:int=0; i885) || (mouseY<10 || mouseY>500))
{
//moveUpUtilChar.start();
//move up the dropdown menu
clearCharButtons();
utilCharButtons.y = -300;
utilCharButtons.utilFictional.y = utilFictionalBtnYUp;
utilCharButtons.utilThing.y = utilThingBtnYUp;
removeChangeAvatarListeners();
stage.removeEventListener(Event.ENTER_FRAME, charDropDownRelease);
}
}
//moves up the character groups util buttons
function charGroupDropDownRelease(event:Event):void
{
if ((mouseX<810 || mouseX>885) || (mouseY<80 || mouseY>500))
{
//moveUpUtilChar.start();
//move up the dropdown menu
clearCharButtons();
utilCharButtons.y = -300;
utilCharButtons.utilFictional.y = utilFictionalBtnYUp;
utilCharButtons.utilThing.y = utilThingBtnYUp;
removeChangeAvatarListeners();
stage.removeEventListener(Event.ENTER_FRAME, charGroupDropDownRelease);
}
}
function removeChangeAvatarListeners():void
{
//human listeners
utilHumanButtons.utilMoniqueButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilJeffButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilRachelButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilMichaelButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilTakashiButton.addEventListener(MouseEvent.CLICK, changeAvatar);
//fictional listeners
utilFictionalButtons.utilGollumButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilLaraButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilMartianButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilMChiefButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilClaireButton.addEventListener(MouseEvent.CLICK, changeAvatar);
//thing listeners
utilThingButtons.utilConeButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilDuckieButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilCubeButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilCarButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilStilettoButton.addEventListener(MouseEvent.CLICK, changeAvatar);
}
function humanDropDown(event:MouseEvent):void
{
//move up the dropdown menu
clearCharButtons();
var currentCharIsHuman:Boolean = true;
switch (currentChar)
{
case "Michael" :
utilHumanButtons.utilMoniqueButton.y = utilHumanBtnY1;
utilHumanButtons.utilMoniqueButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilJeffButton.y = utilHumanBtnY2;
utilHumanButtons.utilJeffButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilRachelButton.y = utilHumanBtnY3;
utilHumanButtons.utilRachelButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilTakashiButton.y = utilHumanBtnY4;
utilHumanButtons.utilTakashiButton.addEventListener(MouseEvent.CLICK, changeAvatar);
break;
case "Monique" :
utilHumanButtons.utilMichaelButton.y = utilHumanBtnY1;
utilHumanButtons.utilMichaelButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilJeffButton.y = utilHumanBtnY2;
utilHumanButtons.utilJeffButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilRachelButton.y = utilHumanBtnY3;
utilHumanButtons.utilRachelButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilTakashiButton.y = utilHumanBtnY4;
utilHumanButtons.utilTakashiButton.addEventListener(MouseEvent.CLICK, changeAvatar);
break;
case "Jeff" :
utilHumanButtons.utilMoniqueButton.y = utilHumanBtnY1;
utilHumanButtons.utilMoniqueButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilMichaelButton.y = utilHumanBtnY2;
utilHumanButtons.utilMichaelButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilRachelButton.y = utilHumanBtnY3;
utilHumanButtons.utilRachelButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilTakashiButton.y = utilHumanBtnY4;
utilHumanButtons.utilTakashiButton.addEventListener(MouseEvent.CLICK, changeAvatar);
break;
case "Rachel" :
utilHumanButtons.utilMoniqueButton.y = utilHumanBtnY1;
utilHumanButtons.utilMoniqueButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilJeffButton.y = utilHumanBtnY2;
utilHumanButtons.utilJeffButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilMichaelButton.y = utilHumanBtnY3;
utilHumanButtons.utilMichaelButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilTakashiButton.y = utilHumanBtnY4;
utilHumanButtons.utilTakashiButton.addEventListener(MouseEvent.CLICK, changeAvatar);
break;
case "Takashi" :
utilHumanButtons.utilMoniqueButton.y = utilHumanBtnY1;
utilHumanButtons.utilMoniqueButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilJeffButton.y = utilHumanBtnY2;
utilHumanButtons.utilJeffButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilRachelButton.y = utilHumanBtnY3;
utilHumanButtons.utilRachelButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilMichaelButton.y = utilHumanBtnY4;
utilHumanButtons.utilMichaelButton.addEventListener(MouseEvent.CLICK, changeAvatar);
break;
default :
utilHumanButtons.utilMoniqueButton.y = utilHumanBtnY1;
utilHumanButtons.utilMoniqueButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilJeffButton.y = utilHumanBtnY2;
utilHumanButtons.utilJeffButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilRachelButton.y = utilHumanBtnY3;
utilHumanButtons.utilRachelButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilMichaelButton.y = utilHumanBtnY4;
utilHumanButtons.utilMichaelButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilHumanButtons.utilTakashiButton.y = utilHumanBtnY5;
utilHumanButtons.utilTakashiButton.addEventListener(MouseEvent.CLICK, changeAvatar);
currentCharIsHuman = false;
break;
}
dropDownUtilHuman.start();
if(currentCharIsHuman)
{
dropDownUtilFictionalBtn.start();
dropDownUtilThingBtn.start();
}
else
{
dropDownUtilFictionalBtn2.start();
dropDownUtilThingBtn2.start();
}
stage.addEventListener(Event.ENTER_FRAME, charGroupDropDownRelease);
}
function fictionalDropDown(event:MouseEvent):void
{
//move up the dropdown menu
clearCharButtons();
utilCharButtons.utilFictional.y = utilFictionalBtnYUp;
utilCharButtons.utilThing.y = utilThingBtnYUp;
var currentCharIsFictional:Boolean = true;
switch (currentChar)
{
case "MChief" :
utilFictionalButtons.utilGollumButton.y = utilFictionalBtnY1;
utilFictionalButtons.utilGollumButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilLaraButton.y = utilFictionalBtnY2;
utilFictionalButtons.utilLaraButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilMartianButton.y = utilFictionalBtnY3;
utilFictionalButtons.utilMartianButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilClaireButton.y = utilFictionalBtnY4;
utilFictionalButtons.utilClaireButton.addEventListener(MouseEvent.CLICK, changeAvatar);
break;
case "Gollum" :
utilFictionalButtons.utilMChiefButton.y = utilFictionalBtnY1;
utilFictionalButtons.utilMChiefButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilLaraButton.y = utilFictionalBtnY2;
utilFictionalButtons.utilLaraButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilMartianButton.y = utilFictionalBtnY3;
utilFictionalButtons.utilMartianButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilClaireButton.y = utilFictionalBtnY4;
utilFictionalButtons.utilClaireButton.addEventListener(MouseEvent.CLICK, changeAvatar);
break;
case "Lara" :
utilFictionalButtons.utilGollumButton.y = utilFictionalBtnY1;
utilFictionalButtons.utilGollumButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilMChiefButton.y = utilFictionalBtnY2;
utilFictionalButtons.utilMChiefButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilMartianButton.y = utilFictionalBtnY3;
utilFictionalButtons.utilMartianButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilClaireButton.y = utilFictionalBtnY4;
utilFictionalButtons.utilClaireButton.addEventListener(MouseEvent.CLICK, changeAvatar);
break;
case "Martian" :
utilFictionalButtons.utilGollumButton.y = utilFictionalBtnY1;
utilFictionalButtons.utilGollumButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilLaraButton.y = utilFictionalBtnY2;
utilFictionalButtons.utilLaraButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilMChiefButton.y = utilFictionalBtnY3;
utilFictionalButtons.utilMChiefButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilClaireButton.y = utilFictionalBtnY4;
utilFictionalButtons.utilClaireButton.addEventListener(MouseEvent.CLICK, changeAvatar);
break;
case "Claire" :
utilFictionalButtons.utilGollumButton.y = utilFictionalBtnY1;
utilFictionalButtons.utilGollumButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilLaraButton.y = utilFictionalBtnY2;
utilFictionalButtons.utilLaraButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilMartianButton.y = utilFictionalBtnY3;
utilFictionalButtons.utilMartianButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilMChiefButton.y = utilFictionalBtnY4;
utilFictionalButtons.utilMChiefButton.addEventListener(MouseEvent.CLICK, changeAvatar);
break;
default :
utilFictionalButtons.utilGollumButton.y = utilFictionalBtnY1;
utilFictionalButtons.utilGollumButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilLaraButton.y = utilFictionalBtnY2;
utilFictionalButtons.utilLaraButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilMartianButton.y = utilFictionalBtnY3;
utilFictionalButtons.utilMartianButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilMChiefButton.y = utilFictionalBtnY4;
utilFictionalButtons.utilMChiefButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilFictionalButtons.utilClaireButton.y = utilFictionalBtnY5;
utilFictionalButtons.utilClaireButton.addEventListener(MouseEvent.CLICK, changeAvatar);
currentCharIsFictional= false;
break;
}
dropDownUtilFictional.start();
if(currentCharIsFictional)
{
//dropDownUtilFictionalBtn.start();
dropDownUtilThingBtn.start();
}
else
{
//dropDownUtilFictionalBtn.start();
dropDownUtilThingBtn2.start();
}
stage.addEventListener(Event.ENTER_FRAME, charGroupDropDownRelease);
}
function thingDropDown(event:MouseEvent):void
{
//move up the dropdown menu
clearCharButtons();
utilCharButtons.utilFictional.y = utilFictionalBtnYUp;
utilCharButtons.utilThing.y = utilThingBtnYUp;
switch (currentChar)
{
case "Car" :
utilThingButtons.utilConeButton.y = utilThingBtnY1;
utilThingButtons.utilConeButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilDuckieButton.y = utilThingBtnY2;
utilThingButtons.utilDuckieButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilCubeButton.y = utilThingBtnY3;
utilThingButtons.utilCubeButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilStilettoButton.y = utilThingBtnY4;
utilThingButtons.utilStilettoButton.addEventListener(MouseEvent.CLICK, changeAvatar);
break;
case "Cone" :
utilThingButtons.utilCarButton.y = utilThingBtnY1;
utilThingButtons.utilCarButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilDuckieButton.y = utilThingBtnY2;
utilThingButtons.utilDuckieButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilCubeButton.y = utilThingBtnY3;
utilThingButtons.utilCubeButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilStilettoButton.y = utilThingBtnY4;
utilThingButtons.utilStilettoButton.addEventListener(MouseEvent.CLICK, changeAvatar);
break;
case "Duckie" :
utilThingButtons.utilConeButton.y = utilThingBtnY1;
utilThingButtons.utilConeButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilCarButton.y = utilThingBtnY2;
utilThingButtons.utilCarButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilCubeButton.y = utilThingBtnY3;
utilThingButtons.utilCubeButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilStilettoButton.y = utilThingBtnY4;
utilThingButtons.utilStilettoButton.addEventListener(MouseEvent.CLICK, changeAvatar);
break;
case "Cube" :
utilThingButtons.utilConeButton.y = utilThingBtnY1;
utilThingButtons.utilConeButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilDuckieButton.y = utilThingBtnY2;
utilThingButtons.utilDuckieButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilCarButton.y = utilThingBtnY3;
utilThingButtons.utilCarButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilStilettoButton.y = utilThingBtnY4;
utilThingButtons.utilStilettoButton.addEventListener(MouseEvent.CLICK, changeAvatar);
break;
case "Stiletto" :
utilThingButtons.utilConeButton.y = utilThingBtnY1;
utilThingButtons.utilConeButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilDuckieButton.y = utilThingBtnY2;
utilThingButtons.utilDuckieButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilCubeButton.y = utilThingBtnY3;
utilThingButtons.utilCubeButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilCarButton.y = utilThingBtnY4;
utilThingButtons.utilCarButton.addEventListener(MouseEvent.CLICK, changeAvatar);
break;
default :
utilThingButtons.utilConeButton.y = utilThingBtnY1;
utilThingButtons.utilConeButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilDuckieButton.y = utilThingBtnY2;
utilThingButtons.utilDuckieButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilCubeButton.y = utilThingBtnY3;
utilThingButtons.utilCubeButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilCarButton.y = utilThingBtnY4;
utilThingButtons.utilCarButton.addEventListener(MouseEvent.CLICK, changeAvatar);
utilThingButtons.utilStilettoButton.y = utilThingBtnY5;
utilThingButtons.utilStilettoButton.addEventListener(MouseEvent.CLICK, changeAvatar);
break;
}
dropDownUtilThing.start();
stage.addEventListener(Event.ENTER_FRAME, charGroupDropDownRelease);
}
//drop down the three avatar buttons
function charDropDown(event:MouseEvent):void
{
utilCharButtons.utilFictional.y = utilFictionalBtnYUp;
utilCharButtons.utilThing.y = utilThingBtnYUp;
utilCharButtons.utilHuman.addEventListener(MouseEvent.CLICK, humanDropDown);
utilCharButtons.utilFictional.addEventListener(MouseEvent.CLICK, fictionalDropDown);
utilCharButtons.utilThing.addEventListener(MouseEvent.CLICK, thingDropDown);
stage.addEventListener(Event.ENTER_FRAME, charDropDownRelease);
dropDownUtilChar.start();
//utilCharButton.removeEventListener(MouseEvent.MOUSE_OVER, charDropDown);
}
//brings up the world selection page
function goToWorldPage():void
{
//clear the page: this decides where we're coming from and clears it
clearThePage();
currentPage = "worldPage";
//check utility variables
utilCharButton.addEventListener(MouseEvent.MOUSE_OVER, charDropDown);
//utility subheader
utilSubHeader.utilSubHeaderText.text = "World Selection";
//header title
headerTitle.headerTitleText.text = "World Selection";
//bring avatar platforms on stage
//earth world is selected
earthWorld.x = 282;
earthWorld.y = 597.3;
earthWorld.width = 289;
earthWorld.height = 303.1;
earthWorld.alpha = 1;
earthWorld.earthPlatformOn.alpha = 1;
earthUpFront = true;
selInfoSection.earthTitle.alpha = 1;
//medieval dungeon is to the left
mediWorld.x = 152;
mediWorld.y = 497.3;
mediWorld.width = 232 * .5;
mediWorld.height = 339.4 * .5;
mediWorld.alpha = 0.5;
mediWorld.mediPlatformOn.alpha = 0;
selInfoSection.mediTitle.alpha = 0;
//alien planet is to the right
alienWorld.x = 412;
alienWorld.y = 497.3;
alienWorld.width = 289 * .5;
alienWorld.height = 302.6 * .5;
alienWorld.alpha = 0.5;
alienWorld.alienPlatformOn.alpha = 0;
selInfoSection.alienTitle.alpha = 0;
//move avatar buttons
moveLeftArrow.x = 139.8;
moveLeftArrow.y = 603.1;
moveRightArrow.x = 425.4;
moveRightArrow.y = 603.1;
selectAvatarWorld.x = 260;
//selection info section
selInfoSection.x = 505.9;
selInfoSection.y = 151.9;
selInfoSection.selectWorld.alpha = 1;
//event listeners to move the avatars around
moveLeftArrow.addEventListener(MouseEvent.CLICK, moveWorldsLeft);
moveRightArrow.addEventListener(MouseEvent.CLICK, moveWorldsRight);
//event listeners for selecting an avatar
selInfoSection.selectWorld.addEventListener(MouseEvent.CLICK, chooseAWorld);
selectAvatarWorld.addEventListener(MouseEvent.CLICK, chooseAWorld);
selectAvatarWorld.buttonMode = true;
}
function changeGameObjects():void
{
//get the page
switch (currentPage)
{
case "portalPage" :
//switch the signs
earthTaskSigns.y = 3680;
mediTaskSigns.y = 3500;
mediTaskSigns.y = 3500;
//remove all of the listeners first
earthTaskSigns.earthPongButton.removeEventListener(MouseEvent.CLICK, goToPongPage);
earthTaskSigns.earthFlowButton.removeEventListener(MouseEvent.CLICK, goToFlowPage);
earthTaskSigns.earthFeastButton.removeEventListener(MouseEvent.CLICK, goToFeastPage);
earthTaskSigns.earthExploreButton.removeEventListener(MouseEvent.CLICK, goToExplorePage);
earthTaskSigns.earthLicenseButton.removeEventListener(MouseEvent.CLICK, goToLicensePage);
mediTaskSigns.mediPongButton.removeEventListener(MouseEvent.CLICK, goToPongPage);
mediTaskSigns.mediFlowButton.removeEventListener(MouseEvent.CLICK, goToFlowPage);
mediTaskSigns.mediFeastButton.removeEventListener(MouseEvent.CLICK, goToFeastPage);
mediTaskSigns.mediExploreButton.removeEventListener(MouseEvent.CLICK, goToExplorePage);
mediTaskSigns.mediLicenseButton.removeEventListener(MouseEvent.CLICK, goToLicensePage);
alienTaskSigns.alienPongButton.removeEventListener(MouseEvent.CLICK, goToPongPage);
alienTaskSigns.alienFlowButton.removeEventListener(MouseEvent.CLICK, goToFlowPage);
alienTaskSigns.alienFeastButton.removeEventListener(MouseEvent.CLICK, goToFeastPage);
alienTaskSigns.alienExploreButton.removeEventListener(MouseEvent.CLICK, goToExplorePage);
alienTaskSigns.alienLicenseButton.removeEventListener(MouseEvent.CLICK, goToLicensePage);
//slide up signs/buttons for each task
if (worldEarth)
{
//chosen world variable
earthTaskSigns.y = 368;
earthTaskSigns.earthPongButton.addEventListener(MouseEvent.CLICK, goToPongPage);
earthTaskSigns.earthFlowButton.addEventListener(MouseEvent.CLICK, goToFlowPage);
earthTaskSigns.earthFeastButton.addEventListener(MouseEvent.CLICK, goToFeastPage);
earthTaskSigns.earthExploreButton.addEventListener(MouseEvent.CLICK, goToExplorePage);
earthTaskSigns.earthLicenseButton.addEventListener(MouseEvent.CLICK, goToLicensePage);
}
else if (worldMedi)
{
//chosen world variable
mediTaskSigns.y = 350;
mediTaskSigns.mediPongButton.addEventListener(MouseEvent.CLICK, goToPongPage);
mediTaskSigns.mediFlowButton.addEventListener(MouseEvent.CLICK, goToFlowPage);
mediTaskSigns.mediFeastButton.addEventListener(MouseEvent.CLICK, goToFeastPage);
mediTaskSigns.mediExploreButton.addEventListener(MouseEvent.CLICK, goToExplorePage);
mediTaskSigns.mediLicenseButton.addEventListener(MouseEvent.CLICK, goToLicensePage);
}
else if (worldAlien)
{
//chosen world variable
alienTaskSigns.y = 347;
alienTaskSigns.alienPongButton.addEventListener(MouseEvent.CLICK, goToPongPage);
alienTaskSigns.alienFlowButton.addEventListener(MouseEvent.CLICK, goToFlowPage);
alienTaskSigns.alienFeastButton.addEventListener(MouseEvent.CLICK, goToFeastPage);
alienTaskSigns.alienExploreButton.addEventListener(MouseEvent.CLICK, goToExplorePage);
alienTaskSigns.alienLicenseButton.addEventListener(MouseEvent.CLICK, goToLicensePage);
}
break;
case "pongPage" :
//changes the pong objects
if (worldEarth)
{
rightPaddle.gotoAndStop("paddle");
leftPaddle.gotoAndStop("paddle");
pongBall.gotoAndStop("ball");
pongTable.gotoAndStop("earth");
}
else if (worldMedi)
{
rightPaddle.gotoAndStop("sword");
leftPaddle.gotoAndStop("sword");
pongBall.gotoAndStop("skull");
pongTable.gotoAndStop("medi");
}
else if (worldAlien)
{
rightPaddle.gotoAndStop("spatula");
leftPaddle.gotoAndStop("spatula");
pongBall.gotoAndStop("glow");
pongTable.gotoAndStop("alien");
}
break;
case "flowPage" :
//nothing because it changes with the avatar
break;
case "explorePage" :
//changes all the objects in the explore page
for (var i:int = 0; i < exploreObjectMCArray.length; i++)
{
//find the object
var thisExploreObject = objectSpace.getChildByName("exploreObject_"+i);
thisExploreObject.earthGroup.alpha = 0;
thisExploreObject.alienGroup.alpha = 0;
thisExploreObject.mediGroup.alpha = 0;
//get the right world
if (worldEarth)
{
thisExploreObject.earthGroup.alpha = 1;
}
else if (worldMedi)
{
thisExploreObject.mediGroup.alpha = 1;
}
else if (worldAlien)
{
thisExploreObject.alienGroup.alpha = 1;
}
}//end for loop
break;
case "feastPage" :
//chaanges the mirror and tables
if (worldEarth)
{
feastMask.gotoAndStop("earth");
feastLayout.feastMirror.gotoAndStop("earth");
feastLayout.feastTableLeft.gotoAndStop("earth");
feastLayout.feastTableRight.gotoAndStop("earth");
feastLayout.feast1Right.gotoAndStop("earth");
feastLayout.feast2Right.gotoAndStop("earth");
feastLayout.feast3Right.gotoAndStop("earth");
feastLayout.feast1Left.gotoAndStop("earth");
feastLayout.feast2Left.gotoAndStop("earth");
feastLayout.feast3Left.gotoAndStop("earth");
}
else if (worldMedi)
{
feastMask.gotoAndStop("medi");
feastLayout.feastMirror.gotoAndStop("medi");
feastLayout.feastTableLeft.gotoAndStop("medi");
feastLayout.feastTableRight.gotoAndStop("medi");
feastLayout.feast1Right.gotoAndStop("medi");
feastLayout.feast2Right.gotoAndStop("medi");
feastLayout.feast3Right.gotoAndStop("medi");
feastLayout.feast1Left.gotoAndStop("medi");
feastLayout.feast2Left.gotoAndStop("medi");
feastLayout.feast3Left.gotoAndStop("medi");
}
else if (worldAlien)
{
feastMask.gotoAndStop("alien");
feastLayout.feastMirror.gotoAndStop("alien");
feastLayout.feastTableLeft.gotoAndStop("alien");
feastLayout.feastTableRight.gotoAndStop("alien");
feastLayout.feast1Right.gotoAndStop("alien");
feastLayout.feast2Right.gotoAndStop("alien");
feastLayout.feast3Right.gotoAndStop("alien");
feastLayout.feast1Left.gotoAndStop("alien");
feastLayout.feast2Left.gotoAndStop("alien");
feastLayout.feast3Left.gotoAndStop("alien");
}
break;
case "licensePage" :
//nothing
break;
default :
if (worldEarth)
{
bkgImageURL = "bkg_earth_final.jpg";
bkgImageTint = 0xceb5b2;
}
else if (worldMedi)
{
bkgImageURL = "bkg_medi_final.jpg";
bkgImageTint = 0x989292;
}
else if (worldAlien)
{
bkgImageURL = "bkg_alien_final.jpg";
bkgImageTint = 0x99a675;
}
break;
}//end switch
}
//chooses a world and goes to task portal pagee
function changeWorld(event:MouseEvent):void
{
utilWorldButtons.utilEarthButton.y = utilWorldBtnYOff;
utilWorldButtons.utilMediButton.y = utilWorldBtnYOff;
utilWorldButtons.utilAlienButton.y = utilWorldBtnYOff;
utilWorld.y = utilWorldYOff;
utilEarth.y = utilWorldYOff;
utilMedi.y = utilWorldYOff;
utilAlien.y = utilWorldYOff;
worldEarth = false;
worldMedi = false;
worldAlien = false;
if (event.target.name == "utilEarthButton")
{
//chosen world variable
worldEarth = true;
utilEarth.y = utilWorldYOn;
changeTheBkg();
changeGameObjects();
}
else if (event.target.name == "utilMediButton")
{
//chosen world variable
worldMedi = true;
utilMedi.y = utilWorldYOn;
changeTheBkg();
changeGameObjects();
}
else if (event.target.name == "utilAlienButton")
{
//chosen world variable
worldAlien = true;
utilAlien.y = utilWorldYOn;
changeTheBkg();
changeGameObjects();
}
utilWorldButtons.utilEarthButton.removeEventListener(MouseEvent.CLICK, changeWorld);
utilWorldButtons.utilMediButton.removeEventListener(MouseEvent.CLICK, changeWorld);
utilWorldButtons.utilAlienButton.removeEventListener(MouseEvent.CLICK, changeWorld);
}
//moves up the world util drop down menu
function worldDropDownRelease(event:Event):void
{
if ((mouseX<725 || mouseX>795) || (mouseY<10 || mouseY>225))
{
//moveUpUtilWorld.start();
utilWorldButtons.utilEarthButton.y = utilWorldBtnYOff;
utilWorldButtons.utilMediButton.y = utilWorldBtnYOff;
utilWorldButtons.utilAlienButton.y = utilWorldBtnYOff;
utilWorldButtons.utilEarthButton.removeEventListener(MouseEvent.CLICK, changeWorld);
utilWorldButtons.utilMediButton.removeEventListener(MouseEvent.CLICK, changeWorld);
utilWorldButtons.utilAlienButton.removeEventListener(MouseEvent.CLICK, changeWorld);
stage.removeEventListener(Event.ENTER_FRAME, worldDropDownRelease);
}
}
function worldDropDown(event:MouseEvent):void
{
utilWorldButtons.utilEarthButton.y = utilWorldBtnYOff;
utilWorldButtons.utilMediButton.y = utilWorldBtnYOff;
utilWorldButtons.utilAlienButton.y = utilWorldBtnYOff;
if (worldEarth)
{
utilWorldButtons.utilMediButton.y = utilWorldBtnY1;
utilWorldButtons.utilMediButton.addEventListener(MouseEvent.CLICK, changeWorld);
utilWorldButtons.utilAlienButton.y = utilWorldBtnY2;
utilWorldButtons.utilAlienButton.addEventListener(MouseEvent.CLICK, changeWorld);
}
else if (worldMedi)
{
utilWorldButtons.utilEarthButton.y = utilWorldBtnY1;
utilWorldButtons.utilEarthButton.addEventListener(MouseEvent.CLICK, changeWorld);
utilWorldButtons.utilAlienButton.y = utilWorldBtnY2;
utilWorldButtons.utilAlienButton.addEventListener(MouseEvent.CLICK, changeWorld);
}
else if (worldAlien)
{
utilWorldButtons.utilMediButton.y = utilWorldBtnY1;
utilWorldButtons.utilMediButton.addEventListener(MouseEvent.CLICK, changeWorld);
utilWorldButtons.utilEarthButton.y = utilWorldBtnY2;
utilWorldButtons.utilEarthButton.addEventListener(MouseEvent.CLICK, changeWorld);
}
dropDownUtilWorld.start();
stage.addEventListener(Event.ENTER_FRAME, worldDropDownRelease);
}
//click on drop downmenu to go to the task portal page
function goToPortalPage(event:MouseEvent):void
{
goToTaskPortalPage();
utilTaskButtons.utilPortal.removeEventListener(MouseEvent.CLICK, goToPortalPage);
taskNotify.dontStartGameButton.removeEventListener(MouseEvent.CLICK, goToPortalPage);
}
//moves up the world util drop down menu
function taskDropDownRelease(event:Event):void
{
if ((mouseX<575 || mouseX>710) || (mouseY<10 || mouseY>225))
{
moveUpUtilTask.start();
utilTaskButtons.utilFeast.removeEventListener(MouseEvent.CLICK, goToFeastPage);
utilTaskButtons.utilPong.removeEventListener(MouseEvent.CLICK, goToPongPage);
utilTaskButtons.utilFlow.removeEventListener(MouseEvent.CLICK, goToFlowPage);
utilTaskButtons.utilLicense.removeEventListener(MouseEvent.CLICK, goToLicensePage);
utilTaskButtons.utilPortal.removeEventListener(MouseEvent.CLICK, goToPortalPage);
stage.removeEventListener(Event.ENTER_FRAME, taskDropDownRelease);
}
}
function taskDropDown(event:MouseEvent):void
{
utilTaskButtons.utilPortal.y = utilTaskBtnYOff;
utilTaskButtons.utilFeast.y = utilTaskBtnYOff;
utilTaskButtons.utilPong.y = utilTaskBtnYOff;
utilTaskButtons.utilFlow.y = utilTaskBtnYOff;
utilTaskButtons.utilExplore.y = utilTaskBtnYOff;
utilTaskButtons.utilLicense.y = utilTaskBtnYOff;
switch (currentPage)
{
case "portalPage" :
utilTaskButtons.utilFeast.y = utilTaskBtnY1;
utilTaskButtons.utilFeast.addEventListener(MouseEvent.CLICK, goToFeastPage);
utilTaskButtons.utilPong.y = utilTaskBtnY2;
utilTaskButtons.utilPong.addEventListener(MouseEvent.CLICK, goToPongPage);
utilTaskButtons.utilFlow.y = utilTaskBtnY3;
utilTaskButtons.utilFlow.addEventListener(MouseEvent.CLICK, goToFlowPage);
utilTaskButtons.utilExplore.y = utilTaskBtnY4;
utilTaskButtons.utilExplore.addEventListener(MouseEvent.CLICK, goToExplorePage);
utilTaskButtons.utilLicense.y = utilTaskBtnY5;
utilTaskButtons.utilLicense.addEventListener(MouseEvent.CLICK, goToLicensePage);
break;
case "pongPage" :
utilTaskButtons.utilFeast.y = utilTaskBtnY1;
utilTaskButtons.utilFeast.addEventListener(MouseEvent.CLICK, goToFeastPage);
utilTaskButtons.utilFlow.y = utilTaskBtnY2;
utilTaskButtons.utilFlow.addEventListener(MouseEvent.CLICK, goToFlowPage);
utilTaskButtons.utilExplore.y = utilTaskBtnY3;
utilTaskButtons.utilExplore.addEventListener(MouseEvent.CLICK, goToExplorePage);
utilTaskButtons.utilLicense.y = utilTaskBtnY4;
utilTaskButtons.utilLicense.addEventListener(MouseEvent.CLICK, goToLicensePage);
utilTaskButtons.utilPortal.y = utilTaskBtnY5;
utilTaskButtons.utilPortal.addEventListener(MouseEvent.CLICK, goToPortalPage);
break;
case "flowPage" :
utilTaskButtons.utilFeast.y = utilTaskBtnY1;
utilTaskButtons.utilFeast.addEventListener(MouseEvent.CLICK, goToFeastPage);
utilTaskButtons.utilPong.y = utilTaskBtnY2;
utilTaskButtons.utilPong.addEventListener(MouseEvent.CLICK, goToPongPage);
utilTaskButtons.utilExplore.y = utilTaskBtnY3;
utilTaskButtons.utilExplore.addEventListener(MouseEvent.CLICK, goToExplorePage);
utilTaskButtons.utilLicense.y = utilTaskBtnY4;
utilTaskButtons.utilLicense.addEventListener(MouseEvent.CLICK, goToLicensePage);
utilTaskButtons.utilPortal.y = utilTaskBtnY5;
utilTaskButtons.utilPortal.addEventListener(MouseEvent.CLICK, goToPortalPage);
break;
case "feastPage" :
utilTaskButtons.utilPong.y = utilTaskBtnY1;
utilTaskButtons.utilPong.addEventListener(MouseEvent.CLICK, goToPongPage);
utilTaskButtons.utilFlow.y = utilTaskBtnY2;
utilTaskButtons.utilFlow.addEventListener(MouseEvent.CLICK, goToFlowPage);
utilTaskButtons.utilExplore.y = utilTaskBtnY3;
utilTaskButtons.utilExplore.addEventListener(MouseEvent.CLICK, goToExplorePage);
utilTaskButtons.utilLicense.y = utilTaskBtnY4;
utilTaskButtons.utilLicense.addEventListener(MouseEvent.CLICK, goToLicensePage);
utilTaskButtons.utilPortal.y = utilTaskBtnY5;
utilTaskButtons.utilPortal.addEventListener(MouseEvent.CLICK, goToPortalPage);
break;
case "licensePage" :
utilTaskButtons.utilFeast.y = utilTaskBtnY1;
utilTaskButtons.utilFeast.addEventListener(MouseEvent.CLICK, goToFeastPage);
utilTaskButtons.utilPong.y = utilTaskBtnY2;
utilTaskButtons.utilPong.addEventListener(MouseEvent.CLICK, goToPongPage);
utilTaskButtons.utilFlow.y = utilTaskBtnY3;
utilTaskButtons.utilFlow.addEventListener(MouseEvent.CLICK, goToFlowPage);
utilTaskButtons.utilExplore.y = utilTaskBtnY4;
utilTaskButtons.utilExplore.addEventListener(MouseEvent.CLICK, goToExplorePage);
utilTaskButtons.utilPortal.y = utilTaskBtnY5;
utilTaskButtons.utilPortal.addEventListener(MouseEvent.CLICK, goToPortalPage);
break;
case "explorePage" :
utilTaskButtons.utilFeast.y = utilTaskBtnY1;
utilTaskButtons.utilFeast.addEventListener(MouseEvent.CLICK, goToFeastPage);
utilTaskButtons.utilPong.y = utilTaskBtnY2;
utilTaskButtons.utilPong.addEventListener(MouseEvent.CLICK, goToPongPage);
utilTaskButtons.utilFlow.y = utilTaskBtnY3;
utilTaskButtons.utilFlow.addEventListener(MouseEvent.CLICK, goToFlowPage);
utilTaskButtons.utilLicense.y = utilTaskBtnY4;
utilTaskButtons.utilLicense.addEventListener(MouseEvent.CLICK, goToLicensePage);
utilTaskButtons.utilPortal.y = utilTaskBtnY5;
utilTaskButtons.utilPortal.addEventListener(MouseEvent.CLICK, goToPortalPage);
break;
}
dropDownUtilTask.start();
stage.addEventListener(Event.ENTER_FRAME, taskDropDownRelease);
}
//brings up the task portal page
function goToTaskPortalPage():void
{
//clear the page: this decides where we're coming from and clears it
clearThePage();
//what is the current background
currentPage = "portalPage";
changeTheBkg();
//check utility variables
utilWorldButton.addEventListener(MouseEvent.MOUSE_OVER, worldDropDown);
utilTaskButton.addEventListener(MouseEvent.MOUSE_OVER, taskDropDown);
utilTaskButtons.y = -300;
//utility subheader
utilSubHeader.utilSubHeaderText.text = "Task Portal";
//header title
headerTitle.headerTitleText.text = "Task Portal";
//remove all of the listeners first
earthTaskSigns.earthPongButton.removeEventListener(MouseEvent.CLICK, goToPongPage);
earthTaskSigns.earthFlowButton.removeEventListener(MouseEvent.CLICK, goToFlowPage);
earthTaskSigns.earthFeastButton.removeEventListener(MouseEvent.CLICK, goToFeastPage);
earthTaskSigns.earthExploreButton.removeEventListener(MouseEvent.CLICK, goToExplorePage);
earthTaskSigns.earthLicenseButton.removeEventListener(MouseEvent.CLICK, goToLicensePage);
mediTaskSigns.mediPongButton.removeEventListener(MouseEvent.CLICK, goToPongPage);
mediTaskSigns.mediFlowButton.removeEventListener(MouseEvent.CLICK, goToFlowPage);
mediTaskSigns.mediFeastButton.removeEventListener(MouseEvent.CLICK, goToFeastPage);
mediTaskSigns.mediExploreButton.removeEventListener(MouseEvent.CLICK, goToExplorePage);
mediTaskSigns.mediLicenseButton.removeEventListener(MouseEvent.CLICK, goToLicensePage);
alienTaskSigns.alienPongButton.removeEventListener(MouseEvent.CLICK, goToPongPage);
alienTaskSigns.alienFlowButton.removeEventListener(MouseEvent.CLICK, goToFlowPage);
alienTaskSigns.alienFeastButton.removeEventListener(MouseEvent.CLICK, goToFeastPage);
alienTaskSigns.alienExploreButton.removeEventListener(MouseEvent.CLICK, goToExplorePage);
alienTaskSigns.alienLicenseButton.removeEventListener(MouseEvent.CLICK, goToLicensePage);
//slide up signs/buttons for each task
if (worldEarth)
{
//chosen world variable
earthTaskSigns.y = 368;
earthTaskSigns.earthPongButton.addEventListener(MouseEvent.CLICK, goToPongPage);
earthTaskSigns.earthFlowButton.addEventListener(MouseEvent.CLICK, goToFlowPage);
earthTaskSigns.earthFeastButton.addEventListener(MouseEvent.CLICK, goToFeastPage);
earthTaskSigns.earthExploreButton.addEventListener(MouseEvent.CLICK, goToExplorePage);
earthTaskSigns.earthLicenseButton.addEventListener(MouseEvent.CLICK, goToLicensePage);
}
else if (worldMedi)
{
//chosen world variable
mediTaskSigns.y = 350;
mediTaskSigns.mediPongButton.addEventListener(MouseEvent.CLICK, goToPongPage);
mediTaskSigns.mediFlowButton.addEventListener(MouseEvent.CLICK, goToFlowPage);
mediTaskSigns.mediFeastButton.addEventListener(MouseEvent.CLICK, goToFeastPage);
mediTaskSigns.mediExploreButton.addEventListener(MouseEvent.CLICK, goToExplorePage);
mediTaskSigns.mediLicenseButton.addEventListener(MouseEvent.CLICK, goToLicensePage);
}
else if (worldAlien)
{
//chosen world variable
alienTaskSigns.y = 347;
alienTaskSigns.alienPongButton.addEventListener(MouseEvent.CLICK, goToPongPage);
alienTaskSigns.alienFlowButton.addEventListener(MouseEvent.CLICK, goToFlowPage);
alienTaskSigns.alienFeastButton.addEventListener(MouseEvent.CLICK, goToFeastPage);
alienTaskSigns.alienExploreButton.addEventListener(MouseEvent.CLICK, goToExplorePage);
alienTaskSigns.alienLicenseButton.addEventListener(MouseEvent.CLICK, goToLicensePage);
}
}
//change text below to next text
function infoBarNextText(event:MouseEvent):void
{
//remove listener for next text
taskInfoBar.rightArrowDark.removeEventListener(MouseEvent.CLICK, infoBarNextText);
taskInfoBar.rightArrowDark.y = 359.25;
//add listener to go back
taskInfoBar.leftArrowDark.addEventListener(MouseEvent.CLICK, infoBarPrevText);
taskInfoBar.leftArrowDark.y = -40.75;
onSecondText = true;
switch (currentPage)
{
case "pongPage" :
taskInfoBar.taskInfoText.text = pongIntroText2;
break;
case "flowPage" :
taskInfoBar.taskInfoText.text = flowIntroText2;
break;
case "explorePage" :
taskInfoBar.taskInfoText.text = exploreIntroText2;
break;
case "feastPage" :
taskInfoBar.taskInfoText.text = feastIntroText2;
break;
case "licensePage" :
taskInfoBar.taskInfoText.text = licenseIntroText2;
break;
default :
}
}
//pgo back to previous text below
function infoBarPrevText(event:MouseEvent):void
{
//add button and listener to go forward
taskInfoBar.rightArrowDark.addEventListener(MouseEvent.CLICK, infoBarNextText);
taskInfoBar.rightArrowDark.y = -40.75;
//remove listener to go forward
taskInfoBar.leftArrowDark.removeEventListener(MouseEvent.CLICK, infoBarPrevText);
taskInfoBar.leftArrowDark.y = 359.25;
onSecondText = false;
switch (currentPage)
{
case "pongPage" :
taskInfoBar.taskInfoText.text = pongIntroText1;
break;
case "flowPage" :
taskInfoBar.taskInfoText.text = flowIntroText1;
break;
case "explorePage" :
taskInfoBar.taskInfoText.text = exploreIntroText1;
break;
case "feastPage" :
taskInfoBar.taskInfoText.text = feastIntroText1;
break;
case "licensePage" :
taskInfoBar.taskInfoText.text = licenseIntroText1;
break;
default :
}
}
//text when game over for all activities
function gameOver():void
{
switch (currentPage)
{
case "pongPage" :
taskNotify.y = 230;
taskNotify.startGameButton.y = 184;
taskNotify.startGameButton.addEventListener(MouseEvent.CLICK, playPongChallenge);
taskNotify.dontStartGameButton.addEventListener(MouseEvent.CLICK, goToPortalPage);
taskNotify.taskNotifyText.text = "Game Over. Your score is " + pongScore + ". Do you want to reach a perfect score? What is perfection to you?";
//taskInfoBar.taskInfoQuestion.text = "Play again?";
//taskInfoBar.taskScore.text = pongScore;
taskNotify.pongInstructions.alpha=0;
stage.removeEventListener(Event.ENTER_FRAME, movePongBall);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, movePaddles);
//taskInfoBar.yesButtonDark.addEventListener(MouseEvent.CLICK, startPongGame);
if (pongScore > 0)
{
pongDone = true;;
}
break;
case "flowPage" :
gameStarted = false;
taskNotify.y = 230;
taskNotify.startGameButton.y = 184;
//taskNotify.taskNotifyText.text = "Play again?";
taskNotify.startGameButton.addEventListener(MouseEvent.CLICK, playFlowAwareness);
taskNotify.dontStartGameButton.addEventListener(MouseEvent.CLICK, goToPortalPage);
if (outOfTime)
{
taskNotify.taskNotifyText.text = "Game Over. You ran out of time. Was it difficult to stay focused? Many gamers will enter the \"Flow\" (a type of focused meditation) during a video game. Try again?";
}
else
{
taskNotify.taskNotifyText.text = "Great! You found the FLOW with " + flowScore + " seconds left to go. That type of focus is called the \"Flow\" and is similar to meditation. Many gamers will enter the \"Flow\" during a video game. Play again?";
flowDone = true;
}
break;
case "explorePage" :
taskNotify.y = 230;
exploreTimer.reset();
taskInfoBar.exploreSolvedButton.y = 500;
taskInfoBar.quitGameButton.y = 500;
taskNotify.exploreEarthRule.y = 1000;
taskNotify.exploreAlienRule.y = 1000;
taskNotify.exploreMediRule.y = 1000;
//removing event listeners
exploreTimer.removeEventListener(TimerEvent.TIMER, showExploreTimer);
exploreTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, timesUpExplore);
taskInfoBar.exploreSolvedButton.removeEventListener(MouseEvent.CLICK, solvedExploreGame);
taskInfoBar.quitGameButton.removeEventListener(MouseEvent.CLICK, goToPortalPage);
for (var i:int = 0; i < exploreObjectMCArray.length; i++)
{
//find the object
var thisExploreObject = objectSpace.getChildByName("exploreObject_"+i);
thisExploreObject.removeEventListener(MouseEvent.CLICK, followTheRules);
objectSpace.removeChild(thisExploreObject);
}//end for loop
exploreObjectMCArray = new Array();
objectSpace.y = 1000;
switch (exploreScore)
{
case 1 :
taskNotify.taskNotifyText.text = "Congratulations! You solved it! This is not mindless entertainment. Sherry Turkle found out that video games teach one how to learn through exploration. Play again?";
exploreTimer.reset();
taskNotify.startGameButton.y = 184;
taskNotify.dontStartGameButton.y = 184;
taskNotify.startGameButton.addEventListener(MouseEvent.CLICK, startExploreGame);
taskNotify.dontStartGameButton.addEventListener(MouseEvent.CLICK, goToPortalPage);
exploreDone = true;
break;
case 0 :
if (outOfTime)
{
taskNotify.taskNotifyText.text = "Game Over. Sorry, but you ran out of time. Try again?";
exploreTimer.reset();
}
else
{
taskNotify.taskNotifyText.text = "Game Over. Sorry, but that wasn't correct. Try again?";
exploreTimer.reset();
}
taskNotify.startGameButton.y = 184;
taskNotify.dontStartGameButton.y = 184;
taskNotify.startGameButton.addEventListener(MouseEvent.CLICK, startExploreGame);
taskNotify.dontStartGameButton.addEventListener(MouseEvent.CLICK, goToPortalPage);
break;
default:
break;
}
break;
case "feastPage" :
//taskNotify.y = 230;
//taskNotify.taskNotifyText.text = "Play again?";
//taskNotify.startGameButton.addEventListener(MouseEvent.CLICK, playAlteredFeast);
//taskNotify.dontStartGameButton.addEventListener(MouseEvent.CLICK, goToPortalPage);
//listen for play/no button
moveUpInfoBar.start();
taskInfoBar.yesButtonDark.addEventListener(MouseEvent.CLICK, playAlteredFeast);
taskInfoBar.noButtonDark.addEventListener(MouseEvent.CLICK, playAlteredFeast);
taskInfoBar.taskScoreTitle.text="";
taskInfoBar.taskScore2.text="";
if (feastScore <= 0)
{
taskInfoBar.taskInfoText.text = "Game Over. You did not survive, but that's okay. Video games allow the player to try things he or she could not do in real life.";
taskInfoBar.taskInfoQuestion.text="Try again?";
}
else
{
taskInfoBar.taskInfoText.text = "Whew! You survived by " + feastScore + "%" + " In video games, players aren't afraid to take risks, and can sometimes get surprising results. This is a great way to learn new ways to do things in the real-world as well.";
taskInfoBar.taskInfoQuestion.text="Play again?";
feastDone = true;
}
//remove all event listenres
break;
case "licensePage" :
//taskNotify.y = 230;
//taskNotify.taskNotifyText.text = "Game Over";
switchLicense.y = 1000;
//remove all event listeners
break;
default :
}
}
//////////PONG
function movePongBall(event:Event)
{
pongBall.rotation += xPongBallMovement;
pongBall.x += xPongBallMovement;
pongBall.y+=yPongBallMovement;
if (pongBall.x>(pongTable.x + pongTable.width))
{
if ((pongBall.y < rightPaddle.y + 85)&& (pongBall.y > rightPaddle.y - 85))
{
pongBall.x = (pongTable.x + pongTable.width);
xPongBallMovement=xPongBallMovement*1.2;
yPongBallMovement=yPongBallMovement*1.5;
xPongBallMovement=- xPongBallMovement;
pongScore+=10;
taskInfoBar.taskScore.text=pongScore;
}
else
{
xPongBallMovement=0;
yPongBallMovement=0;
gameOver();
}
}
if (pongBall.x leftPaddle.y - 85))
{
pongBall.x=pongTable.x;
xPongBallMovement=xPongBallMovement*1.2;
yPongBallMovement=yPongBallMovement*1.5;
xPongBallMovement=- xPongBallMovement;
pongScore+=10;
taskInfoBar.taskScore.text=pongScore;
}
else
{
xPongBallMovement=0;
yPongBallMovement=0;
gameOver();
}
}
if (pongBall.y>(pongTable.y + pongTable.height)-pongBall.height/4)
{
pongBall.y = (pongTable.y + pongTable.height)-pongBall.height/4;
yPongBallMovement=- yPongBallMovement;
}
if (pongBall.ypongTable.y)
{
rightPaddle.y-=paddleSpeed;
}
break;
case 82 :
//left paddle up - r
if (leftPaddle.y>pongTable.y)
{
leftPaddle.y-=paddleSpeed;
}
break;
case 74 :
//right paddle down - j
if (rightPaddle.y= 0)
{
randomRed = red1;
}
else
{
randomRed = red2;
}
signNum= (Math.random() * 2) - 2;
if(signNum >= 0)
{
randomGreen = green1;
}
else
{
randomGreen = green2;
}
signNum = (Math.random() * 2) - 2;
if(signNum >= 0)
{
randomBlue = blue1;
}
else
{
randomBlue = blue2;
}*/
randomRed = (Math.ceil(Math.random() * 300) - 150);
randomGreen = (Math.ceil(Math.random() * 300) - 150);
randomBlue = (Math.ceil(Math.random() * 300) - 150);
break;
case 3:
randomYShort = (Math.random());
randomXWide = (Math.random()*1)+ 1;
randomXNarrow = (Math.random());
randomYLong = (Math.random()*1)+ 1;
/*red1 = (Math.ceil(Math.random() * 105) +150);
green1 = (Math.ceil(Math.random() * 105) +150);
blue1 = (Math.ceil(Math.random() * 105) +150);
red2= (Math.ceil(Math.random() * 105) -255);
green2 = (Math.ceil(Math.random() * 105) -255);
blue2= (Math.ceil(Math.random() * 105) -255);
signNum = (Math.random() * 4) - 2;
if(signNum >= 0)
{
randomRed = red1;
}
else
{
randomRed = red2;
}
signNum= (Math.random() * 2) - 2;
if(signNum >= 0)
{
randomGreen = green1;
}
else
{
randomGreen = green2;
}
signNum = (Math.random() * 2) - 2;
if(signNum >= 0)
{
randomBlue = blue1;
}
else
{
randomBlue = blue2;
}*/
randomRed = (Math.ceil(Math.random() * 510) - 255);
randomGreen = (Math.ceil(Math.random() * 510) - 255);
randomBlue = (Math.ceil(Math.random() * 510) - 255);
break;
default:
break;
}
trace("randomXWide is " + randomXWide);
trace("randomYShort is " + randomYShort);
trace("randomYLong is " + randomYLong);
trace("randomXNarrow is " + randomXNarrow);
trace("randomRed is " + randomRed);
trace("randomGreen is " + randomGreen);
trace("randomBlue is " + randomBlue);
//do the change
//get the percentage
if (worldEarth)
{
feastAvatar.scaleX *= randomXWide;
feastAvatar.scaleY *= randomYShort;
percentage = Math.floor( ( (randomXWide + randomYShort) /6) * 100);
}
else if (worldMedi)
{
feastAvatar.scaleX = randomXNarrow;
feastAvatar.scaleY = randomYLong;
percentage = Math.floor( ( (randomXNarrow + randomYLong) /6) * 100);
}
else if (worldAlien)
{
//creates a color transform
var avatarTransform=new ColorTransform(1,1,1,1,randomRed,randomGreen,randomBlue,0);
//goes through all the children of feastAvatar
feastAvatar.transform.colorTransform = avatarTransform;
var ran1:Number = Math.abs(randomRed);
var ran2:Number = Math.abs(randomGreen);
var ran3:Number = Math.abs(randomBlue);
var avg:Number = (ran1 + ran2 + ran3)/3;
trace("ran1 is " + ran1);
trace("ran2 is " + ran2);
trace("ran3 is " + ran3);
trace("avg is " + avg);
if(avg>100)
{
percentage = ( (Math.floor(avg))/255)* 100;
}
else
{
percentage = ( (Math.floor(avg))/255)* 100;
}
}
trace("percentage is " + percentage);
return percentage;
}
//start the feast game
function startFeastGame(event:MouseEvent):void
{
taskNotify.startGameButton.removeEventListener(MouseEvent.CLICK, startFeastGame);
taskNotify.dontStartGameButton.removeEventListener(MouseEvent.CLICK, goToPortalPage);
taskNotify.y=800;
//listeners for reset and quit
//taskInfoBar.resetAvatarButton.addEventListener(MouseEvent.CLICK, resetAvatar);
//taskInfoBar.quitGameButton.addEventListener(MouseEvent.CLICK, goToPortalPage);
//listen for foods
feastLayout.feast1Right.addEventListener(MouseEvent.CLICK, goToSecondFeast);
feastLayout.feast1Left.addEventListener(MouseEvent.CLICK, goToSecondFeast);
//currentFeastChar.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
feastScore = 100;
//trace(feastLayout.feast1Right.x);
}
//play altered feast game
function playAlteredFeast(event:MouseEvent):void
{
//remove start listener
taskInfoBar.noButtonDark.removeEventListener(MouseEvent.CLICK, playAlteredFeast);
taskInfoBar.yesButtonDark.removeEventListener(MouseEvent.CLICK, playAlteredFeast);
//remove arrows and listeners
taskInfoBar.leftArrowDark.y=359.25;
taskInfoBar.rightArrowDark.y=359.25;
if (onSecondText)
{
taskInfoBar.leftArrowDark.removeEventListener(MouseEvent.CLICK, infoBarPrevText);
}
else
{
taskInfoBar.rightArrowDark.removeEventListener(MouseEvent.CLICK, infoBarNextText);
}
//do you play or not?
switch (event.target.name)
{
case "yesButtonDark" :
//bring down the layout
feastLayout.y=606.2;
//bring down the two foods
feastLayout.feast1Right.y=-161.1;
feastLayout.feast1Left.y=-161.1;
feastLayout.feast2Right.y=-900;
feastLayout.feast2Left.y=-900;
feastLayout.feast3Right.y=-900;
feastLayout.feast3Left.y=-900;
feastLayout.feast1Right.buttonMode=true;
feastLayout.feast1Left.buttonMode=true;
feastLayout.feast2Right.buttonMode=true;
feastLayout.feast2Left.buttonMode=true;
feastLayout.feast3Right.buttonMode=true;
feastLayout.feast3Left.buttonMode=true;
feastMask.y=337.1;
feastAvatar.x = 450;
feastAvatar.y = 338.5;
//clear feastAvatars alters
feastAvatar.scaleX = 1;
feastAvatar.scaleY = 1;
var resetTransform:ColorTransform = new ColorTransform();
feastAvatar.transform.colorTransform = resetTransform;
feastAvatar.gotoAndStop(currentChar);
//start game?
taskNotify.taskNotifyText.text=feastInstructions;
//taskInfoBar.taskInfoQuestion.text = "Try the feast?";
taskNotify.dontStartGameButton.y=184;
taskNotify.startGameButton.y=184;
taskInfoBar.y=663;
taskNotify.y=230;
//clear text
taskInfoBar.taskInfoText.text=" ";
taskInfoBar.taskScoreTitle.text="SURVIVAL RATE:";
taskInfoBar.taskScore2.text=feastScore+"%";
taskNotify.startGameButton.addEventListener(MouseEvent.CLICK, startFeastGame);
taskNotify.dontStartGameButton.addEventListener(MouseEvent.CLICK, goToPortalPage);
//taskInfoBar.resetAvatarButton.y=-38.6;
//taskInfoBar.quitGameButton.y=-38.6;
break;
case "noButtonDark" :
goToTaskPortalPage();
break;
default :
}
}
//brings up the Altered Feast page
function goToFeastPage(event:MouseEvent):void
{
//clear the page: this decides where we're coming from and clears it
clearThePage();
//chaanges the mirror and tables
if (worldEarth)
{
feastMask.gotoAndStop("earth");
feastLayout.feastMirror.gotoAndStop("earth");
feastLayout.feastTableLeft.gotoAndStop("earth");
feastLayout.feastTableRight.gotoAndStop("earth");
feastLayout.feast1Right.gotoAndStop("earth");
feastLayout.feast2Right.gotoAndStop("earth");
feastLayout.feast3Right.gotoAndStop("earth");
feastLayout.feast1Left.gotoAndStop("earth");
feastLayout.feast2Left.gotoAndStop("earth");
feastLayout.feast3Left.gotoAndStop("earth");
}
else if (worldMedi)
{
feastMask.gotoAndStop("medi");
feastLayout.feastMirror.gotoAndStop("medi");
feastLayout.feastTableLeft.gotoAndStop("medi");
feastLayout.feastTableRight.gotoAndStop("medi");
feastLayout.feast1Right.gotoAndStop("medi");
feastLayout.feast2Right.gotoAndStop("medi");
feastLayout.feast3Right.gotoAndStop("medi");
feastLayout.feast1Left.gotoAndStop("medi");
feastLayout.feast2Left.gotoAndStop("medi");
feastLayout.feast3Left.gotoAndStop("medi");
}
else if (worldAlien)
{
feastMask.gotoAndStop("alien");
feastLayout.feastMirror.gotoAndStop("alien");
feastLayout.feastTableLeft.gotoAndStop("alien");
feastLayout.feastTableRight.gotoAndStop("alien");
feastLayout.feast1Right.gotoAndStop("alien");
feastLayout.feast2Right.gotoAndStop("alien");
feastLayout.feast3Right.gotoAndStop("alien");
feastLayout.feast1Left.gotoAndStop("alien");
feastLayout.feast2Left.gotoAndStop("alien");
feastLayout.feast3Left.gotoAndStop("alien");
}
//what is the current background
currentPage="feastPage";
changeTheBkg();
//utility subheader
utilSubHeader.utilSubHeaderText.text="Altered Feast";
//header title
headerTitle.headerTitleText.text="Altered Feast";
//slide up intro information
moveUpInfoBar.start();
taskInfoBar.taskInfoText.text=feastIntroText1;
taskInfoBar.taskInfoQuestion.text="Do you want to play?";
//read the next text at the bottom
taskInfoBar.rightArrowDark.addEventListener(MouseEvent.CLICK, infoBarNextText);
taskInfoBar.leftArrowDark.y=359.25;
taskInfoBar.rightArrowDark.y=-40.75;
//listen for play/no button
taskInfoBar.yesButtonDark.addEventListener(MouseEvent.CLICK, playAlteredFeast);
taskInfoBar.noButtonDark.addEventListener(MouseEvent.CLICK, playAlteredFeast);
utilTaskButtons.utilFeast.removeEventListener(MouseEvent.CLICK, goToFeastPage);
utilTaskButtons.y=-300;
}
//////////EXPLORE
function showExploreTimer(event:TimerEvent):void
{
if ((exploreTimer.repeatCount - exploreTimer.currentCount) < 10)
{
taskInfoBar.taskScore2.text = "0:0" + (exploreTimer.repeatCount - exploreTimer.currentCount);
}
else
{
taskInfoBar.taskScore2.text = "0:" + (exploreTimer.repeatCount - exploreTimer.currentCount);
}
}
function timesUpExplore(event:TimerEvent):void
{
outOfTime=true;
gameOver();
}
//follow the rules in the explore game
function followTheRules(event:MouseEvent):void
{
if (worldEarth)
{
event.target.x+=10;
}
else if (worldMedi)
{
event.target.x-=10;
}
else if (worldAlien)
{
event.target.y+=10;
}
}
//check to see if the rules are right
function checkExploreAnswer(event:MouseEvent):void
{
taskNotify.startGameButton.y=784;
taskNotify.dontStartGameButton.y=784;
//remove listeners
taskNotify.exploreEarthRule.removeEventListener(MouseEvent.CLICK, checkExploreAnswer);
taskNotify.exploreAlienRule.removeEventListener(MouseEvent.CLICK, checkExploreAnswer);
taskNotify.exploreMediRule.removeEventListener(MouseEvent.CLICK, checkExploreAnswer);
trace(event.target.name);
trace("earth: " + worldEarth + ", Alien: " + worldAlien + ", medi: " + worldMedi);
if (((event.target.name == "exploreEarthRule") && worldEarth) || ((event.target.name == "exploreAlienRule") && worldAlien) ||((event.target.name == "exploreMediRule") && worldMedi))
{
//you are right
exploreScore=1;
gameOver();
}
else
{
//you are wrong
exploreScore=0;
gameOver();
}
}
//check to see if the rules are right
function solvedExploreGame(event:MouseEvent):void
{
taskNotify.y=230;
//notes
taskNotify.taskNotifyText.text="The rule that governs this world is: ";
taskNotify.exploreEarthRule.y=49.8;
taskNotify.exploreAlienRule.y=76.5;
taskNotify.exploreMediRule.y=103.2;
//check to see if it is right?
taskNotify.exploreEarthRule.addEventListener(MouseEvent.CLICK, checkExploreAnswer);
taskNotify.exploreAlienRule.addEventListener(MouseEvent.CLICK, checkExploreAnswer);
taskNotify.exploreMediRule.addEventListener(MouseEvent.CLICK, checkExploreAnswer);
//remove evetn listeners
taskInfoBar.exploreSolvedButton.removeEventListener(MouseEvent.CLICK, solvedExploreGame);
taskInfoBar.quitGameButton.removeEventListener(MouseEvent.CLICK, goToPortalPage);
taskNotify.startGameButton.y = 1840;
taskNotify.dontStartGameButton.y = 1840;
}
//begin the game
function startExploreGame(event:MouseEvent):void
{
taskNotify.startGameButton.removeEventListener(MouseEvent.CLICK, startExploreGame);
taskNotify.dontStartGameButton.removeEventListener(MouseEvent.CLICK, goToPortalPage);
//set up the timer
exploreTimer.addEventListener(TimerEvent.TIMER, showExploreTimer);
exploreTimer.addEventListener(TimerEvent.TIMER_COMPLETE, timesUpExplore);
//starts the timer
exploreTimer.reset();
exploreTimer.start();
outOfTime=false;
taskInfoBar.exploreSolvedButton.y=-38.6;
taskInfoBar.quitGameButton.y=-38.6;
taskNotify.startGameButton.y=184;
taskNotify.dontStartGameButton.y=184;
taskInfoBar.y=663;
taskInfoBar.exploreSolvedButton.addEventListener(MouseEvent.CLICK, solvedExploreGame);
taskInfoBar.quitGameButton.addEventListener(MouseEvent.CLICK, goToPortalPage);
for (var i:int = 0; i < exploreObjectMCArray.length; i++)
{
//find the object
var thisExploreObject = objectSpace.getChildByName("exploreObject_"+i);
//listen for movement
thisExploreObject.addEventListener(MouseEvent.CLICK, followTheRules);
thisExploreObject.buttonMode = true;
thisExploreObject.mouseChildren = false;
}
taskNotify.y=800;
}
//play opne exploration page
function playOpenExploration(event:MouseEvent):void
{
//remove start listener
taskInfoBar.yesButtonDark.removeEventListener(MouseEvent.CLICK, playOpenExploration);
taskInfoBar.noButtonDark.removeEventListener(MouseEvent.CLICK, playOpenExploration);
//remove arrows and listeners
taskInfoBar.leftArrowDark.y=359.25;
taskInfoBar.rightArrowDark.y=359.25;
if (onSecondText)
{
taskInfoBar.leftArrowDark.removeEventListener(MouseEvent.CLICK, infoBarPrevText);
}
else
{
taskInfoBar.rightArrowDark.removeEventListener(MouseEvent.CLICK, infoBarNextText);
}
//do you play or not?
switch (event.target.name)
{
case "yesButtonDark" :
//bring in the objects
//resetExploreObjects();
exploreObjectMCArray = new Array();
exploreObjectXArray=[160,340,525,730,230,420,620,160,340,525,730];
exploreObjectYArray=[240,240,240,240,395,395,395,515,515,515,515];
//assign the fireballs a random number and random-ish position
for (var i:int = 0; i < 11; i++)
{
//adjusts the position in the position arrays
//the math is to get a random number between -8 and 7
exploreObjectXArray[i] += ((Math.random() * 15) - 8 );
exploreObjectXArray[i] += ((Math.random() * 15) - 8 );
var exploreObject:ExploreObject = new ExploreObject;
exploreObject.earthGroup.alpha = 0;
exploreObject.alienGroup.alpha = 0;
exploreObject.mediGroup.alpha = 0;
//trace("what's up?");
//get the right world
if (worldEarth)
{
exploreObject.earthGroup.alpha = 1;
}
else if (worldMedi)
{
exploreObject.mediGroup.alpha = 1;
}
else if (worldAlien)
{
exploreObject.alienGroup.alpha = 1;
}
//randomize which object is shown by its location
var ranNum:Number = (Math.floor((Math.random() * 11)) + 1 );
trace("what's up? " + ranNum);
exploreObject.earthGroup.gotoAndStop(ranNum);
exploreObject.mediGroup.gotoAndStop(ranNum);
exploreObject.alienGroup.gotoAndStop(ranNum);
//position it
exploreObject.x = exploreObjectXArray[i];
exploreObject.y = exploreObjectYArray[i];
//rotate : get a random number between -15 and 15
exploreObject.rotation = ((Math.random() * 30) - 15 );
exploreObjectMCArray.push(exploreObject);
exploreObject.name = "exploreObject_"+i;
//add it to the stage
objectSpace.addChild(exploreObject);
}
taskInfoBar.y=663;
taskNotify.y=230;
//keeps everything in right layer
objectSpace.x = 0;
objectSpace.y = 0;
//start game
taskNotify.taskNotifyText.text=exploreInstructions;
taskInfoBar.taskInfoText.text=" ";
//taskInfoBar.taskInfoQuestion.text = "Begin Exploring?";
taskInfoBar.taskScoreTitle.text="TIME REMAINING:";
taskInfoBar.taskScore2.text="0:30";
taskNotify.dontStartGameButton.y=184;
taskNotify.startGameButton.y=184;
taskNotify.startGameButton.addEventListener(MouseEvent.CLICK, startExploreGame);
taskNotify.dontStartGameButton.addEventListener(MouseEvent.CLICK, goToPortalPage);
taskInfoBar.exploreSolvedButton.y=-38.6;
taskInfoBar.quitGameButton.y=-38.6;
break;
case "noButtonDark" :
goToTaskPortalPage();
break;
default :
}
}
//brings up the Open Exploration page
function goToExplorePage(event:MouseEvent):void
{
//clear the page: this decides where we're coming from and clears it
clearThePage();
//what is the current background
currentPage="explorePage";
changeTheBkg();
//utility subheader
utilSubHeader.utilSubHeaderText.text="Open Exploration";
//header title
headerTitle.headerTitleText.text="Open Exploration";
//slide up intro information
moveUpInfoBar.start();
taskInfoBar.taskInfoText.text=exploreIntroText1;
taskInfoBar.taskInfoQuestion.text="Do you want to play?";
//read the next text at the bottom
taskInfoBar.rightArrowDark.addEventListener(MouseEvent.CLICK, infoBarNextText);
taskInfoBar.leftArrowDark.y=359.25;
taskInfoBar.rightArrowDark.y=-40.75;
//listen for play/no button
taskInfoBar.yesButtonDark.addEventListener(MouseEvent.CLICK, playOpenExploration);
taskInfoBar.noButtonDark.addEventListener(MouseEvent.CLICK, playOpenExploration);
utilTaskButtons.utilExplore.removeEventListener(MouseEvent.CLICK, goToExplorePage);
utilTaskButtons.y=-300;
}
//////////LICENSE REGISTRATION
//creates the license to be printed
function createLicense(event:MouseEvent):void
{
var pdfURL:String = "http://www.doubleinfusion.com/switch/pdf/switch_license_";
pdfURL += currentChar.toLowerCase();
pdfURL += ".pdf";
var pdfRequest:URLRequest = new URLRequest(pdfURL);
navigateToURL(pdfRequest, "_blank");
}
//open license registration form
function openLicenseRegistration(event:MouseEvent):void
{
//remove start listener
taskInfoBar.yesButtonDark.removeEventListener(MouseEvent.CLICK, openLicenseRegistration);
taskInfoBar.noButtonDark.removeEventListener(MouseEvent.CLICK, openLicenseRegistration);
taskInfoBar.y = 725;
//remove arrows and listeners
taskInfoBar.leftArrowDark.y=359.25;
taskInfoBar.rightArrowDark.y=359.25;
if (onSecondText)
{
taskInfoBar.leftArrowDark.removeEventListener(MouseEvent.CLICK, infoBarPrevText);
}
else
{
taskInfoBar.rightArrowDark.removeEventListener(MouseEvent.CLICK, infoBarNextText);
}
//do you play or not?
switch (event.target.name)
{
case "yesButtonDark" :
taskNotify.startGameButton.y = 1000;
if(pongDone && flowDone && feastDone && exploreDone)
{
//use feastAvatar as the avatar in the license
feastMask.y=337.1;
feastMask.gotoAndStop("license");
feastAvatar.x = 470;
feastAvatar.y = 310;
//clear feastAvatars alters
feastAvatar.scaleX = 1;
feastAvatar.scaleY = 1;
var resetTransform:ColorTransform = new ColorTransform();
feastAvatar.transform.colorTransform = resetTransform;
feastAvatar.gotoAndStop(currentChar);
//bring in the objects
switchLicense.x=593;
switchLicense.y=353;
switchLicense.licenseTextField.text="Thank you for playing Switch." + "\n" + "Choose your avatar to create your license. A PDF form will open up for you to fill out and print.";
switchLicense.createButton.addEventListener(MouseEvent.CLICK, createLicense);
taskNotify.y=2300;
}
else
{
taskNotify.y=230;
taskNotify.taskNotifyText.text=noLicenseYetText;
taskNotify.dontStartGameButton.addEventListener(MouseEvent.CLICK, goToPortalPage);
}
break;
case "noButtonDark" :
taskInfoBar.noButtonDark.removeEventListener(MouseEvent.CLICK, openLicenseRegistration);
//taskInfoBar.yesButtonDark.removeEventListener(MouseEvent.CLICK, startExploreGame);
goToTaskPortalPage();
break;
default :
}
}
//brings up the License Registration page
function goToLicensePage(event:MouseEvent):void
{
//clear the page: this decides where we're coming from and clears it
clearThePage();
//what is the current background
currentPage="licensePage";
changeTheBkg();
//utility subheader
utilSubHeader.utilSubHeaderText.text="License Registration";
//header title
headerTitle.headerTitleText.text="License Registration";
//slide up intro information
moveUpInfoBar.start();
taskInfoBar.taskInfoText.text=licenseIntroText1;
taskInfoBar.taskInfoQuestion.text="Do you want to create one?";
//read the next text at the bottom
taskInfoBar.rightArrowDark.addEventListener(MouseEvent.CLICK, infoBarNextText);
taskInfoBar.leftArrowDark.y=359.25;
taskInfoBar.rightArrowDark.y=-40.75;
//listen for play/no button
taskInfoBar.yesButtonDark.addEventListener(MouseEvent.CLICK, openLicenseRegistration);
taskInfoBar.noButtonDark.addEventListener(MouseEvent.CLICK, openLicenseRegistration);
//utilTaskButtons.utilLicense.removeEventListener(MouseEvent.CLICK, goToLicensePage);
utilTaskButtons.y=-300;
}
}//end class
}//end package