My character just falls through the ground in my game, the floor is the base, and block 13 is about four platforms (all one symbol). Below is my code, it's directly in the movie clip. I'm using AS2. Any help appreciated, thanks.
Below is my code/script:
ActionScript Code:
// Stephen Gamage
onClipEvent(load){
speed = 7;
jumpspeed = 7;
gravity = 0;
gravityfaster = 0.3;
jumping = false;
}
onClipEvent(enterFrame){
if(Key.isDown(Key.LEFT)){
this._x -= speed;
}
if(Key.isDown(Key.RIGHT)){
this._x += speed;
}
if(Key.isDown(Key.SPACE)){
jumping = true;
}
if(jumping){
this._y -= jumpspeed;
}
gravity += gravityfaster;
this._y += gravity;
if(this.hitTest(_root.floor1)){
this._y -= gravity;
gravity = 0;
jumping = false;
}
/*The code below flips the character either
left or right depending on which key is down.
*/
if(Key.isDown(Key.LEFT)){
gotoAndStop("right");
}
if(Key.isDown(Key.RIGHT)){
gotoAndStop("left");
}
}
Thanks