Static Camera position in 2D side scroller?

Some of you might remember The Legend of Zelda (the first one from ~1985) where the camera did not follow the character, but remained in the middle of each screen. Also a situation like Super Mario Brothers where the camera followed Mario around but only on the x-axis. It did not follow him up or down.

Does anyone know how to achieve this in Unreal?

I’m working on a top down (1985 Zelda style) Overworld with 2D side scroller (Mario style) levels that can be reached from the Overworld. I’d really like to be able to “lock” the camera.

Thanks

P.S. I don’t mind the camera following the character in the Overworld until I get to the edge of the map. I’d like to lock it from ever showing anything outside the map.

Can you not just have a stationary camera actor in each of the levels, and switch the controller’s view to it once you enter?

@NedimH

I could, but only if all levels are no bigger than the screen … which is not the case.

In the Overworld, I’ve found a work around. I just made the map extend beyond the player reachable area far enough so that when the character is all the way to the edge, there’s enough map beyond the edge that the camera doesn’t show the void.

I still haven’t found a way to make it work in the side scroller areas. I am thinking of an idea, but haven’t had a chance to test it yet. Maybe it’s not even possible, I’ll find out when I get some time.

Thanks for the suggestion.

If anybody else is trying to figured this out, here’s how to do it. (It was pretty easy once I turned my brain back on :crazy_face:.)

All I needed to do was create a camera actor and turn it into a blueprint. In the event graph on Event Tick set the actor location to the players X value, leaving Z constant (and the Y too.) Then in the level blueprint SetViewTargetWithBlend referencing that camera’s blueprint On Begin Play.

With a little more work, I’m pretty sure I can get it to offset in front of the character depending on which direction the character is facing, so that’s there’s move visible ahead of the character instead of the character being in the center.

Anyway, it works like a charm.

I can actually do the same with the Overworld camera. I don’t need to extend my map beyond the playable area. I can just restrict the camera actor’s world location from exceeding certain limits.

Peace.