# Mario game

**URL:** <https://forum.kirupa.com/t/mario-game/101965>\
**Category:** Uncategorized\
**Created:** [February 18, 2004, 11:44am UTC](https://forum.kirupa.com/t/mario-game/101965 "2004-02-18T11:44:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lenf](https://avatars.discourse-cdn.com/v4/letter/l/2acd7d/32.png) [@lenf](https://forum.kirupa.com/u/lenf)\
**Post date:** [February 18, 2004, 11:44am UTC](https://forum.kirupa.com/t/mario-game/101965/1 "2004-02-18T11:44:34Z")

</div>

im making a mario game and i need some help.  
ive got an mc with mario standing, running right, running left, jumping and when he dies.

how can i make it so when he jumps the running speed carrys on so he moves across when jumping?  
heres the code:

onClipEvent(enterFrame){  
if(key.isDown(key.RIGHT)){  
gotoAndPlay(2)  
\_x+= 5;  
}  
if(key.isDown(key.LEFT)){  
gotoAndPlay(21)  
\_x-= 5;  
}  
if(key.isDown(key.UP)){  
gotoAndPlay(6)  
}  
if(key.isDown(key.DOWN)){  
gotoAndPlay(5)  
}  
if((this.\_x \> 100)&&(key.isDown(key.RIGHT))){  
\_root.bg.\_x -= 5  
}  
if(this.hitTest(\_root.border)){  
this.\_x -= 5  
}  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 18, 2004, 12:25pm UTC](https://forum.kirupa.com/t/mario-game/101965/2 "2004-02-18T12:25:45Z")

</div>

maybe this works?

[AS]  
onClipEvent(enterFrame){  
if(key.isDown(key.RIGHT)){  
gotoAndPlay(2)  
\_x+= 5;  
runs = “right”;  
} else {  
runs = “”;  
}  
if(key.isDown(key.LEFT)){  
gotoAndPlay(21)  
\_x-= 5;  
runs = “left”;  
} else {  
runs = “”;  
}  
if(key.isDown(key.UP)){  
gotoAndPlay(6)  
if (runs == “right”) {  
\_x+= 5;  
} else if (runs == “left”) {  
\_x-= 5;  
}  
}  
if(key.isDown(key.DOWN)){  
gotoAndPlay(5)  
}  
}  
[/AS]

and please use the AS tags when posting code.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 18, 2004, 5:23pm UTC](https://forum.kirupa.com/t/mario-game/101965/3 "2004-02-18T17:23:14Z")

</div>

nah dont work

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2004, 12:30pm UTC](https://forum.kirupa.com/t/mario-game/101965/4 "2004-02-20T12:30:59Z")

</div>

I don’t think i have an answer to your question ('cause i’m a newbie), but personally i would do the jumping movement all with an actionscript.

I have a question: in a platform game like metal slug or mario bros, how can i do the sliding scenary? shall i use a very long image?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2004, 5:22pm UTC](https://forum.kirupa.com/t/mario-game/101965/5 "2004-02-20T17:22:45Z")

</div>

thats what i do.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2004, 5:32pm UTC](https://forum.kirupa.com/t/mario-game/101965/6 "2004-02-20T17:32:01Z")

</div>

If you wanna get real nice effects, make a couple of over-lapping layers of long images, that move at slightly different speeds. You’ll get the effect that the background images are further away. Use this _carefully_ since you can end up with choppy movement, if you over-do it, stick with only 2, or 3 layers…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2004, 8:03pm UTC](https://forum.kirupa.com/t/mario-game/101965/7 "2004-02-20T20:03:28Z")

</div>

i dunno id think that the code that kalliban gave would work
