How do I use pathfinding with car behavior?

0 favourites
  • 5 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • 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.

    imgur.com/a/3IKyf (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 <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" />

  • 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.

    https://drive.google.com/open?id=0B1SSu ... l9DUVdna2M

    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.

  • 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?

  • Try Construct 3

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

    Try 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?

    Do you mean the art? They're original.

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