Extending Soccer
Now that we have structs, we can create a single game with both the ball and the goalie. The information that defines each frame now has two pieces: the x-coordinate of the ball and the y-coordinate of the goalie. We need to create a struct to hold these and to extend the functions for drawing, moving, and reacting to inputs to consume and return these structs instead of single coordinates.
- Write a data definition and examples of data for a struct for a game, which has both a ball and a goalie. Each is represented with a single coordinate.
- Write a function render-game that consumes a game struct and produces a scene containing both a ball and a goalie. Reuse your old functions wherever possible!
- Write a function next-game that consumes a game and produces a new game. In the new game, the ball should change using your old next-ball function and the goalie should be unchanged.
- Write a function react-game that consumes a game and a key and produces a game. In the returned game, the ball should be unchanged and the goalie should change using your old react-goalie function.
- Put it all together using the following commands:
(define (soccer-sim init-world) (big-bang init-world (on-tick next-game 1/28) (on-draw render-game) (on-key react-game)))




