Here's something to clear up everything about confusion about jumping, and platforms and blah blah blah. :).
Side to Side Movement Script (Place in Character MC)______________________________________________________
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x+=5;
} else if (Key.isDown(Key.LEFT)) {
this._x-=5;
}
}
Jumping Script
___________________________________
* Don't forget to label MC "ground" if using exact script and place this script in your character MC!!!!
onClipEvent (load){
vel_y = 0;
jumping = false;
}
onClipEvent ( enterFrame){
if (Key.isDown(Key.SPACE) && !jumping) {
vel_y =20;jumping = true;}
if (jumping == true) {
vel_y -=1;
if ( vel_y <=-10){ vel_y=-10;}
this._y -= vel_y;}
if (_root.ground.hitTest (this._x,this._y+45,true))
{vel_y = 0; jumping = false;}
}
Note: This script includes the Platform idea. Make an MC that is a line or whatever your character will start(e.g. the ground in your game) of on when the game starts and label it "ground". This is not the name you give the MC when making it, the one you see in your library. This is different. Open the instance panel and select the MC. This info should show:
Behavior: Movie Clip
Name: (THIS IS WERE YOU PUT YOUR LABEL NAME OF YOUR MC)
I'm Sorry if this is boring the more advanced,but I don't want to repost a million times. Labelling basically gives your MC an identity that the script in your Character MC can identify it.
Ok I'm sorry for that rambling tangent. Back to the point. So after you've put the jumping script in your MC and labelled your other MC properly, say your MC which is supposed to be the ground, from the script I've given you the other Ground MC should be solid to your character. You can jump up and down on it as much as you want, you won't go through.
Ok Well, I really hope this helps seeing as I spent a hell of a long time typing, and If anything about this is unclear or you have any other questions,please post again!!!!!
Note: For those who don't know what MC stands for, it's "Movieclip"
~Fargate