Skip to content

Commit 848550d

Browse files
committed
add ability to center camera
1 parent d2acf95 commit 848550d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

parallax/Parallax.hx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ class Parallax
6565
updateLayers();
6666
}
6767

68+
public function centerCamera():Void
69+
{
70+
camera.x = (width * camera.zoom - camera.width) / 2;
71+
camera.y = (height * camera.zoom - camera.height) / 2;
72+
updateLayers();
73+
}
74+
6875
public function updateLayers():Void
6976
{
7077

0 commit comments

Comments
 (0)