Construction paths on the map.

0 favourites
  • 7 posts
From the Asset Store
A set of vector game assets contains ground tiles and several objects, used for creating platformer games
  • Construction paths on the map.

    Faced a problem. How to build a move along the way in such terms.

    The search for the path should be carried out only on certain textures (map) that I load as a sprite.

    I attached a picture. In the upper image, the dark road indicates where the object should move and look for a path.

    Just below, I inverted the image to make the buildings solid, and the fact that white is a road, but this did not help either.

    That is, I load the map, but I can not do so that the path would work only along the lines of the road.

  • I recommend using a tilemap as a helper for the pathfinding behavior. Your tilemap is only going to have 2 tiles, solid (obstacle) or open (road). You'll have to manually "paint" this tilemap to match your sprite, and then use the pathfinding behavior to generate an obstacle map based on your tilemap. Make sure the cell size for the pathfinding behavior matches the tilemap tile size.

  • Do I have to draw the entire map on tiles? Do I get it right?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That's how I would do it.

    Alternatively you could create individual solid sprite objects that are the same size and shapes of your blocks/buildings, but I imagine that would be more tedious.

    With a tilemap you'll just have to paint/trace the roads as "empty" cells. Resolution is up to you, lower resolution will be quicker.

  • Many thanks for the advice.

  • I also just used this tilemap behavior and it worked well (there's a C3 version at the end of the thread.)

    It has some additional features for pathfinding (directional conditions) and is also fast. However, it does not have actions for movement, which you must do separately (e.g. using a MoveTo plugin.)

  • Big sanks)

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