Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Get rid of the 500 magic number, replace with MAP_WIDTH + 20

  • Loading branch information...
commit d06453f30ae135b695b49dca8dbbfba634182118 1 parent d2168f9
Al Sweigart authored August 07, 2012
16  square-shooter/square-shooter_makeover.py
@@ -385,19 +385,19 @@ def render(self):
385 385
         if m.level == 0:
386 386
             self.render_title_screen()
387 387
             # Hide the [P]ause text.
388  
-            self.screen.fill(GREEN, (500, 424, 140, 24))
  388
+            self.screen.fill(GREEN, (MAP_WIDTH + 20, 424, 140, 24))
389 389
         else:
390 390
             self.render_game_world()
391 391
             # Hide the [P]lay text.
392  
-            self.screen.fill(GREEN, (500, 400, 140, 24))
  392
+            self.screen.fill(GREEN, (MAP_WIDTH + 20, 400, 140, 24))
393 393
             if self.game_paused: self.render_pause_text()
394 394
 
395 395
         text = self.hud_font.render(str(m.level), False, BLACK)
396  
-        self.screen.blit(text, (500, 48))
  396
+        self.screen.blit(text, (MAP_WIDTH + 20, 48))
397 397
         text = self.hud_font.render(str(m.lives), False, BLACK)
398  
-        self.screen.blit(text, (500, 48 * 3))
  398
+        self.screen.blit(text, (MAP_WIDTH + 20, 48 * 3))
399 399
         text = self.hud_font.render(str(m.score), False, BLACK)
400  
-        self.screen.blit(text, (500, 48 * 5))
  400
+        self.screen.blit(text, (MAP_WIDTH + 20, 48 * 5))
401 401
 
402 402
         #fps_text = self.msg_font.render(str(self.fps), False, GREEN)
403 403
         #self.screen.blit(fps_text, (0, 0))
@@ -406,17 +406,17 @@ def render(self):
406 406
 
407 407
     def render_backround(self):
408 408
         self.bglayer.fill(BLACK)
409  
-        self.bglayer.fill(GREEN, (MAP_WIDTH, 0, 160, MAP_HEIGHT))
  409
+        self.bglayer.fill(GREEN, (MAP_WIDTH, 0, WINDOW_WIDTH - MAP_WIDTH, MAP_HEIGHT))
410 410
 
411 411
         msg = ["Level", "Lives", "Score"]
412 412
         for i in range(3):
413 413
             text = self.hud_font.render(msg[i], False, BLACK)
414  
-            self.bglayer.blit(text, (500, i * 96))
  414
+            self.bglayer.blit(text, (MAP_WIDTH + 20, i * 96))
415 415
 
416 416
         msg = ["[Q]uit", "[P]ause", "[P]lay"]
417 417
         for i in range(3):
418 418
             text = self.msg_font.render(msg[i], False, WHITE)
419  
-            self.bglayer.blit(text, (500, 448 - i * 24))
  419
+            self.bglayer.blit(text, (MAP_WIDTH + 20, 448 - i * 24))
420 420
 
421 421
     def render_title_screen(self):
422 422
         text = self.hud_font.render("SQUARE", False, GREEN)

0 notes on commit d06453f

Please sign in to comment.
Something went wrong with that request. Please try again.