Example #1
0
 def move(self, direction):
     """can't move off left or right edges and loops around top and bottom
     otherwise moves same as AnimatedFacingSprite
     """
     
     AnimatedFacingSprite.move(self, direction)
     
     #if ship is off left or right edges, "nudge" back to the edge
     if self.rect.left < 0:
         self.rect.left = 0
     if self.rect.right > options.width:
         self.rect.right = options.width
         
     #if ship is off top or bottom edges, teleport to opposite edge
     if self.rect.top < 0:
         self.rect.bottom = options.height
     if self.rect.bottom > options.height:
         self.rect.top = 0