mirror of
https://git.leinelab.org/Mal/mr-crocs-adventures.git
synced 2025-09-11 02:57:36 +02:00
Camera momentum implemented.
This commit is contained in:
@@ -128,11 +128,18 @@ function MainLoop(timestamp)
|
||||
)
|
||||
}
|
||||
|
||||
camera.focusPosition(
|
||||
mrCroc.position.x - mrCroc.getWidth() * 0.5,
|
||||
mrCroc.position.y - mrCroc.getHeight() * 0.5,
|
||||
20
|
||||
);
|
||||
camera.lockCameraIntoBorders();
|
||||
|
||||
/* Drawing */
|
||||
if (timestamp - lastRendered >= FRAME_DURATION) {
|
||||
context.clearRect(0, 0, window.innerWidth, window.innerHeight);
|
||||
|
||||
camera.centerCamera(mrCroc.position.x - mrCroc.getWidth() * 0.5, mrCroc.position.y - mrCroc.getHeight() * 0.5);
|
||||
// camera.centerCamera(mrCroc.position.x - mrCroc.getWidth() * 0.5, mrCroc.position.y - mrCroc.getHeight() * 0.5);
|
||||
architecture.draw(context, camera);
|
||||
mrCroc.draw(context, camera);
|
||||
gisela.draw(context, camera);
|
||||
|
||||
Reference in New Issue
Block a user