Wednesday, 13 June 2012

[DAY 16] [DEVELOPMENT] Considering the Coding for the Choices

How the comic is going to work is with choices; Choices determine what your ending will be on the comic. I wanted this comic to be a multiple choice comic because it gives you more of a wide range of options that will encourage you to fight for an ending you truly desire. Information will be given to help you combat your thinking and really push towards something you deserve.
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.