summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2024-04-23 20:45:22 +0100
committerdavidovski <david@davidovski.xyz>2024-04-23 20:45:22 +0100
commit00768a53e20410f245d3230d551e3fd7193ed2e6 (patch)
tree6c98a5ad56233c10e8a95f8eb1e2e4fd9887ea29
parent684cda2b9f0e35519f8640ea686f9e8c805adfc4 (diff)
fix crash
-rw-r--r--main.go3
1 files changed, 2 insertions, 1 deletions
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)