0 Favourites

How do I use pathfinding with car behavior?

  • TL:DR Sprite with car behavior, while moving along non-fixed path (randomly generated).

    Hi guys, I'm making a top down ship game where of course I'm using car behavior for the player. But since I will include AI, NPC, Bots, however you wanna call it, I want them to have car behavior while they move to their path, which their pathpoint is random(LayoutWidth), random(LayoutHeight) (for X,Y) since they will be patrolling in random places within the layout. The code I have so far doesn't make the sprite move.

    (ignore mouse wheel events)

    Basically, I don't want the sprite to have the standard path finding movement when a path is created. I want it to have the car like movement.

    I've seen tutorials, but they use Waypoints (wp) and and adjustment, which the waypoint is fixed and not randomly generated (ex: racing games with fixed waypoints on racing tracks). I tried to include setting up waypoints(nodes) at the Sprite's path position, but still didn't work. I used code Sprite.Pathfinding.Currentmode but it didn't work neither.

    Any demonstrations using capx are appreciated, if it's still not understood, I can link my capx file so u can look it up accurately.

    After long reading, here is a smiley face

  • If the boats are in open sea (no colissions) i would do it basically this way.

    Dont need pathfinding.

    Should capture if target is to close, but i did not build that in, its basic.

    If you have to take collisions in account, then it gets hellish. Dont matter what behavior you use to move it.

    I try that later, when i got time.

  • Have you tried this?

    I used this for my (crap) game:

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Hey guys,thanks for the help, the code is accurate! I will work on it. In the mean time, what are the tiles that you guys used?

    99Instances, where did you find your boat tile?

  • Hey guys,thanks for the help, the code is accurate! I will work on it. In the mean time, what are the tiles that you guys used?

    Do you mean the art? They're original.

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