fork download
  1. # Bird class
  2. class Bird:
  3. def __init__(self):
  4. self.x = 100
  5. self. y = HEIGHT // 2
  6. self.vel = 0
  7. self.rect = pygame.Rect(self.x, self.y, 30, 30)
  8. def update(self):
  9. self.vel += GRAVITY
  10. self.y += self.vel
  11. self.rect.topleft = (self.x, self.y)
  12. def jump(self):
  13. self.vel = JUMP
  14. def draw(self, win):
  15. win.blit(bird_img,(self.x, self.y))
Success #stdin #stdout 0.04s 9676KB
stdin
Standard input is empty
stdout
Standard output is empty