How do i make my Player follow a specific Path.

0 favourites
  • 14 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hi there, i'm trying to do a cooking game, similar to "Cooking Diary", and in the kitchen i would like to move to the different object with the mouse. So i tried with pathfinding and obstacles, but it didn't work very well, issues with collision.

    As you see it's not working very good. All my object are scalled on a 100 pixels square grid, my pathfinding cell are 100 pixels too, and my cell border are -1. With 0 or >0, it's just won't move.

    If somebody have a solution for this.

    If not, i have another idea but i don't know how to do it. I can just make the player follow the path, the pathfinder just has to choose the best path between those.

    Thanks.

    Tagged:

  • Make the cell border larger, and verify that the collision box of the obstacles is the size of the object and not smaller.

  • Make the cell border larger, and verify that the collision box of the obstacles is the size of the object and not smaller.

    With a cell border bigger that -1, the player won't move.

    The collision of the obstacle are all at the size of the object, except for the player, the collision box is between the feet and the hips

    I don't understand why the pathfinder behavior don't consider this part as a solid:

    My obstacle is just a box with the "solid" behavior

    So i thought maybe it's because i stretched the object, so i tried to make my collision with two "vanilla" box instead of one box that i stretched.

    But it didn't work either.

  • I would do the pathfinding/collisions with a separate, smaller object like a 25x25 square. Then just pin the sprite of the lady to that helper object.

  • I would do the pathfinding/collisions with a separate, smaller object like a 25x25 square. Then just pin the sprite of the lady to that helper object.

    I tried it.

    So, i did a "balise", at each place i want my player to go, then when i click on the furniture, it goes to the "balise" assigned to it, but i don't uderstand why it doesn't go on it, see by yourself.

    It's pretty anoying...

  • What are your conditions to move the helper object? Especially what does stop it? Is it on collision/overlap with the black boxes? Is it a distance check? I would recommend stopping pathfinding/moving on a distance check* from image point to image point, which ideally should be in the center of each the green and black squares.

    *as condition: system - compare two values

    and then:

    value 1 = distance(object1.y, object1.x, object2.y, object2.x)

    value 2 = 1 pixel

  • I thought you were just doing find path to mouse.x,mouse.y and because you're clicking obstacles it doesn't quite get there. I'm not sure what relevance the black boxes have, you didn't mention those earlier? Let's see your event sheet.

  • What are your conditions to move the helper object? Especially what does stop it? Is it on collision/overlap with the black boxes? Is it a distance check? I would recommend stopping pathfinding/moving on a distance check* from image point to image point, which ideally should be in the center of each the green and black squares.

    *as condition: system - compare two values

    and then:

    value 1 = distance(object1.y, object1.x, object2.y, object2.x)

    value 2 = 1 pixel

    In fact i don't know why my helper object stop. I made it this way:

    - I have an objet called "Furniture" (Meuble), i created an image point in front of this object.

    - At the start of the layer, i spawned "balise" object at every ImagePoint of every Furniture object, it's only for visual purpose, i could delete the "black boxes" it wouldn't change anything

    So, my issues is "Why does it stop"

    It's not a "collision" issue because when i click one time, it doesn't go on the place wanted, but if i click again it will go. Maybe not very clear i show you:

    (1 flash = 1 click)

    As you can see there is no particular reason.

    I think it's a "step" issue, it stop because it consider that it's "ok" to stop here. Maybe i'm wrong i don't know

    Event Sheet

    ImagePoint of the Furniture object

    And the collision box are same as the sprite.

    Cell size is 25

    Cell border is 1

    All the object are scalled on a 100x100 pixel grid so there should not have issue about alignment or something

  • Set cell size to something lower than 25

  • Set cell size to something lower than 25

    It does exactly the same, nothing change, except that it sometimes go where i don't want it to go.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I made a simple file and it's working well so better to share your file.

  • I made a simple file and it's working well so better to share your file.

    Here it is

    anonfile.com/faQb5057n7/Pathfinding_Issues_capx

  • Looks like the issue is caused by a combination of the high movement speed with the ridiculous acceleration/deceleration settings. I don't know enough about them to give an exact reason as to why it stops abruptly during pathfinding but if you set it to something more normal then it's fine.

  • Looks like the issue is caused by a combination of the high movement speed with the ridiculous acceleration/deceleration settings. I don't know enough about them to give an exact reason as to why it stops abruptly during pathfinding but if you set it to something more normal then it's fine.

    Oh, thanks you very much.

    With thoses values i tried to simply disable the acceleration/deceleration because i don't need them in my game, so i thought it would work to set very high value

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