3 ms·
Show HN: Reverse Snake (PyGame)
- zahlman 1y agoif self.moving_backwards: self.body.reverse() # Also reverse the direction vector self.direction = (-self.direction[0], -self.direction[1]) else: # When switching back to forwards, reverse again to restore original orientation self.body.reverse() # Restore direction self.direction = (-self.direction[0], -self.direction[1]) I don't think I need to explain the potential refactoring.
- deleted 1y ago[deleted]
- DavidCanHelp 1y agoThanks! Pushed a refactor. Good catch.