From 00768a53e20410f245d3230d551e3fd7193ed2e6 Mon Sep 17 00:00:00 2001 From: davidovski Date: Tue, 23 Apr 2024 20:45:22 +0100 Subject: fix crash --- main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 44e0170..84ea5b8 100644 --- a/main.go +++ b/main.go @@ -423,7 +423,8 @@ func (g *Game) Update() error { } func (g *Game) UpdatePlacing() { - for _, obj := range g.objects { + for i := len(g.objects)-1; i >= 0; i-- { + obj := g.objects[i] obj.Update(*g.tilemap, g.objects) if obj.y > screenHeight { g.toPlace = append(g.toPlace, obj) -- cgit v1.2.1