Building a MMO
Building a MMO
Hi there again. I have a problem making the movement of the character. I want to make that in the client, the character is always in the center (like pokemon) and the other clients see the player moving when it moves. Please someone help me. thank you.
-
- Posts: 7
- Joined: 02 Jun 2009, 22:33
Basically on the client side, youll want the clients "hero"character to move, BUT move the MC that the hero is in, in the opposite direction that the hero just moved, this will keep the hero in the same place (aka the middle) but the other characters will move around where they should.
Now are you having trouble sending the movement to other clients, or just wondering how to keep the "main" guy in the center?
Now are you having trouble sending the movement to other clients, or just wondering how to keep the "main" guy in the center?
-
- Posts: 7
- Joined: 02 Jun 2009, 22:33
http://www.smartfoxserver.com/docs/
Check out section 5.6, thats where its all at.
I am actually working on my own tutorial for people who want to get straight to making a simple game (and skip some of the "chat" sections that the docs build on) However, section 5.6 has the basic idea of movement, when you move, you need to change that useres uservars, and then make the other clients pick up that update, and move the character to the right location.
Check out section 5.6, thats where its all at.
I am actually working on my own tutorial for people who want to get straight to making a simple game (and skip some of the "chat" sections that the docs build on) However, section 5.6 has the basic idea of movement, when you move, you need to change that useres uservars, and then make the other clients pick up that update, and move the character to the right location.
Ty for the help. i'm already understanding a little of the script but i have some problems.
If i put when the mouse is down, the character moves, it works bu when i put when i press a key, the character moves, the character doent's move
I want to do that when the key is down, the other clients see the character moves and the animation of moving.
can anyone help me?
This is my code:
If i put when the mouse is down, the character moves, it works bu when i put when i press a key, the character moves, the character doent's move
I want to do that when the key is down, the other clients see the character moves and the animation of moving.
can anyone help me?
This is my code:
Code: Select all
function walk(horizontal,vertical){
avatarMC._x += horizontal;
avatarMC._y += vertical;
if (inited)
{
if (!_global.isBusy)
{
var px:Number = int(avatarMC._x)
var py:Number = int(avatarMC._y)
if ((px > avatarW/2) && (px < areaW - avatarW/2) && (py > avatarH/2) && (py < areaH - avatarH/2))
{
// save new variables
// Please note that init is set to false:
// this means that we're only moving somewhere and we don't need to init tha avatar
smartfox.setUserVariables({px:px, py:py, init:false})
// method derived from the [flashAPI].as
// moves the mc using the "Quint" equation, with "InOut" easying
// to the new px,py position in 100 milliseconds.
}
}
}
}
if(Key.isDown(Key.RIGHT)){
_root.walk(5,0);
}
if(Key.isDown(Key.LEFT)){
_root.walk(-5,0);
}
myMouse.onMouseDown = function()
{
_root.walk(0,-5);
}
if(Key.isDown(Key.DOWN)){
_root.walk(0,5);
}
Return to “SmartFoxServer 1.x Discussions and Help”
Who is online
Users browsing this forum: No registered users and 61 guests