interesting question on MovieClips...

7 posts

Flag Post

…within MovieClips.

Still new to flash programming as I am, I have my own little theory on something that would be absolutely awesome to have confirmed for me since a lot of the games I have bouncing in my head depend on it.

So: say you have a movieClip of a basic body, just a torso. No, in this movieclip you put ANOTHER movieClip called head. So the movie clip Body has the movieclip Head in it. Now go ahead and add all the other appendages, arms, legs, so on and so fourth.

So what we have now is a Body movieClip, with the movieClips LArm, RArm, LLeg, RLeg, and Head in it, all placed in a paperdoll sort of format on the torso of the body.

Now, in the course of this game you get upgrades in the form of cybernetic enhancements and whatnot. So, if you buy a rocket arm enchancement for your RArm, can you access such a thing like this:


assuming you’ve gone into the rightArm movieClip and made the frames/states necessary. Now, would it be better to have each appendage have it’s own class?

Class Arm extendsMovieClip{

etc. etc….

if(this.ArmType == “rocket”){





So on and so fourth….

No, additionally in this game, don’t ask me how, but if an enemy shoots at you and hits your arm, it has a chance of blowing off, could you do this:


health -= 20;

blowOff = Math.random() * 100;

if (blowOff <= 5){



but this is my basic idea to doing things. I imagine there are better ways to do this and if so, please let me know, assuming the idea above works at all.

Thanks in advance, regards.

Flag Post

that makes sence that it wouuld work but if your new to proggraming i wouldn’d recommend making such an elaborate game.

Flag Post

That would probably work very well. I reccomend using something higher then 5 for the blowOff chance though. It would fall off almost everytime. Nice idea :D.

Flag Post

hehe, well, that’s good to know that it would appear to work.

And albeit I’m new to actionscript, I’m not new to the concept of machine language. The idea of if statements and flowcharting and whatnot comes somewhat naturally to me, although if the one CS course I took is any indication, I’m not a very efficient coder yet(Finished an assignment with 130 lines of code, which then, my prof pointed out it could be done in ~15)

But I’m almost done with my first game, I just gotta buckle down and fix some of those afformentioned inefficiencies, stay tuned!

Flag Post

This is all do-able, but I would be really careful of doing a rag-doll style animation system for your second or third game. I’m not totally familiar with the tween system, so I’m not totally sure, but I think it’s more or less impossible to use the standard flash animation system with removable limbs and replaceable parts. Most games that do that kind of stuff have an inverse kinematics system that uses a skeleton structure. This is a really good solution, and I’m looking forward to working on something like that in the future, but it’s also pretty maths heavy and would be a rough way to start off.

Flag Post

well, it’s not ragdoll, everything’s gonna be relatively static in relation to the player, but the main point is going to be that if you have a weapon on the front side and an enemy runs into your side, it shouldn’t register a hit on an enemy but a hit to the player.

The game I’m working with now I actually made a method that takes a simple hitTest and uses the x/y values to determines which side was hit, it works fairly well but with the way sprites which are normally not square or rectangle shaped (i.e. all of them) it can have some odd outcomes, and with this game I wanted to incorporate _rotation for more of a top-down feel and the effects of sides change rapidly that way, thus making the former method completely impossible.

But, side question: can you scale thing up using the _height and _width parameters? if I assigned now values to these will it change them in game as needed? Another goal of this game is to convey scale in a unique fashion(kinda like Katamari Damacy, but not quite so dramatic), there’s so much I have to figure out and so many walkthroughs are crammed with techno babble that makes my head hurt XD

Flag Post

What you want is _xscale and _yscale i think. Something like that anyway.

I suppose when you said arms and legs as separate things, I assumed you meant animating and blowing off whenever you wanted. For something more static this would be a fine solution.

Some people here have even suggested cutting up the outline around a character into tiny line segments, making them individual objects and performing hittest on each one individually to get near pixel perfect accuracy.

If you have a body composed of a couple different pieces, each one should be able to do a hit test pretty easily. Good luck!