USERNAME:
PASSWORD:
Save Info!
Logging in…
This topic is 1 page long.
[ Profile | Posts | Contact ]
Posted at: 11/3/09 11:27 AM
Sign-Up: 04/15/08
Posts: 242
Okay, I have a variable of health, and i want to make it so the movieclip goes to frame 2 when health is 50, but when i put the code in the movieclip it doesnt work, do i have to put a duplicate variable in the movieclip also or something?
The Final sonic emblem 2 demo is out: http://spamtheweb.com/ul/upload/210 409/70579_Final_sonic_emblem_RPG_II _2.php
Posted at: 11/3/09 11:43 AM
Sign-Up: 09/11/09
Posts: 1,840
What code ?
Just do
function onEnterFrame(){ if(Health<50){ MC.gotoAndStop(2) }}
Thats AS2 of course but most of it its virtually identical to AS3
OOP AS3 || Flash 8,CS3,CS4 || *sigh* || The new forum on the block : FLASH SEED !
Posted at: 11/3/09 11:51 AM
Sign-Up: 05/23/08
Posts: 2,436
At 11/3/09 11:43 AM, hdxmike wrote: function onEnterFrame(){ if(Health<50){ MC.gotoAndStop(2) }}
That will not go to frame 2 if Health is 50.
dr. seuss "unless someone like you cares a whole awful lot, nothing is going to get better. it's not."
Posted at: 11/3/09 11:53 AM
At 11/3/09 11:43 AM, hdxmike wrote: What code ? Just do function onEnterFrame(){ if(Health<50){ MC.gotoAndStop(2) }} Thats AS2 of course but most of it its virtually identical to AS3
Oh so thats what i was doing wrong, thanks, im using as2 anyways
Posted at: 11/3/09 12:03 PM
At 11/3/09 11:51 AM, K-Guare wrote: At 11/3/09 11:43 AM, hdxmike wrote: function onEnterFrame(){ if(Health<50){ MC.gotoAndStop(2) }}That will not go to frame 2 if Health is 50.
I made an assumption , sue me
Posted at: 11/3/09 12:26 PM
At 11/3/09 12:03 PM, hdxmike wrote: I made an assumption , sue me
It had nothing to do with that it was in AS2, you just need to use your brain. When Health is 50, Health is not less than 50.
onEnterFrame = function(){ if(Health == 50){ MC.gotoAndStop(2) } }
That's what you meant to put. Greater than or equal to, or less than or equal to would also work.
Posted at: 11/3/09 02:02 PM
At 11/3/09 12:26 PM, K-Guare wrote: At 11/3/09 12:03 PM, hdxmike wrote: I made an assumption , sue meIt had nothing to do with that it was in AS2.
That wasnt the assumption, most of the time when someone needs code like that its because they want the charcters face to change when his health gets lower. under 100 is happy face , under 50 is sad, under 25 is beaten up etc so i thought he was looking for something with less than , unless he had 100 different states :P but yes <= would have been better but honestly how often do you need health to = an exact number ?
Posted at: 11/3/09 03:59 PM
At 11/3/09 02:02 PM, hdxmike wrote:
Fantastic; glad you got that all set up. Next time, though, just give him what he asks for. It's up to him to describe what exactly he needs.
He didn't say what his intentions were with it, so don't assume.
All times are Eastern Standard Time (GMT -5) | Current Time: 02:38 PM
<< Back