-
[RESOLVED] messing with varriables (check my math?)
Back Story (not important to read)
So im just experimenting with some variables after reading some tutorials (which were not clear and seemed to be typed up in a hurry) i decided just to mess around with it and make a button in the middle of a black screen which upon clicking will remove a random 1293 number from the dynamic number (boring i know but im just learning)
So heres what i got, In my 1st frame i have
and in that frame i also have my button which after being clicked subtracts a random number from the "money" after clicked the button animates a lame tween and leaves - here is what my button has
actionscript Code:
on (release) { money -= random(9999); } on (release) { gotoAndPlay (2); }
along down the timeline after the button has completed its lame tween i have actions in a frame here as follows
NOW HERES THE PROBLEM
just before that frame that sends you back to frame 2 i have this in my frame
Actionscript Code:
if (_root.money==0) { gotoAndStop(26);
-I was hoping that it would detect that the money has reached 0 and send me to frame 26 but instead all it does is just zoom past it letting my numbers drop into the negatives... any ideas or tutorials i should look at?
Last edited by Ecuder; 05-27-2010 at 05:14 PM.
Reason: [highlight=actionscrip] did not work 1st time
How can you say so much, but say so little?
-
Try:
PHP Code:
if (_root.money <=0){ gotoAndStop(26); }
What you're saying is if and only if the money variable is equal to 0. What happens if it randomly drops below that, which in your issue, it does. So that should fix it.
-
Originally Posted by Osteel
What you're saying is if and only if the money variable is equal to 0. What happens if it randomly drops below that, which in your issue, it does. So that should fix it.
Thanks Osteel!
How can you say so much, but say so little?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|