How do I change the stage camera without changing the positions of sprites?

This is for a game I'm working on.

I need a way to control the projection of the camera onto the stage.

  1. I need to change the x/y position of the camera.
  2. I need to change the zoom of the camera.
  3. I need to change the rotation of the camera. This is optional.

And like I said, the most important part is that this must not change the x/y position or direction, or size of any sprites.
So if a sprite is at x: 0 y: 12 and I move the camera's x position by 50, the sprite will still be at x: 0 y: 12 and not x: 50 y: 12

Blocks I need
set camera x to () :: motion
set camera y to () :: motion
set camera zoom to () % :: motion
set camera direction to () degrees :: motion

// for the blocks that actually get the camera attributes, i can figure it out from there

I believe the only way to do what you want is to create a new sprite, and then do this to make this new camera sprite be the current camera.

Then you can move around this new sprite as you please, zooming in as well. You just need to make sure this little script is in a forever loop (or in some kind of loop that is triggered by another project).

I'm not talking about the actual irl camera, which is useless to me because i dont really have one anymore
i mean a 'camera' that views the stage.
as in, if the stage/canvas was something you could film, you could use a camera to film part of this canvas, and move the camera as you please to show some extra bits of the canvas

there's this scratch mod called turbowarp, an it has an extension that can show you what im talking about. CLICK HERE
you move the projection/view of the stage, and the sprite attributes stay the same

Well, you can easily create that yourself, which is honestly the best way to learn how camera systems in games even work (and also gives you finer control over how things move, such as allowing you to do parallax scrolling). I created this simple demo a while ago (don't know when, but I had it in my projects) that shows how simple it can be. I even created a block to make it easier to set the position of sprites based off of the camera.

this would work as a proper camera system, but there is one problem

I agree with ego-lay_atman-bay here. I think it is better to learn how to make a camera system yourself. First of all, it helps give you experience, second of all, you can make a personalized camera system, and third of all, it can give you a better understanding of how it works.

Of course, if you make a camera system, you will have to change the x and y positions, but you can make a sprite local variable to keep track of the x and y positions of the sprite in the map you are creating.

If you want a 3D camera system, you can use the 3D Beetle Geometry library. I also built up on ego-lay_atman_bay's camera system by adding in zoom.

the link you gave me doesnt work

I fixed it

i feel like a 3d version is complicated, and 2d is enough for the project im making. thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.