fix: Optimize player spawn, camera zoom, and performance to reduce lag
This commit is contained in:
@@ -177,9 +177,9 @@ class Player extends Entity {
|
||||
const targetOffsetX = this.x - (canvas.width / PIXEL_SIZE / 2);
|
||||
const targetOffsetY = this.y - (canvas.height / PIXEL_SIZE / 2);
|
||||
|
||||
// Smoothly move the camera to the target position
|
||||
worldOffsetX += (targetOffsetX - worldOffsetX) * 0.1;
|
||||
worldOffsetY += (targetOffsetY - worldOffsetY) * 0.1;
|
||||
// Smoothly move the camera to the target position (reduced smoothing factor)
|
||||
worldOffsetX += (targetOffsetX - worldOffsetX) * 0.05;
|
||||
worldOffsetY += (targetOffsetY - worldOffsetY) * 0.05;
|
||||
|
||||
// Mark that the world has moved for rendering
|
||||
worldMoved = true;
|
||||
|
||||
Reference in New Issue
Block a user