Grid based pathfinding using RTS behaviour

This forum is currently in read-only mode.
From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • I see Toralord beat me to it with this one but this is my take on grid based pathfinding.

    Wot I did was:

    Use the Hunter sprite with the RTS behaviour and changed the settings so it could not move but would point in the right direction based on whatever path it has determined.

    Always set its position to Hunter2 which has the grid behaviour

    Then, depending on the Hunter's RTS direction, changed the angle of Hunter2 and let the grid movement do its thing. Technically you probably shouldn't even need to change Hunter2's angle or worry about whether or not it is blocked or most of the other checks you see in the code but I would prefer that the pathfinding spaz out and not move than end up in a solid object.

    Piece of cake.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • the reason I don't use the RTS behavior is that it is not accurate enough for gird based movement.

    when I first started making a turn based strategy game I started with the RTS behavior and found out the for very slow speed it work okay but the faster you set the speed of the sprite the more the bad accuracy became apparent. I assume that is why you added the ever millisecond 500 condition. I also realized the RTS behavior recalculate every tick which is great for RTS game but not for TBS.

    with all that being said, I love the simplicity of this cap. great job

  • If the RTS behavior could limit itself to certain kinds of objects or families for its travel, rather than just avoid them, I would probably use this exact approach myself. It's incredibly handy and consise, the way you've done it!

    As it stands, I'm trying to solve basically the opposite problem, which turns out to be a bit more work. This is a nice bit of inspiration, though (yours too, toralord).

    Oh, just one little suggestion: Movement's a bit smoother if you change out the "Every 500 milliseconds" condition for "If != Hunter 2 is moving". Assuming you don't want the pauses, anyway.

  • Nice soultion!

    How would you set it up when you have multiple "hunters"(enemies)?

  • Can anyone help me out on this one? Please... ;P

    Here is the link to the original cap

    Old cap

  • no problem man

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