fork download
  1. # your code goes here
  2. class Paddle(pygame.sprite.Sprite):
  3. """ボールを打つパドル"""
  4. def __init__(self):
  5. # containersはmain()でセットされる
  6. pygame.sprite.Sprite.__init__(self, self.containers)
  7. self.image, self.rect = load_image("paddle.png")
  8. self.rect.bottom = SCR_RECT.bottom # パドルは画面の一番下
  9. def update(self):
  10. self.rect.centerx = pygame.mouse.get_pos()[0] # パドルの中央のX座標=マウスのX座標
  11. self.rect.clamp_ip(SCR_RECT) # SCR_RECT内でしか移動できなくなる
  12.  
Runtime error #stdin #stdout #stderr 0.12s 23568KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 2, in <module>
NameError: name 'pygame' is not defined