So, I wanted to construct a code which helps me devise a system that helps this out. That would mean giving variables to a number, and what ever number you accumulate by the end goes towards the ending which you have made happen. When something good happens, you gain a number, and when something bad happens, nothing is given to you.
With help, a coding was made so that each time you click "Choice One" on this Flash file, it would add one to the score, until the ending which tells you that you have finished.
To show that the choice count is working, it adds '1' to the score above the buttons, and sends a message to me on the flash file, saying that '1' has been added to the remaining total (This is called tracing).
Quick look at the Coding.
Thank you, Mike.
----------------------------------------------------------------
stop(); (This is used to stop the frame from continuing to the next.)
var playerWin = 0; (If the player clicks the right button, it passes on to the next frame.)
_root.onEnterFrame = function (){
_root.choice1.onRelease = function () {
playerWin +=1;
trace(playerWin);
}
if (playerWin >= 2) {
_root.gotoAndPlay(2);
trace ("did work");
}
(This coding here traces that if the person clicks the wrong button all together, the variable of '1' is not added to the total, and you carry on with nothing.)
//else {
//trace ("Didn't work");
//}
}
----------------------------------------------------------------

No comments:
Post a Comment
Note: only a member of this blog may post a comment.