First, a confession: we don’t actually make the boats bump each other. We needed to finish the discussion in one day, so we did not add any physics that wasn’t present in the one-player version.
The one player code does the following:
w / s keys make the radius increase / decrease by 5 units.j / k keys make the speed decrease / increase by 10%.c gives a new random colorRequiring bumper-boats-single.rkt gives the following functions:
WIDTH, HEIGHT of the screentick-hmouse-hkey-hdraw-1-fancy: Boat -> Image: Render one boat, ready to place.Boat: the boat structure
(define-struct boat ([id : Integer] [name : String]
[pos : Posn] [vel : Posn]
[color : Color]
[radius : Positive-Integer])The Game structure was a number to keep track of whose turn it is
and two Boat structures, one for each player. Require the one player
file so the old functions are available.
(require "bumper-boats.single.rkt")draw-1-fancy of each player’s boat.