How to Move Camera in Vertical Scrolling Shoot em Up?

Hello Everyone,

What is the best method to move the camera in a vertically scrolling shoot em up?

My thought is that the camera and the player should move at the same speed every tick. But how do I set this up?

Should the camera be a child of the player controller?

Any advice appreciated! Thank you.

You can add your camera to the player character (Since your character already moves), by adding a Camera Component inside of the designer. Once you have a camera added, you can still move the camera relative to the character per tick if needed.

Thanks, Jamendxman3!

The issue I’m having right now with the camera being a child of the player is that when the player in the vertically scrolling shoot em up moves left or right - The camera moves with the player. But the camera should actually stay stationary in the middle of the screen and just move at a constant speed (not follow the player).

Any ideas how best to tackle this? Thanks!

Oh, I hadn’t realized that is what you needed to account for. I don’t know what would be considered better practice, having it completely unattached, or just setting the location relative to the player. Either way, a quick solution is to just set the camera WORLD location every frame to the character Y and Z (Or whatever axis you are working on), and then a fixed X, wherever the center should be.

I think I’m almost there. I’m using detach from component to detach the camera in the construction script.

So, now my question is: How do I move a detached camera every tick using Add Movement Input? Because the Add Movement Input requires Target = Pawn, but the camera is a Component.

Any ideas?

@SwamiNatha
not actually understanding completely what you’re trying to achieve but this might be a possible solution.

Possible Solutions:

** you can create an empty Character BP & just use the key input just like normal then for world direction just use the axis you need. (use -1 normally - in z) for the Add Movement Input node

** for other movement options just drag from camera on your left into your event graph, pull of the blue output pin then type add to see some other movement options that you might rather use

sorry had to fix above post - brain malfunction :slight_smile:

OK, thanks guys!