1
2 def update(self):
3 pressed_keys = pygame.key.get_pressed()
4 #if pressed_keys[K_UP]:
5 #self.rect.move_ip(0, -5)
6 #if pressed_keys[K_DOWN]:
7 #self.rect.move_ip(0,5)
8
9 if self.rect.left > 0:
10 if pressed_keys[K_LEFT]:
11 self.rect.move_ip(-5, 0)
12 if self.rect.right < SCREEN_WIDTH:
13 if pressed_keys[K_RIGHT]:
14 self.rect.move_ip(5, 0)