Typed Exercises 3
Exercises to practice using structures in Typed Racket.
-
Create a game structure that has a player
name, alocationPosn, and a Boolean variable forhorizontal?. You can abbreviate field names. -
Write a draw handler that draws a rectangle with the player’s name inside of it (you pick a size) and then potentially rotates it 90 degrees if
horizontal?is false. -
Write a key handler that flips the image from horizontal to vertical when you hit space.
-
Add to your key handler so any other (length 1) key that is hit is added to the end of the existing name. Advanced: make backspace work.
-
Write a mouse handler that changes the location of the image when you click.
-
Make a
big-bangto animate this action.