Commits

Anonymous committed 01a108b

cleanup

  • Participants
  • Parent commits 11d322f

Comments (0)

Files changed (5)

docs/tut/chimp/ChimpLineByLine.html

 <h2 align="center">by Pete Shinners<br>
      <font size="-1">pete@shinners.org</font></h2>
            
-<h3 align="center">Revision 2.1, January 9, 2001</h3>
+<h3 align="center">Revision 2.2, June 17, 2004</h3>
       <br>
      <br>
              
         "move the monkey across the screen, and turn at the ends"
         newpos = self.rect.move((self.move, 0))
         if not self.area.contains(newpos):
-	if self.rect.left < self.area.left or \
-		self.rect.right > self.area.right:
+	if self.rect.left &lt; self.area.left or \
+		self.rect.right &gt; self.area.right:
             self.move = -self.move
             newpos = self.rect.move((self.move, 0))
             self.image = pygame.transform.flip(self.image, 1, 0)
         else:
             rotate = pygame.transform.rotate
             self.image = rotate(self.original, self.dizzy)
-        self.rect = self.image.get_rect()
-        self.rect.center = center
+        self.rect = self.image.get_rect(center=center)
 
     def punched(self):
         "this will cause the monkey to start spinning"
 <pre>if pygame.font:
     font = pygame.font.Font(None, 36)
     text = font.render("Pummel The Chimp, And Win $$$", 1, (10, 10, 10))
-    textpos = text.get_rect()
-    textpos.centerx = background.get_rect().centerx
+    textpos = text.get_rect(centerx=background.get_width()/2)
     background.blit(text, textpos)</pre>
 </td>
          </tr>

docs/tut/chimp/chimp.py.html

         <font color="#a52a2a"><b>else</b></font>:
             rotate = pygame.transform.rotate
             self.image = rotate(self.original, self.dizzy)
-        self.rect = self.image.get_rect()
-        self.rect.center = center
+        self.rect = self.image.get_rect(center=center)
 
     <font color="#a52a2a"><b>def</b></font> <font color="#008b8b">punched</font>(self):
         &quot;<font color="#ff00ff">this will cause the monkey to start spinning</font>&quot;
     <font color="#a52a2a"><b>if</b></font> pygame.font:
         font = pygame.font.Font(None, 36)
         text = font.render(&quot;<font color="#ff00ff">Pummel The Chimp, And Win $$$</font>&quot;, 1, (10, 10, 10))
-        textpos = text.get_rect()
-        textpos.centerx = background.get_rect().centerx
+        textpos = text.get_rect(centerx=background.get_width()/2)
         background.blit(text, textpos)
 
 <font color="#0000ff">#Display The Background</font>

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)

examples/chimp.py

         else:
             rotate = pygame.transform.rotate
             self.image = rotate(self.original, self.dizzy)
-        self.rect = self.image.get_rect()
-        self.rect.center = center
+        self.rect = self.image.get_rect(center=center)
 
     def punched(self):
         "this will cause the monkey to start spinning"
     if pygame.font:
         font = pygame.font.Font(None, 36)
         text = font.render("Pummel The Chimp, And Win $$$", 1, (10, 10, 10))
-        textpos = text.get_rect()
-        textpos.centerx = background.get_rect().centerx
+        textpos = text.get_rect(centerx=background.get_width()/2)
         background.blit(text, textpos)
 
 #Display The Background
 	PyObject* file;
 	char* name = NULL;
 	Mix_Chunk* chunk;
-printf("sound_init, start %p\n", self);
     
         ((PySoundObject*)self)->chunk = NULL;
 
 			Py_END_ALLOW_THREADS
 		}
 	}
-printf("sound_init, chunk %p\n", chunk);
 
 	if(!chunk)
         {