PDA

View Full Version : Maple Story Based Game!



smack_boom
May 22nd, 2005, 11:01 PM
Anyone know how to make a game similar to maple story?
I need help on a moving character with jumping function(with gravity)

If anyone knows please post it Here. :p:

TheCanadian
June 9th, 2005, 11:37 PM
Well I have never seen maple story but the movement of characters is pretty simple in Flash. Place this code into the actions panel of the movie clip you wish to move.


onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= 5;
}
}

Now for the explanation:

onClipEvent (enterFrame) {
This means that the code will be activated when the movie clip enters the frame.

if (Key.isDown(Key.LEFT)) {
This line of code basically says: If the left key is down, preform the following actions:

_x -= 5;
This moves the movie clip along the x (horizontal) axis at a rate of -5 pixels per frame.

The above only moves the character left so you will need the rest of the code. The final script should look like this:



onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= 5;
}
if (Key.isDown(Key.RIGHT)) {
_x += 5;
}
if (Key.isDown(Key.UP)) {
_y -= 5;
}
if (Key.isDown(Key.DOWN)) {
_y += 5;
}
}



After adding this code the character will move in 8 directions (up, down, left, right and diagonal). If you are building a platform game, which is what it sounds like, you may want to remove the actionscript which moves the movie clip along the y (vertical) axis. As for jumping and gravity, I don't really know so you are better off hearing it from someone else. Good luck with your game.