Avatar directions
Avatar directions
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:

Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
thanks,
in the documentation there is also written:
P.S.: I'm Sebastiano from Rainbow.
in the documentation there is also written:
I still don't get how to set the defaul direction in the Avatar Movieclip class.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.
P.S.: I'm Sebastiano from Rainbow.
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.
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
The SmartFoxServer Team
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.
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.
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.
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.