I am trying to write a platform game and have followed the tutorial on this site, however I want to write it myself, or most of it anyway.
I am having trouble with the jumping, I dont really understand the jumping method in the tutorial.
I have tried a simple code but it looks really bad, I wanted something that will decrease in size and then start to fall, I have no idea how to do this.
my code so far is:
onClipEvent(load){
speed = 10;
grav = 9;
jumping = false;
falling = true;
}
onClipEvent(enterFrame){
if (falling){
_root.ground._y-= grav;
}
if(Key.isDown(Key.RIGHT)){
_root.ground._x -= speed;
}
if(Key.isDown(Key.LEFT)){
_root.ground._x += speed;
}
if(_root.ground.hitTest(this._x, this._y, true)){
falling = false;
}
if(Key.isDown(Key.UP) && !jumping){
jumping = true;
}
if(jumping){
_root.ground._y+= jump;
}
}
any help would be great