Make avatar stop/prevent avatar movement

Post here your questions about the OpenSpace 1.x or notify bugs and suggestions.

Moderators: Lapo, Bax

Post Reply
julifos
Posts: 33
Joined: 10 Oct 2009, 23:33
Contact:

Make avatar stop/prevent avatar movement

Post by julifos »

Hi all!

I'm trying to do a "simple" thing: restrict avatar movement under certain conditions. Let's say I have a walkable tile which contains FIRE. Only firemen can enter in-there. The rest of people should stay in place when they click that tile (ie, don't move in!).

I don't find a way to restrict movement. My only thought is issuing moveMyAvatar(currentTile.x, currentTile.y). But seems OpenSpace doesn't like that. Seems to be some kind of collission between the start-tiles defined by OpenSpace (upon user-click) and the ones defined by my moveMyAvatar, which makes OpenSpace ignore the second request (moveMyAvatar).

Do you know if there is some way or workaround to stop the avatar or make him return to the previous tile? For cosmetic purposes I would like that the avatar doesn't move a single pixel from its original position, if that is possible. Else I would be willin' to implement whatever thing which gives the functionality, in despite of the cosmetic issues.

Thanks in advance for any hints!
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

Sorry, it's not possible to stop an avatar. What you need to do can be achieved using OpenSpace 2 (see the IOpenSpace.preAvatarMoveValidator function in the API documentation)
Paolo Bax
The SmartFoxServer Team
julifos
Posts: 33
Joined: 10 Oct 2009, 23:33
Contact:

Post by julifos »

OK, thanks!

Anyway, I think I found a couple of workarounds which fit my needs.
Post Reply