diff options
Diffstat (limited to 'engine/Components')
| -rw-r--r-- | engine/Components/Player.go | 2 | ||||
| -rw-r--r-- | engine/Components/World.go | 5 |
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 { |
