2D Gameplay Type: Switching Planes?


I’m a novice artist who is working on a short game, and I’m wondering if it’s possible to implement a key gameplay mechanic using only blueprints.
Essentially, I’d like for the character to switch between the foreground and background at the press of a button.

It’s heavily inspired by the “Fatal Fury” series mechanic called the “Oversway System”.

Any advice would help!


Hi @**Plathubis, **

You can absolutely create this in Blueprint.

Here’s the basic idea: You want your character to move in 2 dimensions X (forward / backwards) and Z (up / down) but its limited in the Y axis (foreground / background). So what you need is to change the Y value of your character to a set value that represents the foreground and background.

So for this example, lets say the Y = 0 for the foreground and Y = -500 for the background.

One way of doing this is create an input key in the project settings (call it “Switch Plane”) and inside your character blueprint create the event “Switch Plane.” From there when the button is pressed go into a Flip Flop node and on one pin simply use the node Set Actor Location. For the X and Z use the current X, Z (Get Actor location and break the struct), and for Y use the predefined value (-500).

For the other node in the Flip Flop do the same but the Y = 0.

This should basically switch the character’s location back and forth, yet maintain its current X and Z coordinates.

You can use this same code with other actor blueprints say a trigger in the environment that will switch the character automatically into the background, etc.

In not on my dev machine, so Im telling you by memory, but hopefully this takes you in the right direction. If you have any other questions, let me know.

Hope this helps!

Thank you very much, CoquiGames, worked like a charm. Thanks to your advice, I made a foreground and background “sway” mechanic. Through playing with it, I learned about combining floats and if-then statements. (Which helped me use two inputs to move a certain amount each time without falling into nothingness.)

Glad it worked out :slight_smile: