+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 13 of 13

Thread: Display different avatars in scene

  1. #11
    Former Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,709
    Thanks
    84
    Thanked 1,178 Times in 1,165 Posts
    What's your other question? And please do ask questions about the RejoinGame example, so that I can improve the tutorial.
    Teresa Carrigan
    Senior Software Developer
    Janus Research Group, Inc.
    previously
    Senior Engineer
    Electrotank, Inc.

  2. #12
    Junior Member
    Join Date
    Jan 2012
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts
    My other question was about global animation, but I just put it inside of a new thread to keep this topic about avatars. My action script isn't that good, but from what I can see where can I change the graphic of the shape. Say I wanted to have a egg shape added into that. I see that you have different avatar types defined in Avatar Types and when they choose an avatar you are setting the avatar type in choose avatar screen. Where would you call to show the graphic to other users that you are a circle, or box.

  3. #13
    Former Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,709
    Thanks
    84
    Thanked 1,178 Times in 1,165 Posts
    In the RejoinGame example, if you want to change your avatar shape here is the chain of events:
    1. In ChatRoomScreen.buildUIElements which is called once, a button is created on the UI that when clicked calls onChangeAvatarClick

    2. onChangeAvatarClick displays the overlay (ChooseAvatarScreen) that allows the user to choose one of several existing avatars. That overlay remembers which avatar was clicked, and sends an OK event back to ChatRoomScreen.

    3. ChatRoomScreen hears the OK event from ChooseAvatarScreen and onChooseAvatarClick is invoked.

    4. onChooseAvatarClick sends a message to the plugin with the avatar type that was chosen. This is an AVATAR_STATE_REQUEST.

    5. Room plugin tells server plugin of the avatar change, stores the info itself in its own data structure about the user, and sends AVATAR_STATE_EVENT to the room.

    6. All users get the AVATAR_STATE_EVENT about this user's change of avatar. onPluginMessageEvent invokes addOrUpdateUser.

    7. addOrUpdateUser in this use case finds the Player object in PlayerManager, so it skips the (p == null) case. It finds a property on the EsObject that is named AVATAR_TYPE, so it gets the AvatarType from that value, and updates the Player object.

    8. Player.as's set avatarType function then updates the value of avatarType and then invokes AvatarControl.handleAvatarTypeChange, which invokes GenericAvatar.handleAvatarTypeChange.

    9. GenericAvatar.handleAvatarTypeChange calls initButton, which removes the current avatar for this player, makes a new one, and adds it to the display.

    edit: it's a different chain of events for choosing the avatar in the first place. Do you need a similar write up for that?
    Teresa Carrigan
    Senior Software Developer
    Janus Research Group, Inc.
    previously
    Senior Engineer
    Electrotank, Inc.

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts