Playground Panic #2 – Viewports
|
One of the things that makes our game unique is how you need to find and clean a kid before their parent(s) come to pick their kid up. This creates a tension that simply running around to clean the kids wouldn’t achieve, but it also required a large map and the ability to move around in it. During the development-process so far we have only had a single-colored background. With a background added in, the game took a big visual step forward towards looking like a fully-fledged game. Having a big map to walk around in is pretty pointless without being able to see where you’re going. For this, we used Unlike most objects when creating games, the origin of I did say that having the position centered by default simplified things, but it also makes things dependent of the mouse-position buggy since they require a position based on the window. To solve this we had to nullify those effects while calculating the current mouse position and save it into a The user interface also had to change to be relative to the viewport instead of the window.
And lastly we had to change how enemies and projectiles spawned and how the projectiles were deleted. Originally the projectiles were removed when they got too far away from the edge of the screen, now they get removed when they move a bit out of sight to avoid hitting enemies that you don’t even know exist. Currently the camera will always stick to the player no matter how close to the edge (s)he is. I plan on either having collisions that prevent the player from getting close enough to the end of the background (Pokémon-style) or make the camera have a smaller area that it can move in (so when the player comes too close to an edge, the camera stops the following).
Bonus-credit to Mr.Robinde for being helpful (and he done gone goofed now)! |

