Camera Control and Scene Wrap X/Y
KnightStar
Member Posts: 162
Hey Folks -
I'm doing some R&D on a possible top-down space shooter game, similar to Asteroids or any of the equivalent top-down space fly & shoot types of games. The problem I'm running into is the Scene Wrap function - I have the camera constrained to the player-ship and the camera size reduced so that the ship always remains in the center of the screen and a larger scene that actually takes up more room than the game screen.
This works all fine and well until the ship nears a scene edge, in which the ship moves from the center of the screen to the edge of the device screen (iPad/iPhone), engages the scene-wrap function, and appears on the other edge of the device screen. It will stay there until the player moves the player-ship far enough from the scene edge to return the player-ship to the device screen center. I'd like the ship to remain in the center of the screen at all times, even when wrapping the scene X or Y edges. Is this possible?
Oddly enough, I've actually mused that to make this work, I shouldn't be moving the player-ship through out the world by player input but by making the world (BG art and objects) move while the player-ship remains stationary on screen (only rotating to reflect heading and movement). This seems oddly too difficult to provide the effect I'm looking for (and very Matrix-like - "There is no spoon...")
Thanks!!
- KS
I'm doing some R&D on a possible top-down space shooter game, similar to Asteroids or any of the equivalent top-down space fly & shoot types of games. The problem I'm running into is the Scene Wrap function - I have the camera constrained to the player-ship and the camera size reduced so that the ship always remains in the center of the screen and a larger scene that actually takes up more room than the game screen.
This works all fine and well until the ship nears a scene edge, in which the ship moves from the center of the screen to the edge of the device screen (iPad/iPhone), engages the scene-wrap function, and appears on the other edge of the device screen. It will stay there until the player moves the player-ship far enough from the scene edge to return the player-ship to the device screen center. I'd like the ship to remain in the center of the screen at all times, even when wrapping the scene X or Y edges. Is this possible?
Oddly enough, I've actually mused that to make this work, I shouldn't be moving the player-ship through out the world by player input but by making the world (BG art and objects) move while the player-ship remains stationary on screen (only rotating to reflect heading and movement). This seems oddly too difficult to provide the effect I'm looking for (and very Matrix-like - "There is no spoon...")
Thanks!!
- KS
Comments
If you want to keep the ship centred you would need to manipulate the rocks when you rotate and speed up for eg which is possible but a lot more work.
Darren.
The original intent was to try and build something like Star Control's Melee system..
- KS
If linear vel x>300
or
linear vel x <-300
or lin vel Y > 300
or lin vel Y < -300
or lin vel x+Y >400
or lin vel x+y <-400
(zoom altitutude 3)
else if
linear vel x <-150
or lin vel Y > 150
or lin vel Y < -150
or lin vel x+Y >200
or lin vel x+y <-200
(zoom altitutude 2)
Else
(zoom altitude 1)
then make corresponding code in your actors.
When the player hits the wall, you simply change their position to where you want them to go.
For example, if you hit the actor at x -10 you'd end up at x480 - This would make you appear on the other side of the screen.
Additionally you could build your level so that the edges of the screen are not the edge of the game level.
For example, in a scene that's 9 across and 9 up, you could place your start position at screen 5 x 5.
Then, in the screens around the edges have the walls I mentioned placed about half way into the screen. This would leave plenty of space (I'd imagine) to hit the wall and warp to the other side of the level while keeping your ship in the centre at all times.
Just some random thoughts - hope they help!
QS =
D
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io