-
outcome depending on score AS2.0
Hi there,
Im trying to make a simple game, but I want 3 different endings, depending on the players end score, how can I code the game so that, at the final question, the player is directed to one of 3 endings depending on their score (I have a counter in place)
Kinda like an
If score=3000 (or more)
gotoandplay (ending 1)
if score=2000-2999
gotoandplay (ending 2)
Can anyone explain how I can go about this?
Thanks in advance!
-
Prid - Outing
at the final question, the button which makes you continue, or move further, you probably have some sort of code to make it goto and play to another frame. In that code to make the button do something, use this code:
Actionscript Code:
if(score >= 3000){ gotoAndPlay("ending1"); } else if(score >= 2000 && score <= 2999){ gotoAndPlay("ending2"); } else { gotoAndPlay("ending3"); }
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
Thank you so much for the help!
-
You can try this concept:
Actionscript Code:
var scoreLimit:Array = new Array({start:2000, end:3000-1}, {start:3000, end:10000-1}, {start:10000, end:20000}); var prize:Array = new Array("iPod", "iPhone", "iPad");
function CheckScore(scoreValue) { var gameLimit:Array = new Array(); for (var i = 0; i<scoreLimit.length; i++) { if (scoreLimit[i].start>scoreValue || scoreLimit[i].end<scoreValue) { gameLimit.push(scoreLimit[i].start+"-"+scoreLimit[i].end); } else { trace("You won "+prize[i]+" on score value of "+scoreValue); } if (i == scoreLimit.length-1) { for (var j = 0; j<gameLimit.length; j++) { trace(gameLimit[j]); } } } }
CheckScore(10000-1);
arkitx
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|