Wall

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 02 Apr 2011, 19:33

If you knew programming, you would know the basics and, in flash, hitTest is one of the basics. A simple Google search for "flash as2 walls":

http://www.google.com/search?hl=en&sour ... 1&aql=&oq=

just returned lots of great tutorials. All of the links in the 1st page are tutorials for walls, so you have in the total 9 tutorials plus 2 youtube videos. I think thats enough for you to learn how to use the hitTest

*EDIT*

And before starting shouting all over the place saying "these tuts arent for sfs", well, there arent tutorials for every situation. I mean its probable that there is no "how to add walls to avatarChat in SmartFoxServer Pro 1.6.9" tutorial, but the tutorials are for explaining how to use the scripting language, in this case, these tutorials explain how to use the hitTest.
Of course that the hitTest isnt the best way to do "walls" in a mmo, but its a beginning (i started with hitTest walls, now i use pathfinding - dont use pathfinding yet, its too difficult).

Hope you understand me
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.
ext0sus
Posts: 71
Joined: 17 Oct 2010, 16:14

Postby ext0sus » 02 Apr 2011, 19:39

IIIIIIIIIIIIIIIIIIIIIIII ALLREADYYYYYYYYYYYYYYYYYY KNOWWWWWWWWWWWW PROGRAMMINGGGGGGGGGGGGGGGGGGGGG.

Clearly not as well as you think. Collision detection is a very common problem (a general programming problem - not specifically to do with SFS, which may be the reason you couldn't find the information you were looking for?). One that has been addressed plenty of times.

http://www.google.co.uk/search?q=as2+collision+detection


AND IM JUST ASKING FOR ONE SIMPLE QUESTION

And I gave you a link to a post asking the same question. A post containing possible answers..
jim-jam
Posts: 21
Joined: 13 Mar 2011, 18:04

Postby jim-jam » 02 Apr 2011, 22:21

rjgtav wrote:If you knew programming, you would know the basics and, in flash, hitTest is one of the basics. A simple Google search for "flash as2 walls":

http://www.google.com/search?hl=en&sour ... 1&aql=&oq=

just returned lots of great tutorials. All of the links in the 1st page are tutorials for walls, so you have in the total 9 tutorials plus 2 youtube videos. I think thats enough for you to learn how to use the hitTest

*EDIT*

And before starting shouting all over the place saying "these tuts arent for sfs", well, there arent tutorials for every situation. I mean its probable that there is no "how to add walls to avatarChat in SmartFoxServer Pro 1.6.9" tutorial, but the tutorials are for explaining how to use the scripting language, in this case, these tutorials explain how to use the hitTest.
Of course that the hitTest isnt the best way to do "walls" in a mmo, but its a beginning (i started with hitTest walls, now i use pathfinding - dont use pathfinding yet, its too difficult).

Hope you understand me

The wall in the google search you told me doesn't have anything to do with mmo walls, im not looking for regular walls, im looking for places where you cannot click(mmo wall), dont try to link me to sfs tutorial, because the wall works but you cannot send chats, and I know how to collision detect, but I don't know how to make it so you cannot click on detect.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 02 Apr 2011, 22:32

if you want to prevent mouse clicks, add a mouse listener. then there check if the place where you clicked is walkable or not
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.
ext0sus
Posts: 71
Joined: 17 Oct 2010, 16:14

Postby ext0sus » 02 Apr 2011, 22:33

jim-jam wrote:but I don't know how to make it so you cannot click on detect.

Detect a collision using the cursor position in your onMouseDown function.

Code: Select all

onMouseDown = function()
{
   if (!my_mc.hitTest(_root._xmouse, _root._ymouse))
   {
      // Mouse button has been pressed and is not colliding with my_mc -          // allow the player to move here
   }

Where my_mc is the instance name of the MovieClip you don't want the user to be able to walk on.

NOTE: I haven't used AS2 in a long time, this is from memory.
jim-jam
Posts: 21
Joined: 13 Mar 2011, 18:04

Postby jim-jam » 02 Apr 2011, 23:37

ext0sus wrote:
jim-jam wrote:but I don't know how to make it so you cannot click on detect.

Detect a collision using the cursor position in your onMouseDown function.

Code: Select all

onMouseDown = function()
{
   if (!my_mc.hitTest(_root._xmouse, _root._ymouse))
   {
      // Mouse button has been pressed and is not colliding with my_mc -          // allow the player to move here
   }

Where my_mc is the instance name of the MovieClip you don't want the user to be able to walk on.

NOTE: I haven't used AS2 in a long time, this is from memory.

Where do I put that code plz? sorry and thx

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 35 guests