Post tutorial RSS Tutorial 06 - Play in the background or the foreground!

This tutorial shows how you can enable the player to change the plane on which he is walking on predefined places.

Posted by on - Basic Mapping/Technical

Let's start from a simple map like the one in the picture:

1) Walking to the background (1-way)
We want the player to be able to move to the street that's in the background.

Place a trigger_interact_change_x_pos aligned with the player's plane. Now make the trigger to target a target_null.

That's it.
The origin of the target will define the final position of the movement and the new plane which the player will be locked to.

Tip: in order to disable the trigger_interact_change_x_pos until something triggers it, set the key/val "triggerFirst" "1" on it.

Tip2: The target entity does not need to be a target_null. It can be anything. Also, the target entity is triggered when the player reaches it. This allows you to call script functions or trigger other things if you choose to use a trigger_relay as target entity.

Tip3: If you choose to use a trigger_relay as target never set "wait" "-1" on it, otherwise it will auto-remove itself and the path won't work anymore.

Tip4: The player can abort any movement by default. He just needs to press the up or down button in the opposite direction. In order to disable this feature, you can set the key/val "canAbort" "0" on any trigger_interact_change_x_pos.

2) Walk to the background (2-way)
The 2-way variant is similar to the 1-way one. We just need to use another trigger_interact_change_x_pos as target (instead of a target_null), which also targets the other one.
In other words, we have 2 trigger_interact_change_x_pos targeting each other.

That's it.

3) Walk to the foregorund (2-way)
Guess what? It's just like the walking to the background. :)
You only have to press "down" instead of "up".

4) Walk to the background OR the foregorund (2-way)
At this point you probably can already guess how this works. We place 3 trigger_interact_change_x_pos: 1 in backgroung, 1 in foreground and 1 in the middle.
The ones in the backgroung and foreground target only the middle one, which instead targets both of them.

It cannot be easier than this. :D

5) Additional entities* (* will be available in the next release)
You may want the player being able to walk to the background, but not being able to move horizonally on it.
In other words, the player should walk back and forward, but never lock on the background.
In this case, we us a target_conditional_lock as target of the trigger_interact_change_x_pos.

Another useful entity is trigger_force_movement_block, which can optionally block the movement. Use it when there are objects that block the way.

6) Other examples
Once again, the Playground map features many examples for this kind of stuff. ;)

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.