View Full Version : Sending Variables to Frame 1?
Can you send variables to the first frame?
Like, at the moment, I have a Sniper type game, and everytime you shoot the guy, it adds one to the score, but when it gets to the start of the movie again, the score resets because the variable there sets it back to zero.
Any suggestions?:confused:
ard0x
02-21-2004, 01:34 PM
I'm still fairly new at actionscripting, so I am not clear on all the different ways you can set up your code, but:
On your frame 1 do you have this?
_root.onEnterFrame = function() {
}
It runs the code every time the frame runs. If you put your initial "score=0" variable *before* this line, it shouldn't go back to it.
And if that isn't the solution you are looking for, you can always try having frame 1 hold all of your initial variables, and then never go back to frame 1. Always go back to frame 2 to continue your loop.
boyzdynasty
02-21-2004, 02:15 PM
don't put a variable on the first frame... you don't need to
just say... MCName.score++
when first use this...it will be zero...
now...when it hits back to the first frame...the score remains the same b/c you are not initializing it to zero...
so if you want to reset the score, right a function or something... which will set MCName.score = 0
get it? :)
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.