Pacman movement : make movement switch with ease

0 favourites
  • 3 posts
From the Asset Store
Explore and retrieve all Magical Books from the hidden Orc's Lair in this "PacMan-styled" game.
  • Dear construct 3 users,

    For a new project I wanted to reproduce the movement of Pacman. Here is what I want :

    - Pacman moves in one direction, and keep moving even if the user release the key.

    - Pacman keeps moving to the previous direction if the new direction is impossible, until the next possibility to move in the wished direction.

    Currently, my code very simple allows Pacman to match my first requirement but not my second one. Indeed, if I decide to move right and if there is a wall on the right, my Pacman just stop to move at all. I have no idea how I can reproduce this specific way of movement, which is quite important for my future game.

    Here is my game : easyupload.io/d0lp0n

    Thanks for your help.

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I recommend using invisible helper sprites on either side of your main sprite. Upon pressing a direction, the respective helper sprite gets "activated". If the helper sprite is in activated state and not overlapping a wall, then apply the "turn".

  • I recommend using invisible helper sprites on either side of your main sprite. Upon pressing a direction, the respective helper sprite gets "activated". If the helper sprite is in activated state and not overlapping a wall, then apply the "turn".

    Hey oosyrag,

    That's a sweet idea, and it "almost" works.

    - if the helper sprite is too big, the time that is not overlapping a wall makes it impossible to turn because the detection frame is too small.

    - if the helper sprite is too small, it's work BUT it allows also the player to be stuck since the detection sprite is not overlapping but the player is "bigger" than the overlapping area and so cannot move.

    Finally, by exploring the different possibilities, found out that I can use condition like "TileMovement can move 1 cells [direction]" which makes the trick.

    Here is the complete solution, if anyone wants to reproduce this behavior.

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