From d5b1ff7f6031ed191e16625b1ddb8ac3fd0a33c7 Mon Sep 17 00:00:00 2001 From: Physcik Date: Mon, 26 Jan 2026 21:20:09 +0500 Subject: Movement fix --- engine/Components/Player.go | 2 +- engine/Components/World.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'engine/Components') diff --git a/engine/Components/Player.go b/engine/Components/Player.go index 0b01184..9c11b80 100644 --- a/engine/Components/Player.go +++ b/engine/Components/Player.go @@ -49,7 +49,7 @@ func (base *Player) Destroy() { func (base *Player) Move(delta rl.Vector2) { var newLocation = rl.Vector2Add(base.Position, delta) if !base.Collider.CanMove(base.ParentScene.GetStaticColliders(), - newLocation.X, newLocation.Y) { + delta.X, delta.Y) { return } base.Collider.MoveTo(newLocation.X, newLocation.Y) diff --git a/engine/Components/World.go b/engine/Components/World.go index 397cbb7..3f7a0d4 100644 --- a/engine/Components/World.go +++ b/engine/Components/World.go @@ -44,6 +44,11 @@ func (base *World) handleZoom() { func (base *World) collectStaticColliders() { base.staticColliders = make([]*coreobjects.Collider, 0) + for _, obj := range base.StaticObjects { + for _, v := range obj.GetColliders() { + base.staticColliders = append(base.staticColliders, &v) + } + } } func (base *World) GetStaticColliders() []*coreobjects.Collider { -- cgit v1.3