summaryrefslogtreecommitdiff
path: root/engine/Components
diff options
context:
space:
mode:
authorPhyscik <mynameisgennadiy@vk.com>2026-01-26 21:20:09 +0500
committerPhyscik <mynameisgennadiy@vk.com>2026-01-26 21:20:09 +0500
commitd5b1ff7f6031ed191e16625b1ddb8ac3fd0a33c7 (patch)
treebd38d60f59ce94bfe80e7a527d83dcb558ea4bfc /engine/Components
parentca2c18bf79388561e44b232e6c050412ae87fe69 (diff)
Movement fix
Diffstat (limited to 'engine/Components')
-rw-r--r--engine/Components/Player.go2
-rw-r--r--engine/Components/World.go5
2 files changed, 6 insertions, 1 deletions
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 {