mario game
Filed Under mercialleasing.com |
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
}
}
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?
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)
}
}
and please use the AS tags when posting code.