luddz / timegame

1 stars 0 forks source link

Camera system #21

Closed bhatnathan closed 4 years ago

bhatnathan commented 4 years ago

Some sort of system for the camera so that it follows the player. Take a look at this for inspiration:

https://www.gamasutra.com/blogs/ItayKeren/20150511/243083/Scroll_Back_The_Theory_and_Practice_of_Cameras_in_SideScrollers.php

How the camera will work needs to be discussed and more decisions on this need to be made.

bhatnathan commented 4 years ago

What we decided on is that we want the camera to smooth lerp to a point that is the average of a pivot point that is placed in each "room" and the player's current position. This will either limit the size of each room; if we have a constant camera size we will have a max distance of player and pivot be the size of the screen (smaller actually since you always want a bit of visual space around the player); or the camera will have to zoom to fit the room (not always great with pixel games but it works).

I personally prefer to have the size of the rooms be constrained as it gives a more metroidvania feel.

We should also have a "buffer area" between every pair of rooms. Say the player is in room A and is walking into room B, then the player would first cross a trigger that switches the pivot to room A (nothing happens because the camera is already set to that pivot point) and then hits the trigger to switch to room B's pivot point. So if a player walks back and forth quickly on the edge of the room the camera won't switch back and forth between room pivots (due to the distance between triggers).