Created
August 16, 2020 13:27
-
-
Save SarahAlsharif/e46a8f0f74baefa54fce40ce632c37e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.onReceive(timer) { (_) in | |
if !self.gameOver { | |
self.changeDirection() | |
if self.posArray[0] == self.foodPos { | |
self.posArray.append(self.posArray[0]) | |
self.foodPos = self.changeRectPos() | |
} | |
} | |
} | |
.edgesIgnoringSafeArea(.all) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment