# Making Mario Like Game, need help!

**URL:** https://forum.kirupa.com/t/making-mario-like-game-need-help/183336
**Category:** flash
**Created:** [March 25, 2006, 11:41pm UTC](https://forum.kirupa.com/t/making-mario-like-game-need-help/183336 "2006-03-25T23:41:45Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Super\_Larryo](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@Super\_Larryo](https://forum.kirupa.com/u/Super_Larryo)
#### Post date: [March 25, 2006, 11:41pm UTC](https://forum.kirupa.com/t/making-mario-like-game-need-help/183336/1 "2006-03-25T23:41:45Z")

</div>

I have made almost everything perfect in the game, but I am missing some crucial parts.

1. When I hit the Up key, Mario will jump. The problem is that he will continuously jump until I start to move left or right.
2. I am trying to make it so that if Mario jumps and hits a goomba while he jumps, the goomba will die. Also, when Mario isn’t jumping, and he hits the goomba, he will die instead. I can’t get either to work, so I was wondering if somebody had some sample code.
3. I made a hitTest for Mario so when he hits the ground, he will stop falling. Problem is that he falls half way through the ground before he stops.

My code for mario:

onClipEvent (load) {  
vel\_y = 0;  
started = true;  
jumping = false;  
xspeed = 5;  
this.stop();  
\_quality = “high”;  
}  
onClipEvent (enterFrame) {  
if (started) {  
if (move) {  
if (Key.isDown(Key.LEFT)) {  
this.gotoAndStop(“run”);  
this.\_xscale = -100;  
}  
if (Key.isDown(Key.RIGHT)) {  
this.gotoAndStop(“run”);  
this.\_xscale = 100;  
}  
}  
}  
}  
onClipEvent (enterFrame) {  
if (started) {  
if (Key.isDown(Key.LEFT)) {  
this.\_x -= xspeed;  
}  
if (Key.isDown(Key.RIGHT)) {  
this.\_x += xspeed;  
}  
if (Key.isDown(Key.UP) && !jumping) {  
this.gotoAndStop(“jump”);  
move = false;  
vel\_y = 9;  
jumping = true;  
}  
if (jumping == true) {  
vel\_y -= 1;  
if (vel\_y\<=-9) {  
vel\_y = -9;  
}  
this.\_y -= vel\_y;  
}  
if (!\_root.groundtest.hitTest(this.\_x, this.\_y+15, true) && !jumping) {  
fall += 1;  
move = false;  
this.gotoAndStop(“jump”);  
if (fall\>9) {  
fall = 9;  
}  
this.\_y += fall;  
}  
if (\_root.groundtest.hitTest(this.\_x, this.\_y+15, true)) {  
if (vel\_y\<=1) {  
fall = 0;  
vel\_y = 0;  
jumping = false;  
this.jump.gotoAndStop(“run”);  
move = true;  
}  
}  
}  
}  
onClipEvent (keyUp) {  
if (move) {  
if (Key.getCode() == Key.RIGHT) {  
this.gotoAndStop(“idle”);  
}  
if (Key.getCode() == Key.LEFT) {  
this.gotoAndStop(“idle”);  
}  
if (Key.getCode() == Key.DOWN) {  
this.gotoAndStop(“idle”);  
xspeed = 5;  
}  
}  
}  
I have followed almost every tutorial I’ve seen for jumping and hitTests, but I just can’t seem to get it right. Help would be appreciated.
