-
problem with goto
Hey. Im working on this simple game where u basically beat up some guy with weapons. Anyway, everything is goin smooth...I have a health bar on top, and I basically set it so that the health is 1000. In places, after:
if(release) {
I put in the code:
if(hp == 0) {
gotoAndStop("Dead", 1);
}
("Dead" being the scene) For some reason, it doesnt seem to work and rather it goes into the negatives. If goin to a different scene doesn't work, then I wouldn't mind it being on the same scene, as long as he actually can die.
Thanks for any help.
-
Senior Member
If this movie clip "dead" is on another scene, then you can't access it. It must be on the same scene. Actually, it must be visible. You can't change the properties of a movieclip on frame 100 if you're on frame 1 if each key frame is individually significant.
You might want to post a very basic FLA omitting a lot of what's not needed to give us an idea of how it is setup.
Try this though, and let us know if it works:
_root.Dead.gotoAndStop(1);
hope this helps.
-genesis f5 (mx)
-
Targeting scene names only works if everything is on the main timeline, not from movie clips, and not from external movies loaded on other levels. You should thus never target scene names, and allways target labeled frames instead.
You should label the first frame of your "Dead" scene with an unique label such as dead (no number only labels or at least not starting off with a number, and no caps or special characters other than maybe the underscore if you must...), add _root (from movie clips) or _level0 (from external movies loaded on other levels) to your path and target that labeled frame...
code:
on(release){
_root.gotoAndStop("dead");
}
//Or...
if(hp == 0){
_root.gotoAndStop("dead");
}
-
Okay, I don't think that I explained it well. I dont want to goto a movie clip, just the first frame of the scene Dead. Alright, OldNewbie, I tried what you said, by labeling the frame, but it still doesn't seem to work.
Now this is the most puzzling thing ever, and you probably can't help me, but I went and made an example, and it happened to work there!! So I rechecked my coding in my real game, and I don't see a difference.
-
You put the label between double quotes on the action itself, but not on the frame label itself? Same spelling? No caps?
-
Yep, made sure of that. Something is really messed up. Its not the end of the world if I dont get it, but I would like to. Well thanks for all of your help..sorry to have wasted your time .
-
Are you trying this from some movie loaded on another level of your main movie? And if so did you try _level0 rather than _root?
PS: You're not waisting my time... And it should work! Allways has for the last 4 years!
-
-
Guess your game sucks then!
-
Perhaps
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
|