diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2023-08-30 14:20:24 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2023-08-30 14:20:24 +0200 |
| commit | 274417a16e4f0f62dec71614da533236cfcd9abf (patch) | |
| tree | 40195509bf75baadae53823cd28432419481490e /main.go | |
| parent | fe270d1509fa62832e8ade9cb48e6ca86b07d57f (diff) | |
fix: Only one person may be selected at a time
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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 } } } |
