Character movement on path with branches

0 favourites
  • 5 posts
From the Asset Store
Run, jump over or on enemies and reach the path’s end as fast as you can!
  • To clarify it at the very beginning, I searched the forum, but didn't find proper answer to my question. (although, there is a possibility that I missed it)

    I want to achieve the effect that the player moves along a predefined path on the board and the path may have branches. The player controls the character by clicking the mouse anywhere on the screen, indicating only the direction of movement. I have no plans to do many branches with similar angles so the method of forcing the player to follow path and chose approximate direction from few options would be more then enough.

    Additional explanation:

    <img src="https://dl.dropboxusercontent.com/u/74327867/Const%20Host/paths.png" border="0" />

    Is it even possible in C2? I'm interested in ideas, solutions as well as any workarounds. Basically any kind of help is appreciated.

    May only reasonable idea:

    <img src="https://dl.dropboxusercontent.com/u/74327867/Const%20Host/idea.png" border="0" />

  • Have pathfinding setup, and assign each path as invisible obstacles. Also fill the areas between the paths with solid objects (visible or not) so that the paths are the only way to go. Have large invisible sprites that cover each area you want the user to click to indicate the path to take. When the user touches or clicks on the invisible sprites, have it destroy or change the state of the invisible sprites that are blocking the path. Then pathfinding will have only one way to go and that will be along the path with no obstacles.

    Just a thought off the top of my head but in theory it should work.

  • Have pathfinding setup, and assign each path as invisible obstacles. Also fill the areas between the paths with solid objects (visible or not) so that the paths are the only way to go. Have large invisible sprites that cover each area you want the user to click to indicate the path to take. When the user touches or clicks on the invisible sprites, have it destroy or change the state of the invisible sprites that are blocking the path. Then pathfinding will have only one way to go and that will be along the path with no obstacles.

    Just a thought off the top of my head but in theory it should work.

    What a terrifying idea, but I guess it may work, thanks. Just hope it will not turn against me like Frankenstein's monster.

    Does someone know any other solution?

    Is it possible in C2 to create such paths for player movement?

    Do provided method for creating paths (assuming there is one) will let me find the points of intersection of them and the perpendicular line going through space mouse click point?

    Can I create a tree structure to represent paths inside game logic? (tree representation should be fine for my design and it may make traversal a bit faster and simpler since it will be easy to check if to search up or down the tree)

    But perhaps maybe there is some method to create paths and calculate the direction from the angles?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm stuck on this, it seems that I will have to redesign my game.

  • To do this you'd have to accomplish this:

    • Restrict the player's movement, so he can only move from active waypoint to active waypoint.
    • If player is over waypoint set all connected waypoints to active.
    • find active waypoint closest to mouseclick.
    • set player movement in direction of closest active waypoint.
    • if player moving along path only set waypoints connected to path as active.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)