Skip to content

Click to move & pathfind #2358

Answered by eonarheim
salsa2k asked this question in Q&A
Jun 22, 2022 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

Hi @salsa2k

  1. I think you can just use the evt.worldPos in your moveTo no need to do any arithmetic on the pointer event world position. moveTo let's you specify an absolute word position, moveBy would be relative to the current actors position👍
  public MoveTo(evt: ex.Input.PointerEvent) {
    this.actions.moveTo(evt.worldPos, this.playerSpeed);
  }
  1. You can stop any running actions with the this.actions.clearActions() , I'll admit that method doesn't have the best name... perhaps "stop()" or "stopActions()"?

  2. We don't have anything built in for pathfinding, but we have done A* pathfinding in a jam game before (warning old version of excalibur). In this example we build up a grid of po…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by salsa2k
Comment options

You must be logged in to vote
1 reply
@eonarheim
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants