Skip to content

Instantly share code, notes, and snippets.

@gulnara
Last active December 14, 2015 22:29
Show Gist options
  • Save gulnara/5158754 to your computer and use it in GitHub Desktop.
Save gulnara/5158754 to your computer and use it in GitHub Desktop.
guard protecting the princess in my python game
class Girl(GameElement):
IMAGE = "Girl"
SOLID = True
def __init__(self):
GameElement.__init__(self)
self.last_move = 0
self.velocity_y = 1
def update(self, dt):
self.last_move += dt
if self.last_move > 0.30:
if self.y == 9:
self.velocity_y = -1
elif self.y == 0:
self.velocity_y = 1
self.board.del_el(self.x, self.y)
self.y += self.velocity_y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment