0 Favourites

World Map track controller

  • Hello everyone,

    I'm trying to figure out how can I create a map controller like Super Mario World. It needs to have a 4 ways controller, walks only on the tracks, stops on cross way and when the level isn't available just can't pass.

    I'm using the 8 direction behavior, but I couldn't think how I could make it work on that way.

    Thanks

  • If I understand you correct you want something like this:

    X------O----Y------------Z

    And before you can get to Z you have to complete Y, and you want the character to follow the line from X to Y, indicated by O in above illustration?

    If that's the case you can just predefine each path the character can take, and you could probably just use path finding behaviour.

    For instant:

    If

       Player is on X

       Right key is pressed

    Then

       Player find path to Y

    On path found

       Player move along path

    And if you need more ways for the player to travel from X you just add them, and check if down arrow is pressed instead of the right one for instant.

    You can then just add the lines as graphics, as the path finding behaviour, will always move straight from A->B, if you use standard settings.

    If you don't want straight lines, you can just add "Waypoints" along the lines, and then path find to them first until to can reach the next map.

    Since I cant draw it exact here, just imagine that at x1, x2, y1 the path is actually making a turn :)

    So it would look like this:

    X----x1--O--x2----Y----y1-----Z

    If that was what you meant ofc. :D

  • How can I create lines or waypoints?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • make a sprite with only two pixels painted, hold ctrl and crop the sprite to maintain the size of 1x2 pixels.

    Align the origin on the left side.

    Call it as "Line".

    Go to the events system and set the line behavior like this:

    = On start of layout

    -> Create Line in (Point01.X, Point01.Y)

    -> Set Line width to [distance(Line.X, Line.Y, Point02.X, Point02.Y)]

    -> Rotate Line to [angle(Line.X, Line.Y, Point02.X, Point02.Y)]

    That's it...

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