PDA

View Full Version : [AS2] Total up scores in many scenes


otoks
06-16-2011, 03:18 PM
Hi there.

I'm trying to make a very simple flash game for my college project. The players will get 1 point each time they click on certain object. I've created 3 scenes and each of the scene has score value for each level. I want to total up the score at Scene3. FYI, I use these scripts for all 3 scenes:

1st Action Script add this to the variables frame:
_root.total = 00;

2nd Action Script add this to each of the hit sections in the Action Script frame:
_root.total = Number (total) +1;

My question is, how to add up the scores from Scene 1,2 & 3? What script should I use? Thanks in advance.

killermelga
06-16-2011, 11:36 PM
dont you have a diferent variable for the score on each scene?

Andrew the Great
06-18-2011, 06:16 PM
well, not sure why you are using multiple scene..and I dont think _root. is necessary I never use that for my scores, I use something like this on the first frame score = 0 //which would be your total im guessing? and score is the variable name on the dynamic text box

and then on the movie clips you are pressing you'd have something like onPress(){
score += 1 //where you can use as total also if you like

but if you are doing different scenes you could try naming each variable with a number at end and then do something like total = score1+score2+score3 //where a dynamic text box named total would add up the other three scores


you should upload your .fla file though so we can see it

otoks
06-18-2011, 07:29 PM
thanks for ur answer. this is my fla file:

www[dot]fileden[dot]com/files/2008/9/28/2119380//simplegame.fla

im just following the tutorials in websites about the _root. i have zero knowledge about the script T__T, but i need to finish this simple project/game asap. i hope you can take a look at my file and see what i did wrong.

thank you :)

tacos
06-18-2011, 07:52 PM
Do you want the score to reset to 0 on every scene but store the total score of all scenes and display it at the end?

otoks
06-18-2011, 08:02 PM
Do you want the score to reset to 0 on every scene but store the total score of all scenes and display it at the end?

yeppers. that's what i wanna do, but *sigh*

Andrew the Great
06-19-2011, 12:13 AM
We'll not sure if I can help out I dont use more than one scene, find it pointless and I belive it changes the code

otoks
06-19-2011, 03:28 AM
We'll not sure if I can help out I dont use more than one scene, find it pointless and I belive it changes the code

its okay then. thanks for ur tips :).
i'll try create a new one by using only one scene.