Alright guys, I'm making a game (almost a week in) and I programmed my character to jump! But I also have problems with him touching the ground, by this I mean he jumps... great... falls.... awesome... but doesn't nessecarily touch the ground. Im thinking that this code that I have is effecting it, but my registration point is at the very bottom of my character.
When the char. hits the ground it sends it up 16 pixels. I've been editing this code for quite awhile now. Here is the full code from which I scripted.
(Please note, that I have been doing actionscripting for almost more then a year now, but it took me awhile to grasp the concept. My art skills are OK, but I am a programmer. I just need to collab with an artist, and I'll be happy

)
| Code: |
onClipEvent (enterFrame) {
Velocity = 25;
if(gold>1000000);
speed = 10;
if(silver>1000000);
speed = 10;
if(copper>1000000);
speed = 10;
if (Key.isDown(Key.LEFT)) {
this._x -= Velocity;
gotoAndStop(2);
}
if (Key.isDown(Key.RIGHT)) {
this._x += Velocity;
gotoAndStop(1);
}
if (Key.isDown(Key.SPACE) && !jumping) {
termVelocity = 36;
jumping = true;
}
if (jumping == true) {
termVelocity -= 2;
if (vel_y<=-15) {
vel_y = -15;
}
this._y -= termVelocity;
}
if (_root.ground.hitTest(this._x, this._y+35, true)) {
vel_y = 0;
jumping = false;
}
}
onClipEvent (enterFrame) {
this._y += 16;
if (_root.ground.hitTest(this._x, this._y+1, true)) {
this._y -= 16;
}
} |
If anyone sees a problem with my script right off the bat please do let me know.
Thanks in advance!