Skip to content

+ Avatar - onStopMovementCallback#136

Open
tetreum wants to merge 2 commits into
jankuss:masterfrom
tetreum:patch-2
Open

+ Avatar - onStopMovementCallback#136
tetreum wants to merge 2 commits into
jankuss:masterfrom
tetreum:patch-2

Conversation

@tetreum

@tetreum tetreum commented Dec 8, 2022

Copy link
Copy Markdown
Contributor

This lets queue walk command after walk with something like:

this.room.onTileClick = async (position) => {
          this.ownAvatar.clearMovement();

          const path = await this.findPath(position);
          
          if (path.length > 0) {
            this.queueAnimation(path, 0);
          }
};

queueAnimation (waypoints, i) {
      const waypoint = waypoints[i];
      this.ownAvatar.onStopMovementCallback = undefined;
      this.ownAvatar.walk(waypoint.roomX, waypoint.roomY, waypoint.roomZ, {direction: waypoint.direction});

      i++;
      
      if (typeof waypoints[i] !== "undefined") {
        this.ownAvatar.onStopMovementCallback = (e) => {
          this.queueAnimation(waypoints, i);
        };
      } else {
        this.ownAvatar.onStopMovementCallback = undefined;
      }
    }

image

Comment thread src/objects/avatar/Avatar.ts Outdated
Comment thread src/objects/avatar/Avatar.ts
@tetreum tetreum changed the title + Avatar - onStopWalkingCallback + Avatar - onStopMovementCallback Dec 13, 2022
@tetreum tetreum requested a review from jankuss December 13, 2022 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants