Smooth grid movement

Get help using Construct 2

Post » Mon Dec 12, 2016 12:47 am

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:
suggestion-grid-based-pathfinding-behaviour_p731988?#p731988

I tweaked it a bit and I got it working with more than one sprite:
https://www.dropbox.com/s/5ppu7ihtyp69o ... .capx?dl=0

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!
B
125
S
43
G
41
Posts: 849
Reputation: 28,260

Post » Mon Dec 12, 2016 2:13 am

Got it working thanks to @rexrainbow 's spline plugin:
behavior-rex-spline_t178563

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)
B
125
S
43
G
41
Posts: 849
Reputation: 28,260


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests