Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-16-2011, 03:18 PM   #1
otoks
Registered User
 
Join Date: Jun 2011
Posts: 4
Default [AS2] Total up scores in many scenes

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.
otoks is offline   Reply With Quote
Old 06-16-2011, 11:36 PM   #2
killermelga
Registered User
 
Join Date: May 2010
Posts: 17
Default

dont you have a diferent variable for the score on each scene?
killermelga is offline   Reply With Quote
Old 06-18-2011, 06:16 PM   #3
Andrew the Great
Senior Member
 
Join Date: May 2011
Posts: 100
Default

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
ActionScript Code:
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
ActionScript Code:
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
ActionScript Code:
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

Last edited by Andrew the Great; 06-18-2011 at 06:18 PM.
Andrew the Great is offline   Reply With Quote
Old 06-18-2011, 07:29 PM   #4
otoks
Registered User
 
Join Date: Jun 2011
Posts: 4
Default

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
otoks is offline   Reply With Quote
Old 06-18-2011, 07:52 PM   #5
tacos
Grrrrrrrrreat!
 
tacos's Avatar
 
Join Date: Apr 2007
Location: Montréal, Québec
Posts: 5,473
Default

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?
__________________
WHO I WAS...
BANDS OF THE 80's
tacos is offline   Reply With Quote
Old 06-18-2011, 08:02 PM   #6
otoks
Registered User
 
Join Date: Jun 2011
Posts: 4
Default

Quote:
Originally Posted by tacos View Post
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*
otoks is offline   Reply With Quote
Old 06-19-2011, 12:13 AM   #7
Andrew the Great
Senior Member
 
Join Date: May 2011
Posts: 100
Default

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
Andrew the Great is offline   Reply With Quote
Old 06-19-2011, 03:28 AM   #8
otoks
Registered User
 
Join Date: Jun 2011
Posts: 4
Default

Quote:
Originally Posted by Andrew the Great View Post
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.
otoks is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:55 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.