cs2370 Notes: 22 Going too Far with Objects
··1 min
Interfaces vs Inheritence
Animals:
class Bat:
image = "bat.png"
def __init__(self):
self.sprite = ... construct sprite
def moveTo(self, x, y):
self.sprite.update(...)
def draw(self):
self.sprite.draw()
def hit(self, x, y):
# circle as bounding box
def tick(self, x, y):
pass