how to move on a route with nodes ?

0 favourites
  • 11 posts
From the Asset Store
Node Downloader is a plugin for download file for Construct 3 and construct 2 game engine
  • Hello everyone,

    I'd like to make a system so that the character moves on a road with nodes, when the player “double-clicks” on an orange point with the mouse, he looks for the way to get to that node by moving on the node closest to where he is until he reaches his destination, the character can only move on the yellow road.

    Example: Current position = A1, destination = D1, look for the nearest node on the way to D1, and so on, I don't know if I'm clear, so the answer is: B1 - B7 - D1

    Example: Current position = D1, destination = C1, the answer is: B7 - B1 - B6 - B5 - C1

    Example: Current position = B3, destination = C2, the answer is: A1- B1 - B7- C2

    Example: Current position = B2, destination = C1, the answer is: a1- b1 - b7- c2 A1- B5 - C1 A1- B5 - C1

    Special case :

    Example: Current position = C1, destination = B2, the answers are.

    either : B5 - A1 - B2 (The most direct but...) Or B5 - B6 - A1 - B2 (Less direct but Noeux B6 is closer than A1, here B5 - A1 - B2 seems to be the best choice)

    There's also = B5 - B6 - B2 (A1 is closer than B2)

    You see what I mean, how am I going to do it? I'm not going to do them all 1 by 1, too much work, any ideas?

    I've created a yellow road map, I'd like my character to move only on what's in yellow with the pathfinding, I don't know how to do that, any ideas?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nobody knows how I can do this, I can't find anything to help me, please help me.

  • This example made by Connor Walker /rys@stickfigya

    DonkeyKongMapSystem.c3p

  • Hello,

    Thanks for the example, but that's not what I want!

    Here what I want is that when I click with the mouse on one of the nodes, that my character goes all alone on the node that I clicked looking for the path and always on the yellow road!

  • My attempt on branching pathfinding, not very clean though:

    https://drive.google.com/file/d/1NQWBtVzhCaVIa5cpE0r-djpOEduG2WEm/view?usp=sharing

  • What you're looking for is a pathfinding algorithm. The C3 pathfinding behavior won't help because it uses a grid of nodes rather than what you have.

    The only way to implement what you want is to implement something like Astar or Djikstra since you have only few points.

    Here's a video that explains how the algorithm works:

    youtube.com/watch

  • Place an invisible tilemap, draw narrow paths on it from node to node. Set those tiles as walkable and the rest of the tilemap as not. Find a path, see which nodes it goes through, then move from node to node with MoveTo behavior.

    I suggest using EasyStar pathfinding, but you can do the same with the official plugin too.

  • Thank you all for your help.

    It's far too complicated for me.

    It annoys me, however the one that suits me best and the least difficult in my opinion is that of: R0j0. but maybe not totally.

    Thanks again for your help.

    Best regards.

  • That example is a bit old. The pathfinding and moving events can be tightened up a bit, and instead of listing the UIDs of neighboring nodes you could just stretch edge sprites between nodes. It would be more visual anyways.

    A plugin for this would only be useful if it could place nodes/connections on the layout in a visual interactive way. The editor sdk doesn’t have anything to allow this though. So you’d end up having to still use node sprites and edge sprites then make events to tell the plugins the nodes and connections.

  • Good morning,

    I see, so it's not even possible to create a Plugin for that.

    Clearly, I have a series of disadvantages with C3.

    We can't even tell him to go to Noeux while staying on the yellow road.

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