Ok, so far, the jumping is working, but now the other function wont work! I have tried everything in my power to fix this, but it wont work. If any one has any suggestions or help, it would be very helpful. Thanks. Oh, and here is my code:
Scrolling();
Moving();
StartGame();
Dying();
function StartGame() {
move = true;
xspeed = 2;
vel_y = 0;
jumping = false;
_root.onEnterFrame = Moving;
}
function Moving() {
if (Key.isDown(Key.RIGHT) && move) {
hero.gotoAndStop("run");
} else if (Key.isDown(Key.LEFT) && move) {
hero.gotoAndStop("run");
} else {
hero.gotoAndStop("edle");
}
if (Key.isDown(Key.UP) && !jumping) {
hero.gotoAndStop("jump");
vel_y = 20;
jumping = true;
}
if (jumping == true) {
vel_y -= 1;
if (vel_y<=-20) {
vel_y = -20;
}
hero._y -= vel_y;
}
}
function Dying() {
if (hero.sword.hitTest(enemy)) {
enemy.gotoAndStop("dead");
score += 5;
}
}
peace