Skip to content

Chapter 6

What we will do:
In this part we draw game boards and combine terminal battleship code (game engine) with iOS code.

  1. Although this is an iOS tutorial you may want to read Basics of 2D graphics macOS tutorial where @IBDesignable concept is described.
  2. Watch video and repeat in your project all the steps (download video). For this part you need a final code from terminal version of battleship game (download terminal version of battle ship game)
  3. Make few changes in terminal version of battle ship game files:
    • In EngineGameBattleship.swift change from

      to
    • In EngineGameBattleship.swift change from

      to
    • In Board.swift change from

      to
  4. Download source code for this chapter (download source code).
  5. Look into all source code files. Think about all changes you can find. Migrate all changes into your files.
  6. Watch video showing that game board resizing works - this part is only for watching (download video).
  7. Watch the final result (download video). Notice that cellColor takes the value GameColors.grey only to make test - normally it should have the GameColors.blueLight value.