diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2023-09-14 20:24:54 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2023-09-14 20:24:54 +0200 |
| commit | f7c05f1b9417eff446753b8fafc7829859521aa3 (patch) | |
| tree | df565e44a881da2d74f4080c38d5ef75cacf1d3b /README.md | |
| parent | 21287052a3809c2247be4243f91a32e2665961ed (diff) | |
refactor: Remove some features to prepare for ECS
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..ab0c271 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +```go +func (g \*Game) updatePlacingWall(cursor Point) { + if inpututil.IsMouseButtonJustReleased(ebiten.MouseButtonLeft) { + if cursor.In(soil.Bounds()) { + position := cursor.Sub(soil.Position).Div(100).Mul(100).Add(Point{50, 50}) + g.Blocks = append(g.Blocks, Block{NewTile(Point{100, 100}, position, color.RGBA{0x00, 0x00, 0x00, 0xff}), WallBlock}) + } + } +} +``` + +```go + if inpututil.IsMouseButtonJustReleased(ebiten.MouseButtonLeft) && cursor.In(wallButton.CollisionBounds()) { + if g.CurrentAction == PlacingWall { + g.CurrentAction = Selecting + } else { + g.CurrentAction = PlacingWall + } + } +``` |
