pygame / examples / aliens.py

Diff from to

examples/aliens.py

     def __init__(self):
         pygame.sprite.Sprite.__init__(self, self.containers)
         self.image = self.images[0]
-        self.rect = self.image.get_rect()
+        self.rect = self.image.get_rect(midbottom=SCREENRECT.midbottom)
         self.reloading = 0
-        self.rect.centerx = SCREENRECT.centerx
-        self.rect.bottom = SCREENRECT.bottom - 1
         self.origtop = self.rect.top
         self.facing = -1
 
     def __init__(self, actor):
         pygame.sprite.Sprite.__init__(self, self.containers)
         self.image = self.images[0]
-        self.rect = self.image.get_rect()
+        self.rect = self.image.get_rect(center=actor.rect.center)
         self.life = self.defaultlife
-        self.rect.center = actor.rect.center
 
     def update(self):
         self.life = self.life - 1
     def __init__(self, pos):
         pygame.sprite.Sprite.__init__(self, self.containers)
         self.image = self.images[0]
-        self.rect = self.image.get_rect()
-        self.rect.midbottom = pos
+        self.rect = self.image.get_rect(midbottom=pos)
 
     def update(self):
         self.rect.move_ip(0, self.speed)
     def __init__(self, alien):
         pygame.sprite.Sprite.__init__(self, self.containers)
         self.image = self.images[0]
-        self.rect = self.image.get_rect()
-        self.rect.centerx = alien.rect.centerx
-        self.rect.bottom = alien.rect.bottom + 5
+        self.rect = self.image.get_rect(midbottom=
+                    alien.rect.move(0,5).midbottom)
 
     def update(self):
         self.rect.move_ip(0, self.speed)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.