Walls
Walls
I'm making a multiplayer game based on avatarChat.fla and I have a problem. I need to be able to stop users from walking on walls and the chat bar etc, but I can't use this method: http://bit.ly/sfsnowalkonfalls because the movie clip is in the way of the speech bubbles, can I re arrange this, or is there a method I'm missing?
Re: Walls
Hello. Well, the only way is that one described on that website. Now you only need to play with the depths/layers to fit your own needs.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Re: Walls
Thanks. My other question is, my game is based upon avatarChat, is there a way I can set where people are standing everytime they press a button, so for example, I have a button for every door, when somebody clicks that door, it changes room and frame in the chatbox movieclip, can I change the users location on the stage by changing their X and Y variable and moving their avatar?
Re: Walls
Of course you can. You just execute the function that tweens the avatar to the new position (check the mouse listener code on the avatar chat, as it shows how to translate the character to the position where you clicked), and then you just update your UserVariables to the new position. If you want to move the avatar instantly to the new position, then you simply do myAvatar.x = blabla and myAvatar.y = blabla, and don't need to use the tween. In both cases, you need to update your UserVariables.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Re: Walls
Okay. Thanks for the info. I haven't managed to layer things properly to make the ground work, but I'm sure I'll find a way. So as for changing the variables and moving the avatarmc, the variable part is easy, but I don't quite understand how to move the character on the screen. If I just change the variable, will the server pick that up and send data telling the screen the user has moved, and the client move it? If not, how would I get the character to move on the person's screen, it's obvious for the other players, just send info to the server, the server will deal with the rest, but how does the movement on the screen of the player who moves work? Is it like either of these:?
Player clicks on screen > Variable changes, goes to server > server sends movement back to player, and avatarChat knows what to do
or
Player clicks > server told > Moves using some actionscript directly
Player clicks on screen > Variable changes, goes to server > server sends movement back to player, and avatarChat knows what to do
or
Player clicks > server told > Moves using some actionscript directly
Re: Walls
This is what you should do (which is AvatarChat's way):
1. User clicks on screen and its avatar starts moving.
2. Client sends new position (which is the mouse position), by setting it as an UserVariable, for example
3. Other clients receive this new position, and start moving the user's avatar to that desired position.
1. User clicks on screen and its avatar starts moving.
2. Client sends new position (which is the mouse position), by setting it as an UserVariable, for example
3. Other clients receive this new position, and start moving the user's avatar to that desired position.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Re: Walls
Okay, I fixed the walls, I did it reverse, so the sky is not walkable and set it so it doesn't use the hand cursor. I still don't understand how I'd go around changing the location when I enter a room. What actionscript would I use on the button.
Re: Walls
You just need to change the position of the avatar and then update the user variables... Something like:
myAvatar._x = myXValue;
myAvatar._y = myYValue;
smartfox.setUserVariables({px:myAvatar._x, py:myAvatar._y, init:false});
myAvatar._x = myXValue;
myAvatar._y = myYValue;
smartfox.setUserVariables({px:myAvatar._x, py:myAvatar._y, init:false});
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Re: Walls
rjgtav wrote:You just need to change the position of the avatar and then update the user variables... Something like:
myAvatar._x = myXValue;
myAvatar._y = myYValue;
smartfox.setUserVariables({px:myAvatar._x, py:myAvatar._y, init:false});
Errr, I can't seem to do that
Could you please put that in to a button code and set the position to 50,50 on the screen, I'll change it myself
Re: Walls
Code: Select all
on(release) = function(){
_root.myAvatar._x = 50;
_root.myAvatar._y = 50;
_root.smartfox.setUserVariables({px:_root.myAvatar._x, py:_root.myAvatar._y, init:false});
}
Important note: I don't work with AS2.0 for some years, so I'm not sure whether that code is right or not. Please check the examples and kindly read and understand them.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Re: Walls
rjgtav wrote:Code: Select all
on(release) = function(){
_root.myAvatar._x = 50;
_root.myAvatar._y = 50;
_root.smartfox.setUserVariables({px:_root.myAvatar._x, py:_root.myAvatar._y, init:false});
}
Important note: I don't work with AS2.0 for some years, so I'm not sure whether that code is right or not. Please check the examples and kindly read and understand them.
Okay, thanks!
Return to “SmartFoxServer 1.x Discussions and Help”
Who is online
Users browsing this forum: No registered users and 93 guests