Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(!isObject(EnemyMcGeeManagerBehavior))
- {
- %template = new BehaviorTemplate(EnemyMcGeeManagerBehavior);
- %template.friendlyName = "EnemyMcGeeManagerBehavior";
- %template.description = "EnemyMcGeeManagerBehavior";
- %template.behaviorType = "Enemy Manager Behavior";
- %template.addBehaviorField(Chip, "", object, "Chip", t2dSceneObject);
- %template.addBehaviorField(enemy, "", object, "enemy", t2dSceneObject);
- %template.addBehaviorField(strawberry, "", object, "strawberry", t2dSceneObject);
- //readyStartGo
- %template.addBehaviorField(readyStartGo, "", object, "readyStartGo", t2dSceneObject);
- ///timerBar
- %template.addBehaviorField(timerBar, "", object, "timerBar", t2dSceneObject);
- ///timesUp
- %template.addBehaviorField(timesUp, "", object, "timesUp", t2dSceneObject);
- %template.addBehaviorField(vs, "", object, "vs", t2dSceneObject);
- }
- function EnemyMcGeeManagerBehavior::onLevelLoaded(%this)
- {
- $s1L1 = true;
- $s1L1Prize = 50;
- $s1L2 = false;
- $s1L3 = false;
- %this.owner.enableUpdateCallback();
- %this.createEnemy();
- %this.schedule(1000, echoFind);
- $dummyEChip = %this.dummyEChip;
- $EnemyOutOfChips = false;
- //a gauge to make sure no enemy chips are doubled up in creation.
- $newEnemyChipCreated = false;
- $gameIsUp = false;
- $BirdInAction = true;
- $GameOn = false;
- ///callls round intros, countdown etc
- %this.schedule(2000, readyStartGo0);
- $readyStartGo = %this.readyStartGo;
- $vs = %this.vs;
- ////timer function and objects
- ///%this.timer();
- $timerBar = %this.timerBar;
- $timesUp = %this.timesUp;
- ///this, the chipInAnee, is created here. as it is a perment fixture in the game.
- ///previously created always on create new chip.
- $EnemyChipInAnee = new t2dAnimatedSprite(EnemyChipInAnee)
- {
- scenegraph = %this.owner.scenegraph;
- animationName = "chipInAneeAnimation";
- mUseSourceRect = "0";
- sourceRect = "0 0 0 0";
- canSaveDynamicFields = "1";
- layer = "31";
- Position = "-134.322 -82.357";
- size = "18.270 36.540";
- usesPhysics = "0";
- CollisionActiveSend = "0";
- CollisionActiveReceive = "0";
- CollisionPhysicsSend = "0";
- CollisionCallback = "0";
- CollisionCircleScale = "0.1";
- CollisionMaxIterations = "0";
- BlendColor = "0.000000 0.815686 0.070588 1.000000";
- MountOwned = "0";
- MountInheritAttributes = "0";
- mountID = "41";
- mountToID = "40";
- group = 27;
- };
- }
- function EnemyMcGeeManagerBehavior::echoFind(%this)
- {
- echo(":::: ::: :: : : : :: ::: ::::");
- echo("$Bank " @ $Bank );
- echo(":::: ::: :: : : : :: ::: ::::.....");
- %this.schedule(1000, echoFind);
- }
- ////THIS IS THE READYSTARTGO!!!!
- function EnemyMcGeeManagerBehavior::readyStartGo0(%this)
- {
- ///manage, set readySartGo
- %this.vs.setLayer(10);
- %this.readyStartGo.setLayer(1);
- %this.readyStartGo.setFrame(0);
- %this.schedule(1500, readySartGo1);
- ///turn Chip's controls off
- $noControl = true;
- $Enemy.setFlipX(false);
- echo("in the VS shiiiitttt");
- }
- function EnemyMcGeeManagerBehavior::readySartGo1(%this)
- {
- %this.readyStartGo.setFrame(1);
- %this.schedule(1500, readySartGo2);
- }
- function EnemyMcGeeManagerBehavior::readySartGo2(%this)
- {
- %this.vs.setLayer(31);
- %this.readyStartGo.setFrame(2);
- %this.schedule(1000, readySartGo3);
- $GameOn = true;
- $noControl = false;
- %this.goToPickUp();
- %this.timer();
- }
- function EnemyMcGeeManagerBehavior::readySartGo3(%this)
- {
- %this.readyStartGo.setFrame(0);
- %this.readyStartGo.setLayer(31);
- $EnemyWalking = true;
- $EnemyWalkingLeft = true;
- }
- function EnemyMcGeeManagerBehavior::goToPickUp(%this)
- {
- echo("GO TO PCIK UP!!!!!!!");
- $EnemyMounted = false;
- $EnemyWalkingLeft = true;
- $EnemyWalking = true;
- $EnemyChangeState =true;
- $CreateNewEnemyChip = true;
- $newEnemyChip = 0;
- $ChipChangeState = true;
- $createNewChip = true;
- return;
- }
- ///TIMER
- function EnemyMcGeeManagerBehavior::timer(%this)
- {
- if($gameIsUp == true)
- {
- $timerValue = 0;
- ///echo("timer is returned because game is up");
- return;
- }
- $timerValue = $timerValue + 1;
- echo("$timerValue " @ $timerValue);
- echo("...");
- echo("..");
- echo(".");
- $timerBarSize = $timerBar.size;
- %newX = $timerBarSize.x - (0.75);
- %newY = $timerBarSize.y;
- $timerBar.size = %newX SPC %newY;
- if($timerValue >= 120)
- {
- $timesUp.setLayer(1);
- ///delete any extra chips
- for(%i = 0; %i < %this.owner.scenegraph.getCount(); %i++)
- {
- %currentObject = %this.owner.scenegraph.getObject(%i);
- if(%currentObject.group == 27)
- {
- %currentObject.safeDelete();
- }
- }
- $timerValue = 0;
- %this.schedule(2000, callUpWinnerLoser);
- return;
- }
- ///%this.schedule(1000, timer);
- }
- ////WINNER LOSER TITLES AT END ROUND
- function EnemyMcGeeManagerBehavior::callUpWinnerLoser(%this)
- {
- $noControl = true;
- %ChipPos = $Chip.Position;
- $ChipWinnerLoser.setPosition(%ChipPos.x + 20 SPC %ChipPos.y + 15);
- %EnemyPos = $Enemy.position;
- $EnemyWinnerLoser.setPosition(%EnemyPos.x + 20 SPC %EnemyPos.y + 30);
- if($ChipScore > $EnemyScore)
- {
- $ChipWinnerLoser.setLayer(1);
- $ChipWinnerLoser.setFrame(0);
- $EnemyWinnerLoser.setLayer(1);
- $EnemyWinnerLoser.setFrame(1);
- }
- else if($ChipScore < $EnemyScore)
- {
- $ChipWinnerLoser.setLayer(1);
- $ChipWinnerLoser.setFrame(1);
- $EnemyWinnerLoser.setLayer(1);
- $EnemyWinnerLoser.setFrame(0);
- }
- else if($ChipScore == $EnemyScore)
- {
- $ChipWinnerLoser.setLayer(1);
- $ChipWinnerLoser.setFrame(1);
- $EnemyWinnerLoser.setLayer(1);
- $EnemyWinnerLoser.setFrame(1);
- }
- echo("Should have set all winner loser images");
- echo("%this.ChipWinnerLoser.position " @ %this.ChipWinnerLoser.position);
- echo("%this.ChipWinnerLoser " @ %this.ChipWinnerLoser.position);
- echo("kkkkkkkkkkkkkkkk");
- %this.schedule(3000, callWinTaskScreen);
- return;
- }
- function EnemyMcGeeManagerBehavior::createEnemy(%this)
- {
- $createNewEnemy = false;
- ///delete any extra chips
- for(%i = 0; %i < %this.owner.scenegraph.getCount(); %i++)
- {
- %currentObject = %this.owner.scenegraph.getObject(%i);
- if(%currentObject.group == 4)
- {
- %currentObject.safeDelete();
- }
- }
- $level_MrMan = true;
- if($level_McGee == true)
- {
- $Enemy = new t2dAnimatedSprite(enemy) {
- animationName = "McGeeStandAnimation";
- scenegraph = %this.owner.scenegraph;
- mUseSourceRect = "0";
- sourceRect = "0 0 0 0";
- canSaveDynamicFields = "1";
- UseMouseEvents = "1";
- usesPhysics = "1";
- size = "105.236 210.472";
- position = "-65 -87.811";
- Layer = "10";
- class = "enemyClass";
- CollisionActiveReceive = "1";
- CollisionActiveSend = "1";
- CollisionPhysicsReceive = "0";
- CollisionPhysicsSend = "0";
- CollisionCallback = "1";
- CollisionMaxIterations = "3";
- WorldLimitMode = "CLAMP";
- WorldLimitMin = "-157.993 -1813.661";
- WorldLimitMax = "141.314 1556.239";
- WorldLimitCallback = "1";
- mountID = "2";
- CollisionPolyList = "-0.260 -0.015 0.250 -0.005 0.285 0.270 -0.147 0.275";
- _behavior0 = "EnemyBehavior";
- group = 4;
- };
- $EnemyVelocity = 45;
- }
- if($level_Dunn == true)
- {
- $Enemy = new t2dAnimatedSprite(enemy) {
- animationName = "DunnStandAnimation";
- scenegraph = %this.owner.scenegraph;
- mUseSourceRect = "0";
- sourceRect = "0 0 0 0";
- canSaveDynamicFields = "1";
- UseMouseEvents = "1";
- usesPhysics = "1";
- size = "104.858 209.715";
- position = "-65 -110.141";
- Layer = "5";
- class = "enemyClass";
- CollisionActiveReceive = "1";
- CollisionActiveSend = "1";
- CollisionPhysicsReceive = "0";
- CollisionPhysicsSend = "0";
- CollisionCallback = "1";
- CollisionMaxIterations = "3";
- WorldLimitMode = "CLAMP";
- WorldLimitMin = "-157.993 -1813.661";
- WorldLimitMax = "141.314 1556.239";
- WorldLimitCallback = "1";
- mountID = "2";
- CollisionPolyList = "-0.260 -0.015 0.250 -0.005 0.403 0.599 -0.319 0.629";
- _behavior0 = "EnemyBehavior";
- group = 4;
- };
- $EnemyVelocity = 25;
- }
- if($level_MrMan == true)
- {
- $Enemy = new t2dAnimatedSprite(enemy) {
- animationName = "MrManStandAnimation";
- scenegraph = %this.owner.scenegraph;
- mUseSourceRect = "0";
- sourceRect = "0 0 0 0";
- canSaveDynamicFields = "1";
- UseMouseEvents = "1";
- usesPhysics = "1";
- size = "182.477 182.477";
- position = "-65 -116.141";
- Layer = "5";
- class = "enemyClass";
- CollisionActiveReceive = "1";
- CollisionActiveSend = "1";
- CollisionPhysicsReceive = "0";
- CollisionPhysicsSend = "0";
- CollisionCallback = "1";
- CollisionMaxIterations = "3";
- WorldLimitMode = "CLAMP";
- WorldLimitMin = "-157.993 -1813.661";
- WorldLimitMax = "141.314 1556.239";
- WorldLimitCallback = "1";
- mountID = "2";
- CollisionPolyList = "-0.260 -0.015 0.250 -0.005 0.403 0.599 -0.319 0.629";
- _behavior0 = "EnemyBehavior";
- group = 4;
- };
- $EnemyVelocity = 25;
- }
- ///\\\||
- /////\\\|||
- ///May be a useless variable
- ///set Chips win count to 0
- $s1L1ChipWinCount = 0;
- $s1L1EnemyWinCount = 0;
- }
- function EnemyMcGeeManagerBehavior::onUpdate(%this)
- {
- if($beginTimer == true)
- {
- $beginTimer = false;
- %this.timer();
- }
- ///this tells the engine to create a new enemy and begin the match.
- if($loadNewRound == true)
- {
- $loadNewRound = false;
- %this.readyStartGo0();
- %this.createEnemy();
- return;
- }
- if($EnemyChangeState == true)
- {
- ///echo("Enemy has changed State");
- ///echo("E");
- $EnemyChangeState = false;
- if($EnemyGoToPickUp == true)
- {
- ///echo("Enemy go to pick up");
- ///echo("E");
- $EnemyGoToPickUp = false;
- %this.goToPickUp();
- return;
- }
- if($EnemyWalking == true)
- {
- ///echo("Enemy Walking");
- ///echo("E");
- $EnemyDefending = false;
- $EnemyRobbed = false;
- ///playAnimation
- %this.enemyWalking();
- if($EnemyWalkingLeft == true)
- {
- echo("Enemy Walking Left");
- echo("E");
- $EnemyWalkingRight = false;
- ///animate walking left
- //set flip
- $Enemy.setFlipX(true);
- ///set velocity
- $Enemy.setLinearVelocityX($EnemyVelocity * (-1));
- return;
- }
- else if($EnemyWalkingRight == true)
- {
- echo("Enemy Walking Right");
- echo("E");
- $EnemyWalkingLeft = false;
- ///animate walking left
- //set flip
- $Enemy.setFlipX(false);
- ///set velocity
- $Enemy.setLinearVelocityX($EnemyVelocity);
- return;
- }
- }
- else if($EnemyWalking == false)
- {
- ///echo("Enemy Walking is FALSE");
- ///echo("E");
- $Enemy.setLinearVelocityX(0);
- %this.enemyWalking();
- if($EnemyOutOfChips == true)
- {
- $EnemyChangeState = false;
- return;
- }
- if($EnemyHit == true)
- {
- ///echo("enemy hit : : : : : : : ");
- ///echo(" enemy hit : : : : : : : ");
- ///echo("enemy hit : : : : : : : ");
- ///echo(" enemy hit : : : : : : : ");
- ///echo("enemy hit : : : : : : : ");
- return;
- }
- if($EnemyDefending == true)
- {
- ///echo("enemy defending $$$$$$$$$$$$");
- ///echo(" enemy defending $$$$$$$$$$$$");
- ///echo("enemy defending $$$$$$$$$$$$");
- return;
- }
- if($EnemySmacking == true)
- {
- ///echo("enemy Smacking $$$$$$$$$$$$");
- ///echo(" enemy Smacking $$$$$$$$$$$$");
- ///echo("enemy Smacking $$$$$$$$$$$$");
- return;
- }
- }
- }
- if($createNewEnemy == true)
- {
- %this.createEnemy();
- }
- if($createNewEnemyChip == true)
- {
- if($newEnemyChipCreated == true)
- {
- return;
- }
- $createNewEnemyChip = false;
- if($EnemyOutOfChips == false)
- {
- $EnemyWalkingRight = false;
- $EnemyWalkingLeft = false;
- $EnemyWalking = false;
- $newEnemyChip = $newEnemyChip + 1;
- echo("newEnemyChip" @ $newEnemyChip);
- echo("newEnemyChip");
- echo("newEnemyChip");
- echo("newEnemyChip");
- echo("newEnemyChip");
- if($newEnemyChip <= 5)
- {
- $EnemyMounted = false;
- $EnemyWalkingRight = false;
- $EnemyWalkingLeft = true;
- $EnemyWalking = true;
- $EnemyDefending = false;
- $EnemyRobbed = false;
- $EnemyStopped = false;
- if($town_DoLittle == true)
- {
- if($level_McGee == true)
- {
- %this.EnemyChip = new t2dStaticSprite(enemyChip)
- {
- scenegraph = %this.owner.scenegraph;
- imageMap = "chipsChipImageMap";
- frame = "0";
- mUseSourceRect = "0";
- sourceRect = "0 0 0 0";
- canSaveDynamicFields = "1";
- class = "enemyChipClass";
- layer = "10";
- Position = "-133.922 -74.527";
- size = "15.321 15.321";
- CollisionActiveSend = "1";
- CollisionActiveReceive = "1";
- CollisionPhysicsSend = "0";
- CollisionCallback = "1";
- CollisionCircleScale = "0.5";
- CollisionMaxIterations = "3";
- CollisionDetectionMode = "CIRCLE";
- CollisionResponseMode = "RIGID";
- BlendColor = "0.000000 0.815686 0.070588 1.000000";
- WorldLimitMode = "BOUNCE";
- WorldLimitMin = "-160.993 -1813.661";
- WorldLimitMax = "145.314 1556.239";
- WorldLimitCallback = "1";
- Friction = "0.7";
- Damping = "1";
- MountOffset = "-0.252 -0.199";
- MountOwned = "0";
- MountInheritAttributes = "0";
- mountID = "41";
- mountToID = "40";
- _behavior0 = "McGeeChipBehavior";
- group = 27;
- };
- }
- if($level_Dunn == true)
- {
- %this.EnemyChip = new t2dStaticSprite(enemyChip)
- {
- scenegraph = %this.owner.scenegraph;
- imageMap = "chipsChipImageMap";
- frame = "0";
- mUseSourceRect = "0";
- sourceRect = "0 0 0 0";
- canSaveDynamicFields = "1";
- class = "enemyChipClass";
- layer = "10";
- Position = "-133.922 -74.527";
- size = "15.321 15.321";
- CollisionActiveSend = "1";
- CollisionActiveReceive = "1";
- CollisionPhysicsSend = "0";
- CollisionCallback = "1";
- CollisionCircleScale = "0.5";
- CollisionMaxIterations = "3";
- CollisionDetectionMode = "CIRCLE";
- CollisionResponseMode = "RIGID";
- BlendColor = "0.000000 0.815686 0.070588 1.000000";
- WorldLimitMode = "BOUNCE";
- WorldLimitMin = "-160.993 -1813.661";
- WorldLimitMax = "145.314 1556.239";
- WorldLimitCallback = "1";
- Friction = "0.7";
- Damping = "1";
- MountOffset = "-0.252 -0.199";
- MountOwned = "0";
- MountInheritAttributes = "0";
- mountID = "41";
- mountToID = "40";
- _behavior0 = "DunnChipBehavior";
- group = 27;
- };
- }
- if($level_MrMan == true)
- {
- %this.EnemyChip = new t2dStaticSprite(enemyChip)
- {
- scenegraph = %this.owner.scenegraph;
- imageMap = "chipsChipImageMap";
- frame = "0";
- mUseSourceRect = "0";
- sourceRect = "0 0 0 0";
- canSaveDynamicFields = "1";
- class = "enemyChipClass";
- layer = "10";
- Position = "-133.922 -74.527";
- size = "15.321 15.321";
- CollisionActiveSend = "1";
- CollisionActiveReceive = "1";
- CollisionPhysicsSend = "0";
- CollisionCallback = "1";
- CollisionCircleScale = "0.5";
- CollisionMaxIterations = "3";
- CollisionDetectionMode = "CIRCLE";
- CollisionResponseMode = "RIGID";
- BlendColor = "0.000000 0.815686 0.070588 1.000000";
- WorldLimitMode = "BOUNCE";
- WorldLimitMin = "-160.993 -1813.661";
- WorldLimitMax = "145.314 1556.239";
- WorldLimitCallback = "1";
- Friction = "0.7";
- Damping = "1";
- MountOffset = "-0.252 -0.199";
- MountOwned = "0";
- MountInheritAttributes = "0";
- mountID = "41";
- mountToID = "40";
- _behavior0 = "MrManChipBehavior";
- group = 27;
- };
- }
- }
- $newEnemyChipCreated = true;
- %this.bringUpChipAnee();
- return;
- }
- else if($newEnemyChip >= 6)
- {
- $EnemyWalking = false;
- $EnemyWalkingLeft = false;
- $EnmeyWalkingRight = false;
- $EnemyChangeState = true;
- $EnemyOutOfChips = true;
- $EnemyCheckChipsPos = true;
- return;
- }
- }
- }
- if($EnemyCheckChipsPos == true)
- {
- $EnemyCheckChipsPos = false;
- %this.schedule(1500, checkChipPos);
- echo("$EnemyCheckChipsPos INSIDE OF FUNCTION" @ $EnemyCheckChipsPos);
- return;
- }
- if($gameIsUp == false)
- {
- if($BirdInAction == true)
- {
- ///echo("bird is in action so return");
- return;
- }
- if($BirdInAction == false)
- {
- $BirdInAction = true;
- ///create in here, schedules to cal random bird action
- %randomBirdCreatedIn = getRandom(10000, 20000);
- %this.schedule(%randomBirdCreatedIn, createBird);
- echo("%randomBirdCreatedIn" @ %randomBirdCreatedIn);
- return;
- }
- }
- return;
- }
- function EnemyMcGeeManagerBehavior::checkChipPos(%this)
- {
- echo("CHECKIN CHIPS POS");
- echo("$EnemyCheckChipsPos" @ $EnemyCheckChipsPos);
- %enemyPosX = $Enemy.position.x;
- echo("%enemyPosX" @ %enemyPosX);
- %ChipPosX = $Chip.position.x;
- if(%ChipPosX > %enemyPosX)
- {
- %this.enemy.setFlipX(false);
- }
- else if(%ChipPosX < %enemyPosX)
- {
- %this.enemy.setFlipX(true);
- }
- $EnemyChangeState = true;
- $EnemyCheckChipsPos = true;
- echo("here call to repeat");
- }
- function EnemyMcGeeManagerBehavior::bringUpChipAnee(%this)
- {
- if($newEnemyChipCreated == false)
- {
- return;
- }
- $EnemyChipInAnee.setLayer(4);
- $EnemyChipInAnee.playAnimation(chipInAneeAnimation);
- %this.schedule(1200, bringUpChip);
- return;
- }
- function EnemyMcGeeManagerBehavior::bringUpChip(%this)
- {
- %this.EnemyChip.setLayer(3);
- %this.EnemyChipInAnee.safeDelete();
- if($EnemyMounted == false)
- {
- $EnemyWalking = true;
- $EnemyWalkingLeft = true;
- }
- $newEnemyChipCreated = false;
- return;
- }
- function EnemyMcGeeManagerBehavior::createBird(%this)
- {
- ///Bird
- $Bird = new t2dAnimatedSprite(Bird) {
- scenegraph = %this.owner.scenegraph;
- animationName = "birdAnimation";
- frame = "0";
- mUseSourceRect = "0";
- sourceRect = "0 0 0 0";
- canSaveDynamicFields = "1";
- UseMouseEvents = "1";
- usesPhysics = "1";
- size = "72.323 72.323";
- position = "-350 -190.398";
- Layer = "5";
- Class = enemyClass;
- CollisionActiveReceive = "1";
- CollisionActiveSend = "1";
- CollisionPhysicsReceive = "0";
- CollisionPhysicsSend = "0";
- CollisionCallback = "1";
- CollisionMaxIterations = "3";
- WorldLimitMode = "KILL";
- WorldLimitMin = "-350.993 -1813.661";
- WorldLimitMax = "350 1556.239";
- WorldLimitCallback = "1";
- mountID = "2";
- CollisionPolyList = "-0.462 -0.103 0.570 -0.265 0.506 0.246 -0.467 0.260";
- _behavior0 = "birdBehavior";
- group = 4;
- };
- }
- function EnemyMcGeeManagerBehavior::enemyWalking(%this)
- {
- if($EnemyWalking == true)
- {
- if($level_McGee == true)
- $Enemy.playAnimation(McGeeWalkAnimation);
- if($level_Dunn == true)
- $Enemy.playAnimation(DunnWalkAnimation);
- if($level_MrMan == true)
- $Enemy.playAnimation(MrManWalkAnimation);
- }
- else if($EnemyWalking == false)
- {
- if($level_McGee == true)
- $Enemy.playAnimation(McGeeStandAnimation);
- if($level_Dunn == true)
- $Enemy.playAnimation(DunnStandAnimation);
- if($level_MrMan == true)
- $Enemy.playAnimation(MrManStandAnimation);
- }
- }
- ////Here, if time runs up. WinScreenTask is called and set as well as all running tallyes o scores.
- function EnemyMcGeeManagerBehavior::callWinTaskScreen(%this)
- {
- echo("IN WIN SCREEN TASK");
- ///hide all strawberries
- for(%i = 0; %i < %this.owner.scenegraph.getCount(); %i++)
- {
- %currentObject = %this.owner.scenegraph.getObject(%i);
- if(%currentObject.group == 23)
- {
- %currentObject.setLayer(31);
- }
- else if(%currentObject.group == 11)
- {
- ///delete any strawberries
- %currentObject.safeDelete();
- }
- }
- ///delete any extra chips
- for(%i = 0; %i < %this.owner.scenegraph.getCount(); %i++)
- {
- %currentObject = %this.owner.scenegraph.getObject(%i);
- if(%currentObject.group == 27)
- {
- %currentObject.safeDelete();
- }
- }
- $timesUp.layer = 31;
- ///hide winner loser images
- $ChipWinnerLoser.layer = 31;
- echo("$ChipWinnerLoser.layer" @ $ChipWinnerLoser.layer);
- $EnemyWinnerLoser.layer = 31;
- echo("$EnemyWinnerLoser.layer" @ $ChipWinnerLoser.layer);
- //bring all items to layer seen
- %this.winTaskScreen.setLayer(1);
- %this.ChipWinCount.setLayer(0);
- %this.EnemyWinCount.setLayer(0);
- %this.ChipRoundWLT.setLayer(0);
- %this.EnemyRoundWLT.setLayer(0);
- %this.ChipMoneyCount1s.setLayer(0);
- %this.ChipMoneyCount10s.setLayer(0);
- %this.ChipMoneyCount100s.setLayer(0);
- %this.ChipMoneyCount1000s.setLayer(0);
- %this.ChipTotalMoneyCount1s.setLayer(0);
- %this.ChipTotalMoneyCount10s.setLayer(0);
- %this.ChipTotalMoneyCount100s.setLayer(0);
- %this.ChipTotalMoneyCount1000s.setLayer(0);
- %this.EnemyMoneyCount1s.setLayer(0);
- %this.EnemyMoneyCount10s.setLayer(0);
- %this.EnemyMoneyCount100s.setLayer(0);
- %this.EnemyMoneyCount1000s.setLayer(0);
- %this.EnemyTotalMoneyCount1s.setLayer(0);
- %this.EnemyTotalMoneyCount10s.setLayer(0);
- %this.EnemyTotalMoneyCount100s.setLayer(0);
- %this.EnemyTotalMoneyCount1000s.setLayer(0);
- %this.ep1.setLayer(0);
- %this.ep2.setLayer(0);
- %this.ep3.setLayer(0);
- %this.cp1.setLayer(0);
- %this.cp2.setLayer(0);
- %this.cp3.setLayer(0);
- echo("all items have been set to layers in EMB Winscreentask");
- echo("%this.winTaskScreen.setLayer(1);" @ %this.winTaskScreen.layer);
- $strawberry.setPosition("-400 400");
- %this.continueBtn.setPosition("83.260 164.187");
- ///here The round has ended
- ///win screen was been called up
- ///now calculate who won
- ///and calculate the running/total score
- //Chip Wins match
- if($ChipsScore > $EnemyScore)
- {
- $ChipWinCount = $ChipWinCount + 1;
- %this.ChipRoundWLT.setFrame(0);
- %this.EnemyRoundWLT.setFrame(1);
- ////calculate the running totals of Chips Rounds $
- $ChipsScore = $ChipsScore + $ChipsScore;
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipWinCount" @ $ChipWinCount);
- echo("$EnemyScore" @ $EnemyScore);
- echo("$EnemyScore" @ $EnemyScore);
- echo("$EnemyScore" @ $EnemyScore);
- echo("$EnemyScore" @ $EnemyScore);
- echo("$EnemyScore" @ $EnemyScore);
- echo("$EnemyWinCount" @ $EnemyWinCount);
- ///...
- if($ChipsScore < 100)
- {
- ///CSTfs1s
- $CSTfs1s = getSubStr($ChipsScore, 1, 1);
- ///$CSTfs10s
- $CSTfs10s = getSubStr($ChipsScore, 0, 1);
- ///$CSTfs100s
- $CSTfs100s = 0;
- ///$CSTfs1000s
- $CSTfs1000s = 0;
- }
- else if($ChipsScore >= 100 && $ChipsScore < 1000)
- {
- ///$CSTfs1s
- $CSTfs1s = getSubStr($ChipsScore, 2, 1);
- ///$CSTfs10s
- $CSTfs10s = getSubStr($ChipsScore, 1, 1);
- ///$CSTfs100s
- $CSTfs100s = getSubStr($ChipsScore, 0, 1);
- ///$CSTfs1000s
- $CSTfs1000s = 0;
- }
- ///save Banking
- $Bank = $Bank + $ChipsTotalScore;
- if($ChipWinCount == 4)
- {
- $ChipWinTaskComplete = true;
- ///by setting the above to true, the continue btn will load the character strip
- ///also... will set the win screen task to the appropirate frame/adjust for Prize animation.
- ///... to be worked out at this point.
- }
- %this.schedule(300, setCRWL);
- }
- else if($ChipsScore < $EnemyScore)
- {
- $EnemyWinCount = $EnemyWinCount + 1;
- %this.ChipRoundWLT.setFrame(1);
- %this.EnemyRoundWLT.setFrame(0);
- %this.schedule(300, setCRWL);
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipWinCount" @ $ChipWinCount);
- echo("$EnemyScore" @ $EnemyScore);
- echo("$EnemyScore" @ $EnemyScore);
- echo("$EnemyScore" @ $EnemyScore);
- echo("$EnemyScore" @ $EnemyScore);
- echo("$EnemyScore" @ $EnemyScore);
- echo("$EnemyWinCount" @ $EnemyWinCount);
- }
- else if($ChipsScore == $EnemyScore)
- {
- %this.ChipRoundWLT.setFrame(1);
- %this.EnemyRoundWLT.setFrame(1);
- %this.schedule(300, setCRWL);
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipsScore" @ $ChipsScore);
- echo("$ChipWinCount" @ $ChipWinCount);
- echo("$EnemyScore" @ $EnemyScore);
- echo("$EnemyScore" @ $EnemyScore);
- echo("$EnemyScore" @ $EnemyScore);
- echo("$EnemyScore" @ $EnemyScore);
- echo("$EnemyScore" @ $EnemyScore);
- echo("$EnemyWinCount" @ $EnemyWinCount);
- }
- /////set all object score number and there representqaitve frames to 0.
- %this.ChipMoneyCount1s.setFrame(0);
- %this.ChipMoneyCount10s.setFrame(0);
- %this.ChipMoneyCount100s.setFrame(0);
- ///set timer to 0;
- $timerValue = 0;
- $gameIsUp = true;
- $beginTimer = false;
- }
- function EnemyMcGeeManagerBehavior::setCRWL(%this)
- {
- %this.ChipWinCount.setFrame($ChipWinCount);
- %this.EnemyWinCount.setFrame($EnemyWinCount);
- ///call schedules to set end round $ numbers :: tally style.
- %this.schedule(500,setCRT1);
- %this.schedule(650, setCRT10);
- %this.schedule(800, setCRT100);
- ///for Enemy
- %this.schedule(500,setECRT1);
- %this.schedule(650, setECRT10);
- %this.schedule(800, setECRT100);
- ///call to return is tied. no need to talley total running score.
- if($ChipsScore <= $EnemyScore)
- {
- return;
- }
- ///call to do Chips Round Total Talley
- %this.schedule(300, setCRTT1);
- %this.schedule(450, setCRTT10);
- %this.schedule(600, setCRTT100);
- return;
- }
- function EnemyMcGeeManagerBehavior::setCRT1(%this)
- {
- ///frame to be set
- %this.CRT1Frame = %this.CRT1Frame + 1;
- %this.ChipMoneyCount1s.setFrame(%this.CRT1Frame);
- if(%this.CRT1Frame == $fs1s)
- {
- %this.setCRT10now = true;
- return;
- }
- else if(%this.CRT1Frame != $fs1s)
- {
- if($fs1s == 0)
- {
- %this.ChipMoneyCount1s.setFrame(0);
- %this.setCRT10now = true;
- %this.CRT1Frame = 0;
- return;
- }
- if(%this.CRT1Frame >= 10)
- {
- %this.CRT1Frame = 0;
- %this.schedule(150, setCRT1);
- return;
- }
- if(%this.CRT1Frame < 10)
- {
- %this.schedule(150, setCRT1);
- return;
- }
- }
- }
- function EnemyMcGeeManagerBehavior::setCRT10(%this)
- {
- if(%loaded == true)
- {
- return;
- }
- ///frame to be set
- %this.CRT10Frame = %this.CRT10Frame + 1;
- %this.ChipMoneyCount10s.setFrame(%this.CRT10Frame);
- if(%this.setCRT10now != true)
- {
- if(%this.CRT10Frame >= 10)
- {
- %this.CRT10Frame = 0;
- ///echo("%this.setCRT10Frame >= 10 " @ %this.setCRT10Frame);
- %this.schedule(150, setCRT10);
- return;
- }
- else if(%this.CRT10Frame < 10)
- {
- %this.schedule(150, setCRT10);
- return;
- }
- }
- else if(%this.setCRT10now == true)
- {
- if(%this.CRT10Frame != $fs10s)
- {
- if($fs10s == 0)
- {
- %this.ChipMoneyCount10s.setFrame($fs10s);
- %this.setCRT100now = true;
- %this.setCRT10now = false;
- %this.CRT10Frame = 0;
- return;
- }
- if(%this.CRT10Frame >= 10)
- {
- %this.CRT10Frame = 0;
- %this.schedule(150, setCRT10);
- return;
- }
- else if(%this.CRT10Frame < 10)
- {
- %this.schedule(150, setCRT10);
- return;
- }
- }
- else if(%this.CRT10Frame == $fs10s)
- {
- %this.ChipMoneyCount10s.setFrame($fs10s);
- %this.setCRT100now = true;
- %this.setCRT10now = false;
- %this.CRT10Frame = 0;
- }
- }
- }
- function EnemyMcGeeManagerBehavior::setCRT100(%this)
- {
- if(%loaded == true)
- {
- return;
- }
- ///frame to be set
- %this.CRT100Frame = %this.CRT100Frame + 1;
- %this.ChipMoneyCount100s.setFrame(%this.CRT100Frame);
- if(%this.setCRT100now != true)
- {
- if(%this.CRT100Frame >= 10)
- {
- %this.CRT100Frame = 0;
- ///echo("%this.setCRT100Frame >= 10 " @ %this.setCRT100Frame);
- %this.schedule(150, setCRT100);
- return;
- }
- else if(%this.CRT100Frame < 10)
- {
- %this.schedule(150, setCRT100);
- return;
- }
- }
- else if(%this.setCRT100now == true)
- {
- ///echo("$fs100s" @ $fs100s);
- ///echo("%this.CRT100Frame" @ %this.CRT100Frame);
- ///echo("%this.setCRT100now is true " @ %this.setCRT100now);
- if(%this.CRT100Frame != $fs100s)
- {
- if($fs100s == 0)
- {
- %this.ChipMoneyCount100s.setFrame($fs100s);
- %this.setCRTT1now = true;
- %this.setCRT100now = false;
- %this.CRT1Frame = 0;
- return;
- }
- if(%this.CRT100Frame >= 10)
- {
- %this.CRT100Frame = 0;
- ///echo("%this.setCRT100Frame >= 10 " @ %this.setCRT100Frame);
- %this.schedule(150, setCRT100);
- return;
- }
- else if(%this.CRT100Frame < 10)
- {
- %this.schedule(150, setCRT100);
- return;
- }
- }
- else if(%this.CRT100Frame == $fs100s)
- {
- %this.ChipMoneyCount100s.setFrame($fs100s);
- %this.setCRTT1now = true;
- %this.setCRT100now = false;
- %this.CRT100Frame = 0;
- }
- }
- }
- ///this set of functions calculate round totals.
- function EnemyMcGeeManagerBehavior::setCRTT1(%this)
- {
- if(%loaded == true)
- {
- return;
- }
- ///frame to be set
- %this.CRTT1Frame = %this.CRTT1Frame + 1;
- %this.ChipTotalMoneyCount1s.setFrame(%this.CRTT1Frame);
- if(%this.setCRTT1now != true)
- {
- if(%this.CRTT1Frame >= 10)
- {
- %this.CRTT1Frame = 0;
- %this.schedule(150, setCRTT1);
- return;
- }
- else if(%this.CRTT1Frame < 10)
- {
- %this.schedule(150, setCRTT1);
- return;
- }
- }
- else if(%this.setCRTT1now == true)
- {
- if(%this.CRTT1Frame != $CSTfs1s)
- {
- if($CSTfs1s == 0)
- {
- %this.ChipTotalMoneyCount1s.setFrame($CSTfs1s);
- %this.setCRTT10now = true;
- %this.setCRTT1now = false;
- %this.CRTT1Frame = 0;
- return;
- }
- if(%this.CRTT1Frame >= 10)
- {
- %this.CRTT1Frame = 0;
- %this.schedule(150, setCRTT1);
- return;
- }
- else if(%this.CRTT1Frame < 10)
- {
- %this.schedule(150, setCRTT1);
- return;
- }
- }
- else if(%this.CRTT1Frame == $CSTfs1s)
- {
- %this.ChipTotalMoneyCount1s.setFrame($CSTfs1s);
- %this.setCRTT10now = true;
- %this.setCRTT1now = false;
- %this.CRTT1Frame = 0;
- return;
- }
- }
- }
- function EnemyMcGeeManagerBehavior::setCRTT10(%this)
- {
- if(%loaded == true)
- {
- return;
- }
- ///frame to be set
- ///this variable, set to 0 at begining is a count
- %this.CRTT10Frame = %this.CRTT10Frame + 1;
- ///each count ups the frame of object
- %this.ChipTotalMoneyCount10s.setFrame(%this.CRTT10Frame);
- if(%this.setCRTT10now != true)
- {
- ///if this variuable is not true, as here
- ///... the count keeps cycling
- ///... creating the talley effect
- if(%this.CRTT10Frame >= 10)
- {
- ///if this variable is > 10
- ///... reset it to 0. to create cycle effect.
- ////call scedule to repeat cycle
- %this.CRTT10Frame = 0;
- %this.schedule(150, setCRTT10);
- return;
- }
- else if(%this.CRTT10Frame < 10)
- {
- ///...if variable is < 10
- ///no need to reset. keep going until it reaches 10
- //the reset
- %this.schedule(150, setCRTT10);
- return;
- }
- }
- else if(%this.setCRTT10now == true)
- {
- if(%this.CRTT10Frame != $CSTfs10s)
- {
- if($CSTfs10s == 0)
- {
- %this.ChipTotalMoneyCount10s.setFrame($CSTfs10s);
- %this.setCRTT100now = true;
- %this.setCRTT10now = false;
- %this.CRTT10Frame = 0;
- return;
- }
- if(%this.CRTT10Frame >= 10)
- {
- %this.CRTT10Frame = 0;
- %this.schedule(150, setCRTT10);
- return;
- }
- else if(%this.CRTT10Frame < 10)
- {
- %this.schedule(150, setCRTT10);
- return;
- }
- }
- else if(%this.CRTT10Frame == $CSTfs10s)
- {
- %this.ChipTotalMoneyCount10s.setFrame($CSTfs10s);
- %this.setCRTT100now = true;
- %this.setCRTT10now = false;
- %this.CRTT10Frame = 0;
- }
- }
- }
- function EnemyMcGeeManagerBehavior::setCRTT100(%this)
- {
- if(%loaded == true)
- {
- return;
- }
- ///frame to be set
- ///this variable, set to 0 at begining is a count
- %this.CRTT100Frame = %this.CRTT100Frame + 1;
- ///each count ups the frame of object
- %this.ChipTotalMoneyCount100s.setFrame(%this.CRTT100Frame);
- if(%this.setCRTT100now != true)
- {
- ///if this variuable is not true, as here
- ///... the count keeps cycling
- ///... creating the talley effect
- if(%this.CRTT100Frame >= 10)
- {
- ///if this variable is > 10
- ///... reset it to 0. to create cycle effect.
- ////call scedule to repeat cycle
- %this.CRTT100Frame = 0;
- ///echo("%this.setCRTT100Frame >= 10 " @ %this.setCRTT100Frame);
- %this.schedule(150, setCRTT100);
- return;
- }
- else if(%this.CRTT100Frame < 10)
- {
- ///...if variable is < 10
- ///no need to reset. keep going until it reaches 10
- //the reset
- %this.schedule(150, setCRTT100);
- ///echo("%this.CRTT100Frame" @ %this.CRTT100Frame);
- ///echo("%this.ChipTotalMoneyCount100s.frame " @ %this.ChipTotalMoneyCount100s.frame);
- ///echo("Here we are. This should call the CRRTT100 function again ");
- return;
- }
- }
- else if(%this.setCRTT100now == true)
- {
- ///here...
- ///the condition is true, that the object can now reveal its true worth
- ///freezing on its appropriate number
- if(%this.CRTT100Frame != $CSTfs100s)
- {
- ///if variable does not equal the real amount of object
- if(%loaded == true)
- {
- ///guide to prevent double loads/miscalculations. A lock if you will that is set
- ///... when real value met.
- return;
- }
- if($CSTfs100s == 0)
- {
- ///real value does == 0.
- ///set value as such,
- %this.ChipTotalMoneyCount100s.setFrame($CSTfs100s);
- %this.setCRTT100now = false;
- %this.CRTT100Frame = 0;
- return;
- }
- else if(%this.CRTT100Frame >= 10)
- {
- %this.CRTT100Frame = 0;
- %this.schedule(150, setCRTT100);
- return;
- }
- else if(%this.CRTT100Frame < 10)
- {
- %this.schedule(150, setCRTT100);
- return;
- }
- }
- else if(%this.CRTT100Frame == $CSTfs100s)
- {
- ////variable has looped into equivalence of real value
- ///...so...
- ///set condition for next function lock to be true (can caalculte next function
- ///call schedule for the next function
- ///set lock on this calculation
- %this.ChipTotalMoneyCount100s.setFrame($CSTfs100s);
- %this.setCRTT100now = false;
- %this.CRTT100Frame = 0;
- return;
- }
- }
- }
- function EnemyMcGeeManagerBehavior::setECRT1(%this)
- {
- ///frame to be set
- %this.ECRT1Frame = %this.ECRT1Frame + 1;
- %this.EnemyMoneyCount1s.setFrame(%this.ECRT1Frame);
- echo("KJKJKJKJKJJKJKJKJKJ");
- echo("KJKJKJKJKJJKJKJKJ");
- echo("KJKJKJKJKJJKJKJK");
- echo("KJKJKJKJKJJKJ");
- echo("KJKJKJK");
- echo("$efs1s" @ $efs1s);
- echo("%this.ECRT1Frame" @ %this.ECRT1Frame);
- echo("$EnemyScore" @ $EnemyScore);
- if(%this.ECRT1Frame == $efs1s)
- {
- %this.setECRT10now = true;
- echo("unit one is set, set the call for next digit");
- return;
- }
- else if(%this.ECRT1Frame != $efs1s)
- {
- echo("%this.ECRT1Frame != $efs1s");
- if($efs1s == 0)
- {
- echo("$efs1s >= 10");
- %this.EnemyMoneyCount1s.setFrame(0);
- %this.setECRT10now = true;
- %this.ECRT1Frame = 0;
- return;
- }
- if(%this.ECRT1Frame >= 10)
- {
- echo("$efs1s >= 10");
- %this.ECRT1Frame = 0;
- echo("%this.ECRT1Frame " @ %this.ECRT1Frame);
- %this.schedule(150, setECRT1);
- return;
- }
- if(%this.ECRT1Frame < 10)
- {
- echo("$efs1s <= 10");
- %this.schedule(150, setECRT1);
- return;
- }
- }
- }
- function EnemyMcGeeManagerBehavior::setECRT10(%this)
- {
- echo("$efs10s" @ $efs10s);
- echo("%this.ECRT10Frame" @ %this.ECRT10Frame);
- echo("$EnemyScore" @ $EnemyScore);
- if(%loaded == true)
- {
- return;
- }
- ///frame to be set
- %this.ECRT10Frame = %this.ECRT10Frame + 1;
- %this.EnemyMoneyCount10s.setFrame(%this.ECRT10Frame);
- if(%this.setECRT10now != true)
- {
- echo("%this.setECRT10now != true");
- if(%this.ECRT10Frame >= 10)
- {
- %this.ECRT10Frame = 0;
- ///echo("%this.setECRT10Frame >= 10 " @ %this.setECRT10Frame);
- %this.schedule(150, setECRT10);
- return;
- }
- else if(%this.ECRT10Frame < 10)
- {
- %this.schedule(150, setECRT10);
- return;
- }
- }
- else if(%this.setECRT10now == true)
- {
- echo("%this.setECRT10now == true");
- if(%this.ECRT10Frame != $efs10s)
- {
- if($efs10s == 0)
- {
- %this.EnemyMoneyCount10s.setFrame($efs10s);
- %this.setECRT100now = true;
- %this.setECRT10now = false;
- %this.ECRT10Frame = 0;
- return;
- }
- if(%this.ECRT10Frame >= 10)
- {
- %this.ECRT10Frame = 0;
- %this.schedule(150, setECRT10);
- return;
- }
- else if(%this.ECRT10Frame < 10)
- {
- %this.schedule(150, setECRT10);
- return;
- }
- }
- else if(%this.ECRT10Frame == $efs10s)
- {
- %this.EnemyMoneyCount10s.setFrame($efs10s);
- %this.setECRT100now = true;
- %this.setECRT10now = false;
- %this.ECRT10Frame = 0;
- }
- }
- }
- function EnemyMcGeeManagerBehavior::setECRT100(%this)
- {
- echo("$efs100s" @ $efs100s);
- echo("%this.ECRT100Frame" @ %this.ECRT100Frame);
- echo("$EnemyScore" @ $EnemyScore);
- if(%loaded == true)
- {
- return;
- }
- ///frame to be set
- %this.ECRT100Frame = %this.ECRT100Frame + 1;
- %this.EnemyMoneyCount100s.setFrame(%this.ECRT100Frame);
- if(%this.setECRT100now != true)
- {
- if(%this.ECRT100Frame >= 10)
- {
- %this.ECRT100Frame = 0;
- ///echo("%this.setECRT100Frame >= 10 " @ %this.setECRT100Frame);
- %this.schedule(150, setECRT100);
- return;
- }
- else if(%this.ECRT100Frame < 10)
- {
- %this.schedule(150, setECRT100);
- return;
- }
- }
- else if(%this.setECRT100now == true)
- {
- ///echo("$efs100s" @ $efs100s);
- ///echo("%this.ECRT100Frame" @ %this.ECRT100Frame);
- ///echo("%this.setECRT100now is true " @ %this.setECRT100now);
- if(%this.ECRT100Frame != $efs100s)
- {
- if($efs100s == 0)
- {
- %this.EnemyMoneyCount100s.setFrame($efs100s);
- %this.setECRT10now = true;
- %this.setECRT1now = false;
- %this.ECRT1Frame = 0;
- return;
- }
- if(%this.ECRT100Frame >= 10)
- {
- %this.ECRT100Frame = 0;
- ///echo("%this.setECRT100Frame >= 10 " @ %this.setECRT100Frame);
- %this.schedule(150, setECRT100);
- return;
- }
- else if(%this.ECRT100Frame < 10)
- {
- %this.schedule(150, setECRT100);
- return;
- }
- }
- else if(%this.ECRT100Frame == $efs100s)
- {
- %this.EnemyMoneyCount100s.setFrame($efs100s);
- %this.setECRTT1now = true;
- %this.setECRT100now = false;
- %this.ECRT100Frame = 0;
- echo("CRT100 == $efs100s therefore return");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement