How to make screen to screen camera movement?

iamflip

  • Posts: 9
Going with my "IWBTG"-like game that I mentioned here, I've gotten the "jump when you fall off a platform" part, but now for a mechanic that's more crucial - jumping the camera with the character when the character moves to the next screen. And I'm not talking about jumping from one scene to another... I'm really talking about jumping the camera within the same scene.

I don't know how to approach this really. I'm thinking of making an invisible actor for the camera to follow always, and have that jump to another area when the player enters that area (via leaving the screen in the previous area). But for that to work, the invisible actor must spawn in the middle of the same area that the character spawns (and that area can be in the middle of the scene's playing area for all I know), and somehow I need to detect the character moving off the screen for the camera jump to take place.

Is this kind of camera work even possible in the first place? Or do I have no choice but to make multiple scenes per world? :/

Greg

  • *
  • Posts: 1260
It is possible.  You always have access to the camera's x & y position -- so you can check the player's position versus that to see when the player is going off camera, and then jump the camera over one full screen dimension to move to the "next" room. 

iamflip

  • Posts: 9
Ok, I think I've got it.

I've made a separate actor that the camera will follow (and for now, it'll be visible so that I can see where exactly the camera is) and made this "Camera Follow per Screen" (I suck at naming stuff. Any suggestions on a better name? xd). It works now just as I wanted it to work. The camera seemed a bit iffy at the edges of the stage, so I had to compensate by placing the camera at x:0 and/or y:0 when the situation called for it, but otherwise everything is fine.

Now, I'm pretty sure I can replace everything regarding the separate actor and manipulate the camera directly I think. Is that good? Any other changes I might have to do for this?