Implementing TetrisView

As you may have guessed, at this point TetrisView is far from completion. First and foremost we must implement a few setter methods for the model and activity properties of the view. These methods are shown below. Make sure to add them to your TetrisView class.

fun setModel(model: AppModel) {    this.model = model}fun setActivity(gameActivity: GameActivity) {    this.activity = gameActivity}

setModel() and setActivity() are setter functions for the model and activity instance properties. As the names imply, setModel() sets the current model in use by the view and setActivity() sets the activity in use. Now, let us add three additional methods setGameCommand(), setGameCommandWithDelay() and updateScore().

fun setGameCommand ...

Get Kotlin Programming By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.