Avatar directions

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

Moderators: Lapo, Bax

Post Reply
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Avatar directions

Post by Bax »

In OpenSpace, in order to control the avatar direction, the onDirectionChange listener is called on the AvatarMovieClip class during the movement on the map. The event contains the "dir" parameter, an integer with the following meaning:
Image
Paolo Bax
The SmartFoxServer Team
nig3d
Posts: 164
Joined: 02 Jul 2008, 09:42

Post by nig3d »

thanks,

in the documentation there is also written:
the initial direction of the avatar (optional, default -1). If -1, the avatar is placed using the deault direction set in the Avatar MovieClip class.
I still don't get how to set the defaul direction in the Avatar Movieclip class.

P.S.: I'm Sebastiano from Rainbow.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

You decide the default direction, in the AvatarMovieClip class itself.
That sentence in the doc just means that if -1 is passed, you can place the avatar in a direction of your choice; if a different value is passed (0 --> 7) instead, you should place the avatar in that direction.
Paolo Bax
The SmartFoxServer Team
nig3d
Posts: 164
Joined: 02 Jul 2008, 09:42

Post by nig3d »

is it possible there is a bug in the onChangeDirection calling?
the function is correctly called, expect in the case I click exactly in the same orientation I'm already but opposite direction.

Let's say I'm in the position 10,50 (screen coords) and I click on 10,30, then I click again on 10,50, the onChangeDirection is not called even if I go up and down!
To be more clear if I go to SE to NW and back to SE the change direction to switch on SE direction is not called.

same for the X axis.

If instead I click in every place not on the same line, it works.
Please, advice me, maybe I misunderstood something, since your demos work.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

I double checked our examples, and the avatar moves correctly, so that method is working, otherwise we would see the avatar move backward.
Paolo Bax
The SmartFoxServer Team
nig3d
Posts: 164
Joined: 02 Jul 2008, 09:42

Post by nig3d »

it's true, but I'm sure the function is not called in my case because the trace in the onChangeDirection is not traced out.
I will check again.
nig3d
Posts: 164
Joined: 02 Jul 2008, 09:42

Post by nig3d »

yes I checked again,

the onChangeDirection is just not called in that situation. I will study your code to get the difference.
nig3d
Posts: 164
Joined: 02 Jul 2008, 09:42

Post by nig3d »

I think I misunderstood your code.
In your demo it works just only because you retrieve again the direction during movement start.
but even in your case, in this situation, the on change direction is not called. Maybe I misuderstood the meaning of the function, but IMO if I go up and down the direction changes even if I'm on the same line.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

We will check the code, thank you.
Paolo Bax
The SmartFoxServer Team
Post Reply