Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+ Avatar - onStopMovementCallback #136

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

tetreum
Copy link
Contributor

@tetreum tetreum commented Dec 8, 2022

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

src/objects/avatar/Avatar.ts Outdated Show resolved Hide resolved
src/objects/avatar/Avatar.ts Outdated Show resolved Hide resolved
@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