aboutsummaryrefslogtreecommitdiff
path: root/src/objs
diff options
context:
space:
mode:
authoriamcheeseman <[email protected]>2026-04-03 09:44:29 -0400
committeriamcheeseman <[email protected]>2026-04-03 09:44:29 -0400
commit623c351bab9e63c421939dc94d6930f9d94ba8d8 (patch)
tree961d11d9c84113a6c42c1b558fde59d60287e348 /src/objs
parent94cc023a056ebc49ed883739e9f42f51598e57a0 (diff)
parentf26ba2147c7325595780bdc5dae56f1315e5495e (diff)
Merge branch 'main' of ssh://codeberg.org/the-gutter/gutshot
Diffstat (limited to 'src/objs')
-rw-r--r--src/objs/camera_comp.lua10
-rw-r--r--src/objs/player.lua3
2 files changed, 13 insertions, 0 deletions
diff --git a/src/objs/camera_comp.lua b/src/objs/camera_comp.lua
new file mode 100644
index 0000000..3b8edf4
--- /dev/null
+++ b/src/objs/camera_comp.lua
@@ -0,0 +1,10 @@
+
+register_comp("Camera", function (ent)
+ assert(has_comp(ent, "Position"), "Why camera when no position bruh? Are you dumb??")
+ ent.camera = Cam.new(ent.x, ent.y)
+end)
+
+function camera_move_system(ent)
+ ent.camera.x = ent.x
+ ent.camera.y = ent.y
+end
diff --git a/src/objs/player.lua b/src/objs/player.lua
index 55a8ebe..dee4df5 100644
--- a/src/objs/player.lua
+++ b/src/objs/player.lua
@@ -119,6 +119,9 @@ function new_player(x, y)
layers = {},
mask = { "Hard" },
})
+ add_comp(ent, "Camera")
+ set_active_camera(ent.camera)
+ ent.camera.zoom = 0.5
add_comp(ent, "Sprite", "res/img/player.ase", {
offsetx = 0.5,