How do I rotate the camera?

Hello! I was wondering how to rotate the camera for my game, when the player presses a key, but it doesn’t work.

What events have you got at the moment?

Here is what I have so far:


That’s all.

Did you add a layer named “base” to the scene?

oh yes. But I fixed that mistake and it still dosn’t work.

so you’re saying this doesn’t work
video
if so make sure the camera is right and layers are right that’s all I can think about for it not to work

What do you mean you fixed that mistake? What mistake?

Do you have objects on the layer named “base”?

When you rotate a camera, it only affects the objects on that camera’s layer.

1 Like

As MrMen said, to observe rotation you also need to add some object floating to see them rotate.

I apologize to everyone of this thread for bringing this up, but I hope that you guys wouldn’t mind. I know how to center the camera on the player and change its angle towards the player. All I ever wanted was to center the camera in front of the player in which I did, but I have no idea how to make the camera move and rotate to a direction where the player is facing. The camera did rotate but it only stays at one place.

I’m pretty bad at explaining things to everyone. So in case if you don’t understand, here is my illustration:

Any ideas? (Oh and btw, I’m using tank controls for the player)

Yes, because you’re positioning the camera 30 pixels on the screen above the player’s position, no matter the player sprite orientation. The Y axis doesn’t change as the player sprite rotates.

You want to add a point to the player sprite where you want the camera to be positioned (say called CameraPosition) - this will be outside the player sprite’s boundaries. Then just change the camera position to this player sprite point using Player.PointX(“CameraPosition”), Player.PointY(“CameraPosition”)

1 Like

Oh okay, I’ll keep that in mind. Thank you so much!