Skip to content

Instantly share code, notes, and snippets.

@codehearts
Created March 19, 2019 03:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codehearts/2f946708143a0bf9540cf3d02d81bdb9 to your computer and use it in GitHub Desktop.
Save codehearts/2f946708143a0bf9540cf3d02d81bdb9 to your computer and use it in GitHub Desktop.
class Moon(object):
"""Graphical moon object"""
PHASES = ('new', 'waxing-crescent', 'first-quarter', 'waxing-gibbous',
'full', 'waning-gibbous', 'third-quarter', 'waning-crescent')
def __init__(self, x, y):
"""Creates a new moon at the coordinates"""
self._x, self._y = x, y
def animate_phases(self):
"""Animates the phases of the moon"""
for phase in Moon.PHASES:
phase_image = Image('{}.png'.format(phase))
phase_image.blit(self._x, self._y)
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment