Dynamic camera zoom

I’m currently making a space shooter where the course itself evolves as you play it. You revolve around a structure, trying to shoot the central piece for each stage of the level. Once you do shoot the center, the camera is supposed to zoom out as more obstacles and enemies are built around the central piece.

I originally tried attaching the camera zoom to a variable and had that variable change tiny bits by tiny bits as it progresses after shooting the core. This did absolutely nothing. The camera stayed in the same place and I sat around feeling like a moron. Can anyone give me some advice here?

You should be able to do it with a variable for sure.

Can you perhaps screenshot/display the camera code you tried, to see if there’s something that should be changed?

My code is a bit mixed up, as I have many things tied to single events. My camera zoom does always equal a variable, which appears to be a global variable called “Zoom”

When I have a stage change event, it uses a timer to change the variable so the camera gradually zooms out, but it doesn’t happen. Every time the event is triggered, the camera just stays at the same zoom without changing.

The following code seems to be working as a zoom out function for me.

Could you perhaps compare it with your code and see if there’s anything different that shouldn’t be different? Obviously some things will be different as you trigger this zoom out at a specific point (e.g. with a variable) rather than just zoom out constantly like in my example.

2 Likes