I have a problem with a game I am making. I have several Movie Clips within a movie clip. Each is in a seperate frame. I want the movie clip inside the movie clip to play and the parent movie clip to stay at the frame it is at. But the frame of the outer movie clip needs to be changed by a variable. I have tried many things, but none of them work.
Here is what I have tried:
1. Each movie clip has 1 frame. The actions of the frame are stop() if (_global.Qaction == 1) gotoAndStop(_global.action). Inner movie clip has no actions.
Results: does not change frames
2. Each movie clip has 1 frame. The action of the frame is gotoAndPlay(_global.action)
Results: Inner movie clips are always on frame 1
3. Each movie clip has 2 frames. The action of the frame is gotoAndPlay(_currentframe) The action of the movie clip is if (_global.Qaction == 1) _parent.gotoAndPlay(_global.action)
Results: Plays through the parent Movie Clip
4. Each movie clip has 2 frames. The action of the frame is gotoAndPlay(_currentframe-1) The action of the movie clip is if (_global.Qaction == 1) _parent.gotoAndPlay(_global.action*2)
Results: does not change frames
5. Each movie clip has 2 frames. The actions of the frame areis gotoAndPlay(_currentframe-1) and if (_global.Qaction == 1) _parent.gotoAndPlay(_global.action*2)
Results: does not change frames
Question: Will the variable for the parent frame be determined by a button press or another action of some sort?
I think I can solve your issue if you haven't already, but I need to know more. Can you explain the way the game is supposed to work in terms of user input, or can you provide a file?
Ok, I have gone through your script and tried it out.
First comment, 12fps is real friggin' slow, you can get away with a lot more than that...it'll give you smoother motion.
Now that I'm familiar with your swf, what exactly are you having trouble with? I noticed that pressing "left" makes the guy fall off the screen.
Some aspects of your code don't seem to make sense...maybe because they're typos or something, maybe because I just don't get it. For example you have a variable called _global.nactions a bunch of times, but yet that variable doesn't correspond to anything and wasn't initialized like the others.
However, I think I get the jist of what you're trying to do. You want the MasterBob MC to go to a certain position when right, left, up, down, etc. are pressed, along with some other code to be executed, yes?
First off, some of your code won't work on the "you" MC because there are many frames in that MC and your code needs to execute every frame, not just when it returns to frame 1, know what I'm saying? You can only do that with an MC that has one frame, total.
There is an easier way that will save you a lot of stress:
First, take your man MC with all the different positions, and put it in a new, empty MC..call it ManContainerMC or something. DO NOT put anything else in this MC and make ONLY one frame. You will no longer need the frame actions in your manMC, except to stop(); it at the appropriate times.
THEN, forget about all of your _global.actions stuff. Just delete it. On the ManContainerMC, make it check to see if the keys are pressed on (enterFrame). Since there is only one frame in the containerMC, it will be checking constantly. If they are pressed, do the appropriate movements (_root.ManContainerMC._x +=walkspeed, etc.) and just add _root.ManContainer.Man.gotoAndPlay("rightStand") or whatever for each key.
Make sure to include an else statement at the end that restores the man to his default position if nothing is pressed.
That should do the trick.
Let me know if that's confusing or explained poorly.
thank you, this may help
1. _global.nactions is a variable i was using to debug it, I shud have deleted it.
2. _global.action variable will be vital later in a part I havent made yet so i cant delete it
3. movement already works fine i dont need your help on that(thank you NEway tho)
what do you mean by put stop(); in the "appropriate times"? what are the appropriate times?
How come Normal Mode Script is harder to use than Expert Mode.