0 Favourites

Smooth grid movement

  • Hi everyone,

    I'm working on a game for LudumDare and I was surprised to know that the official pathfinding behavior does not allow you to move something smoothly in a grid-based map, from tile to tile. Unless I'm missing something.. the way it works right now the sprite will rotate to go to the new direction and this makes it go over the walls in a maze for instance..

    I found this example which is perfect for what I need:

    I tweaked it a bit and I got it working with more than one sprite:

    But for some reason no other enemy sprites will move while one is already moving and I can't figure out why. I'm sure it's related to the "for each node/for each enemy" loop but I can't get my head around it.

    Any help is appreciated! I've also looked into other plugins/examples but they confused me even more so I was hoping I could make this work.

    How do I make it so all enemies move at the same time?

    Thanks!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Got it working thanks to rexrainbow 's spline plugin:

    Only had to add

    "on enemy created -> spline add point (enemy.x,enemy.y)"

    (so it creates a spline point where the enemy itself is created so he begins moving from there)

    and

    "on pathfinding path found -> spline add point (node.x, node.y)"

    (so every new node created is added as a spline point in order of creation)

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