World Map track controller

Get help using Construct 2

Post » Fri Nov 08, 2013 3:51 pm

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
B
13
S
2
Posts: 104
Reputation: 1,336

Post » Sat Nov 09, 2013 11:23 am

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



nimos1002013-11-09 11:28:05
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Mon Nov 11, 2013 7:44 am

How can I create lines or waypoints?
B
13
S
2
Posts: 104
Reputation: 1,336

Post » Tue Nov 12, 2013 1:29 pm

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...
TELLES08082013-11-12 13:30:04
Image
B
108
S
24
G
18
Posts: 1,373
Reputation: 22,824


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests