From 274417a16e4f0f62dec71614da533236cfcd9abf Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Wed, 30 Aug 2023 14:20:24 +0200 Subject: fix: Only one person may be selected at a time --- main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'main.go') diff --git a/main.go b/main.go index 150b57e..80574a2 100644 --- a/main.go +++ b/main.go @@ -42,12 +42,15 @@ func (g *Game) Update() error { } } if inpututil.IsMouseButtonJustReleased(ebiten.MouseButtonLeft) { + // TODO: Drag & select x, y := ebiten.CursorPosition() tileClick := Point{x - soil.Position.X, y - soil.Position.Y} + canBeSelected := true for _, p := range g.Persons { p.IsSelected = false if tileClick.In(p.CollisionBounds()) { - p.IsSelected = true + p.IsSelected = canBeSelected + canBeSelected = false } } } -- cgit v1.3