Skip to content

Commit

Permalink
Spot the 8 ball
Browse files Browse the repository at this point in the history
  • Loading branch information
w0rm committed Jan 5, 2024
1 parent fa620a3 commit 99960d8
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Game.elm
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,14 @@ update window msg oldModel =
}

Stop (EightBall.PlayersFault (EightBall.SpotEightBall newPool)) ->
-- { model
-- | world = World.keepIf (\b -> Body.data b /= CueBall) model.world
-- , state = PlacingBall OutsideOfTable (Anywhere newPool)
-- , camera = Camera.focusOn Point3d.origin model.camera
-- }
Debug.todo "Handle spot"
{ model
| world =
model.world
|> World.keepIf (\b -> Body.data b /= CueBall)
|> Ball.spot Table.footSpot EightBall.eightBall
, state = PlacingBall OutsideOfTable (BehindHeadString (EightBall.spotEightBall time newPool))
, camera = Camera.focusOn Point3d.origin model.camera
}

Stop (EightBall.NextShot newPool) ->
let
Expand Down Expand Up @@ -648,15 +650,13 @@ simulateWithEvents frame time world events =
, World.keepIf (\b -> Body.data b /= Numbered ball) currentWorld
)

-- TODO: implement “spotted” balls. When a numbered ball falls off the table,
-- it has to be placed on the foot spot
( Numbered ball, Floor ) ->
( EightBall.ballFellInPocket time ball :: currentEvents
( EightBall.ballOffTable time ball :: currentEvents
, World.keepIf (\b -> Body.data b /= Numbered ball) currentWorld
)

( Floor, Numbered ball ) ->
( EightBall.ballFellInPocket time ball :: currentEvents
( EightBall.ballOffTable time ball :: currentEvents
, World.keepIf (\b -> Body.data b /= Numbered ball) currentWorld
)

Expand Down

0 comments on commit 99960d8

Please sign in to comment.