Add camera edge clamping

This commit is contained in:
Ketchetwahmeegwun T. Southall 2022-01-29 05:18:51 -08:00
parent 84eadde101
commit 125b3c7897

View File

@ -141,7 +141,7 @@ export function GameState(ctx: ContextI): StateI {
entity.act(desiredActions)
// FIXME: This isn't the right place for this.
rootContainer.position.set(Math.round(ctx.app.renderer.width/2), Math.round(ctx.app.renderer.height/2))
rootContainer.pivot.set(entity.x, entity.y)
rootContainer.pivot.set(Math.max(rootContainer.width/6, Math.min(entity.x, rootContainer.width/3)), Math.max(rootContainer.height/6, Math.min(entity.y, rootContainer.height/3)))
}
entity.update(delta)
}