1 reply [Last post]
User offline. Last seen 14 weeks 5 days ago. Offline
Joined: 11/05/2016

I'm working on my next shmup, a vertical shmup, and have to drop this great discovery regarding the camera.

I've got my monitor sideways (I edit at my laptop, then test on the sideways monitor net to it), It occurred to me that I needed a camera system that would follow the player just a little to the left and right, so the playfield would be a little larger than the screen, like on Raiden 2, ... I think most modern shmups utilize that. But how to do it in the shoot'em up kit? that's complex!

I created an npc that the camera would follow. I placed that npc in a trigger zone that was just a stripe it could move left and right in. I made that npc chase the player, (constrained within it's narrow area), and I made it go slower than the player. So now the npc follows the player on that one axis, the camera follows the npc, it's timed so the player is smoothly followed across the middle of the screen and then reaches the edge, and the whole playfield is about 1 1/2 size the screen width (the player active area as calibrated just right).

Anyways, there was some pivoting and perspective change throughout this, so my real innovation was, I put the npc that the camera tracks far into the distance to reduce all that. the npc and it's bounding box are at x 2000 or so and the camera follows it at a distance of 2200 or so (which puts it back in front of the playfield.
It works amazing.
I'll construct the level now, static, with moving backrounds. And as a bonus, I'll still be able to utilize some "activate/deactivate when on camera" programming. ---actually, now that I'm thinking, I could probably construct a moving level using this same setup.

User offline. Last seen 2 weeks 5 days ago. Offline
Joined: 08/14/2015
That's ingenious! I was

That's ingenious!
I was thinking about something similar but never got it to work smoothly.
Putting the NPC far away is a brilliant solution. <3