Code correction: discoball interaction

In 2D Apple Games, pg 305, the handler for interact() only addresses the case where the gamestate, isDiscoTime is false. It does not address when isDiscoTime is true. As a result, you can start the disco movie animation with a tap, but you will not be able to stop it.

The correct code should have an else:

func interact() {
if !isDiscoTime {
isDiscoTime = true
} else {
isDiscoTime = false

@justinjngan Thank you for sharing your solution - much appreciated!

1 Like

This topic was automatically closed after 166 days. New replies are no longer allowed.