graphics for avatar sit down

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

Moderators: Lapo, Bax

kuzniz
Posts: 19
Joined: 05 Jan 2012, 07:21

graphics for avatar sit down

Postby kuzniz » 16 Dec 2012, 00:30

Hi there,

Can I get a demo of avatar sitiing down code ? , I am not able to make the proper graphics for it.

I Have tried to make the avater to move near the chair by "movemyavatar" command - it work.

then I have teleport it to the chair (work also) and change the state to sit "this.openSpace.setMyAvatarState("sit");" .

then I have tried to change the exampleavatar.as as folowing ( can not make it work)

.....
private function drawAvatar():void
{
var sex:String = skin.sex
var race:String = skin.race
var hair:String = skin.hair
var bust:String = skin.bust
var legs:String = skin.legs

if (_state == "sit")

{

if (bodyMC != null && bodyMC.name != "")
removeChild(bodyMC);
if (legsMC != null && legsMC.name != "") {
removeChild(legsMC);
legsMC=null;
}
if (bustMC != null && bustMC.name != "")
{
removeChild(bustMC);
bustMC=null;
}
if (hairMC != null && hairMC.name != "")
{
removeChild(hairMC);
hairMC=null;
}

var clazz:Class = getDefinitionByName("m_sit_ne") as Class
var mc:MovieClip
mc = new clazz() as MovieClip
mc.name = "m_sit_ne"
mc.x = X_OFFSET
mc.y = Y_OFFSET
addChild(mc);
....


when I have "m_sit_ne" sitting image of the avatar in the right direction.

what am i doing wrong ?

can i get a demo of siting or acting avatar ?

thanks for advance.
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: graphics for avatar sit down

Postby Bax » 17 Dec 2012, 10:32

Maybe you didn't export the new library containing the sitting avatar graphics?
Paolo Bax
The SmartFoxServer Team
kuzniz
Posts: 19
Joined: 05 Jan 2012, 07:21

Re: graphics for avatar sit down

Postby kuzniz » 22 Dec 2012, 11:01

Hi,

thanls for your replay , the problem was the if statment , I have needed to created an object ans to pass it to the state and not work with just a string something like

var avatarState:Object = {}
avatarState.id = "sit"
this.openSpace.setMyAvatarState(avatarState);
and the avatar is now sitting when requested.

now my secound question is how to make it got stand again , how do i catch the avatar pressing on of the other tile in the map (walking tiles )?

regards
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: graphics for avatar sit down

Postby Bax » 22 Dec 2012, 12:57

You could add a click trigger on all the walkable tiles of the map.
Otherwise you could try adding a click event on the whole OpenSpace object: when the event is fired you could make the avatar stand.
This of course requires that the user clicks again to move the avatar.
Paolo Bax
The SmartFoxServer Team

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 17 guests