PACMAN-like sprite movement w pathfinding behavior

0 favourites
  • 5 posts
From the Asset Store
Pathfinding AI
$2 USD
80% off
Units do not overlap each other and use different ways if there are several free ways.
  • Hello, got pacman sprite with the following settings:

    Then I set pathfinding cell-size to 28 - just like my sprite-instance dimension.

    I can't figure out the corner movements: why pacman is moving diagonal? I want him to pass through the points I created on-path-found !

    In other words, I want the 4-directions movements with touch destination and pathfinding behavior. Is there a way ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hey sturm30

    you can combine pathfind with the 8-direction behavior. Here an old example i made:

    and a file for C3:

    1drv.ms/u/s!Ap_-qxoGKbDcg1PpU72bc-aJp7c2

  • Understood.

    Tried to copy exactly your 10events but: pacman moves if controlled by keyboard arrows, as soon as i touch my screen (or click), pacman stops and it is more responsive on arrows inputs.

  • The example was general in order to understand the principle. Here again exactly for your goal. Do not forget to disable 'Default control' of 8Directions.

  • I figured to manage the movement on a grid, 32px sized.

    Here is the single-file Construct2 project.

    My goal is now to make pacman move with Touch events and PathFinding behavior. If I set pathFind->cell border to -1 value, pacman does not follow the path next to the wall set (as classic pacman level).

    If i set pathFind->cell border to -2 value, pacman follow the path next to walls but does not recognize walls as obstacles.

    By the way, I notice sometimes pacman just goes out of the grid, but I can't figure out why it does so.

    Consider I follow this guideline for grid movement.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)