Fixed test errors by implementing __getitem__ method for Vec2D

This commit is contained in:
Carsten Thue-Bludworth 2022-09-27 23:30:15 -04:00
parent 0161017036
commit cf9a11aac8

View file

@ -35,7 +35,7 @@ import displayio
try:
import board
except:
except NotImplementedError:
print("[adafruit-turtle.py]: Couldn't import board module.")
__version__ = "0.0.0+auto.0"
@ -102,6 +102,9 @@ class Vec2D:
def __new__(cls, x, y):
return (x, y)
def __getitem__(self, index):
return getattr(self, index)
def __add__(self, other):
return Vec2D(self[0] + other[0], self[1] + other[1])