Deliverables

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Exercise 1: Convert Text to Buttons

Currently, you have four Text views that represent arrows for the player direction. Turn these Text() views into buttons.

Exercise 2: Increase the Size of the Arrows

The arrows are pretty small. It would be nice to increase the size of them. Add the following modifier to each arrow.

  .font(.system(size: 50.0))

Exercise 3: Add State Variables

In this app, the bunny will traverse the maze. You will track the position of the rabbit by the rabbit’s current column and current row. You’ll be using arrays so the first row or first column is the zero index. The current location is (0, 8).

Exercise 4: Add Text

It will be nice to have the player’s location printed out on the screen. Add a new text and add the player’s location to it.

Exercise 5: Alter the Player Coordinates

Each time the user taps one of the arrow keys, the player’s coordinates should update on the screen. Don’t worry about the numbers going negative. This is just for display purposes.

See forum comments
Download course materials from Github
Previous: Overview Next: Answer Key