diff options
author | davidovski <david@davidovski.xyz> | 2024-04-23 20:45:22 +0100 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2024-04-23 20:45:22 +0100 |
commit | 00768a53e20410f245d3230d551e3fd7193ed2e6 (patch) | |
tree | 6c98a5ad56233c10e8a95f8eb1e2e4fd9887ea29 | |
parent | 684cda2b9f0e35519f8640ea686f9e8c805adfc4 (diff) |
fix crash
-rw-r--r-- | main.go | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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) |