Skip to content

Commit

Permalink
feat(strategy/iron2023): implement ball get item dunder method
Browse files Browse the repository at this point in the history
  • Loading branch information
jpkleal committed Mar 1, 2023
1 parent c59a17f commit 058002f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions entities/Ball.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,12 @@ def _update_speeds(self):

self.vx = speed(self._frames['x'], self.game.vision._fps)
self.vy = speed(self._frames['y'], self.game.vision._fps)

def __getitem__(self, item):
if item == 0:
return self.x

if item == 1:
return self.y

raise IndexError("Ball only has 2 coordinates")

0 comments on commit 058002f

Please sign in to comment.