a42e748
Author: Reiner Herrmann <reiner@reiner-h.de>
a42e748
Description: Port game to python3
a42e748
Bug-Debian: https://bugs.debian.org/912500
a42e748
a42e748
--- a/run_game.py
a42e748
+++ b/run_game.py
a42e748
@@ -1,4 +1,4 @@
a42e748
-#! /usr/bin/env python
a42e748
+#! /usr/bin/env python3
a42e748
 
a42e748
 import sys
a42e748
 import os
a42e748
--- a/lib/util.py
a42e748
+++ b/lib/util.py
a42e748
@@ -113,12 +113,12 @@
a42e748
   try:
a42e748
     conffile = codecs.open(file_path, "w", "utf_8")
a42e748
     for world in WORLDS:
a42e748
-      print >> conffile, "unlocked\t%(world)s\t%(unlocked)s" % {"world": world, "unlocked": Variables.vdict["unlocked" + world]}
a42e748
-      print >> conffile, "hiscore\t%(world)s\t%(hiscore)s" % {"world": world, "hiscore": Variables.vdict["hiscore" + world]}
a42e748
-      print >> conffile, "besttime\t%(world)s\t%(besttime)s" % {"world": world, "besttime": Variables.vdict["besttime" + world]}
a42e748
-    print >> conffile, "sound\t%s" % bool_to_str(Variables.vdict["sound"])
a42e748
-    print >> conffile, "dialogue\t%s" % bool_to_str(Variables.vdict["dialogue"])
a42e748
-    print >> conffile, "fullscreen\t%s" % bool_to_str(Variables.vdict["fullscreen"])
a42e748
+      print("unlocked\t%(world)s\t%(unlocked)s" % {"world": world, "unlocked": Variables.vdict["unlocked" + world]}, file=conffile)
a42e748
+      print("hiscore\t%(world)s\t%(hiscore)s" % {"world": world, "hiscore": Variables.vdict["hiscore" + world]}, file=conffile)
a42e748
+      print("besttime\t%(world)s\t%(besttime)s" % {"world": world, "besttime": Variables.vdict["besttime" + world]}, file=conffile)
a42e748
+    print("sound\t%s" % bool_to_str(Variables.vdict["sound"]), file=conffile)
a42e748
+    print("dialogue\t%s" % bool_to_str(Variables.vdict["dialogue"]), file=conffile)
a42e748
+    print("fullscreen\t%s" % bool_to_str(Variables.vdict["fullscreen"]), file=conffile)
a42e748
   except:
a42e748
     error_message("Could not write configuration file to " + file_path)
a42e748
     return False
a42e748
@@ -136,13 +136,13 @@
a42e748
       count += 1
a42e748
       if count > MAX_OLD_LOG_LINES:
a42e748
         break
a42e748
-  if Variables.vdict.has_key("log"):
a42e748
+  if "log" in Variables.vdict:
a42e748
     try:
a42e748
       conffile = codecs.open(file_path, "w", "utf_8")
a42e748
-      print >> conffile, "Log updated " + str(datetime.date.today())
a42e748
-      print >> conffile, Variables.vdict["log"]
a42e748
-      print >> conffile, ""
a42e748
-      print >> conffile, old_log
a42e748
+      print("Log updated " + str(datetime.date.today()), file=conffile)
a42e748
+      print(Variables.vdict["log"], file=conffile)
a42e748
+      print("", file=conffile)
a42e748
+      print(old_log, file=conffile)
a42e748
     except:
a42e748
       error_message("Could not write log file to " + file_path)
a42e748
       return False
a42e748
@@ -166,7 +166,7 @@
a42e748
 The constant colors can be found from locals.py.
a42e748
 '''
a42e748
 def render_text(string, color = COLOR_GUI, bgcolor = COLOR_GUI_BG):
a42e748
-  if Util.cached_text_images.has_key(string + str(color) + str(bgcolor)):
a42e748
+  if (string + str(color) + str(bgcolor)) in Util.cached_text_images:
a42e748
     final_image = Util.cached_text_images[string + str(color) + str(bgcolor)]
a42e748
   else:
a42e748
     text_image_bg = Util.smallfont.render(string, True, bgcolor)
a42e748
@@ -200,8 +200,8 @@
a42e748
   rendered_string = string[0:phase]
a42e748
   string_image = render_text(rendered_string)
a42e748
   string_rect = string_image.get_rect()
a42e748
-  string_rect.centerx = SCREEN_WIDTH / 2
a42e748
-  string_rect.centery = SCREEN_HEIGHT / 2
a42e748
+  string_rect.centerx = SCREEN_WIDTH // 2
a42e748
+  string_rect.centery = SCREEN_HEIGHT // 2
a42e748
 
a42e748
   if key == "p":
a42e748
     skip_image = Util.cached_images["key_p"]
a42e748
@@ -209,7 +209,7 @@
a42e748
     skip_image = Util.cached_images["key_z"]
a42e748
 
a42e748
   skip_rect = skip_image.get_rect()
a42e748
-  skip_rect.centerx = SCREEN_WIDTH / 2
a42e748
+  skip_rect.centerx = SCREEN_WIDTH // 2
a42e748
   skip_rect.top = string_rect.bottom + 5
a42e748
 
a42e748
   bg_rect = pygame.Rect(string_rect.left - 10, string_rect.top - 5, string_rect.width + 20, string_rect.height + skip_rect.height + 15)
a42e748
--- a/lib/animation.py
a42e748
+++ b/lib/animation.py
a42e748
@@ -58,9 +58,9 @@
a42e748
             self.finished = True
a42e748
           else:
a42e748
             self.i = 0
a42e748
-        if Animation.cached_frames.has_key(self.cache_name + str(self.i)):
a42e748
+        if (self.cache_name + str(self.i)) in Animation.cached_frames:
a42e748
           self.image = Animation.cached_frames[self.cache_name + str(self.i)]
a42e748
         else:
a42e748
           self.image = (self.frames[self.i]).get_image()
a42e748
           Animation.cached_frames[self.cache_name + str(self.i)] = self.image
a42e748
-    return self.image
a42e748
\ No newline at end of file
a42e748
+    return self.image
a42e748
--- a/lib/edit_utils.py
a42e748
+++ b/lib/edit_utils.py
a42e748
@@ -16,23 +16,23 @@
a42e748
     return
a42e748
 
a42e748
   def update(self, inputs):
a42e748
-    if inputs.has_key("REMOVE_TILE"):
a42e748
+    if "REMOVE_TILE" in inputs:
a42e748
       return Change("remove", self.cursor)
a42e748
-    if inputs.has_key("ADD_TILE_WALL"):
a42e748
+    if "ADD_TILE_WALL" in inputs:
a42e748
       return Change("W", self.cursor)
a42e748
-    if inputs.has_key("ADD_TILE_SPIKES"):
a42e748
+    if "ADD_TILE_SPIKES" in inputs:
a42e748
       return Change("S", self.cursor)
a42e748
-    if inputs.has_key("ADD_TILE_BARS"):
a42e748
+    if "ADD_TILE_BARS" in inputs:
a42e748
       return Change("B", self.cursor)
a42e748
-    if inputs.has_key("SAVE_TILES"):
a42e748
+    if "SAVE_TILES" in inputs:
a42e748
       return Change("save", (0, 0))
a42e748
-    if inputs.has_key("EDIT_RIGHT") and self.cursor[0] < (TILES_HOR - 1):
a42e748
+    if "EDIT_RIGHT" in inputs and self.cursor[0] < (TILES_HOR - 1):
a42e748
       self.cursor[0] += 1
a42e748
-    if inputs.has_key("EDIT_LEFT") and self.cursor[0] > 0:
a42e748
+    if "EDIT_LEFT" in inputs and self.cursor[0] > 0:
a42e748
       self.cursor[0] -= 1
a42e748
-    if inputs.has_key("EDIT_DOWN") and self.cursor[1] < (TILES_VER - 1):
a42e748
+    if "EDIT_DOWN" in inputs and self.cursor[1] < (TILES_VER - 1):
a42e748
       self.cursor[1] += 1
a42e748
-    if inputs.has_key("EDIT_UP") and self.cursor[1] > 0:
a42e748
+    if "EDIT_UP" in inputs and self.cursor[1] > 0:
a42e748
       self.cursor[1] -= 1
a42e748
     return None
a42e748
 
a42e748
--- a/lib/game.py
a42e748
+++ b/lib/game.py
a42e748
@@ -265,7 +265,7 @@
a42e748
     trigger = None
a42e748
 
a42e748
     if scripted_event_on:
a42e748
-      if inputs.has_key("JUMP") or inputs.has_key("DOWN"):
a42e748
+      if "JUMP" in inputs or "DOWN" in inputs:
a42e748
         cleared = True
a42e748
 
a42e748
     moved = False
a42e748
@@ -277,20 +277,20 @@
a42e748
       #There isn't anything special going on: player can control the character
a42e748
       #Translates input to commands to the player object
a42e748
       add_time = True
a42e748
-      if inputs.has_key("LEFT"):
a42e748
+      if "LEFT" in inputs:
a42e748
         player.move((-PLAYER_MAX_ACC, 0))
a42e748
         moved = True
a42e748
 
a42e748
-      if inputs.has_key("RIGHT"):
a42e748
+      if "RIGHT" in inputs:
a42e748
         player.move((PLAYER_MAX_ACC, 0))
a42e748
         moved = True
a42e748
 
a42e748
-      if inputs.has_key("JUMP"):
a42e748
+      if "JUMP" in inputs:
a42e748
         if (player.on_ground):
a42e748
           count = 0
a42e748
           while (count < 5):
a42e748
             count += 1
a42e748
-            particles.append(Particle(screen, 10, player.rect.centerx - player.dx / 4 + random.uniform(-3, 3), player.rect.bottom, -player.dx * 0.1, -0.5, 0.3, level.dust_color, 4))
a42e748
+            particles.append(Particle(screen, 10, player.rect.centerx - player.dx // 4 + random.uniform(-3, 3), player.rect.bottom, -player.dx * 0.1, -0.5, 0.3, level.dust_color, 4))
a42e748
           player.jump()
a42e748
 
a42e748
           #The blobs always try to jump when the player jumps
a42e748
@@ -299,10 +299,10 @@
a42e748
             if o.itemclass == "blob":
a42e748
               o.jump()
a42e748
 
a42e748
-      if inputs.has_key("UP") and not player.on_ground:
a42e748
+      if "UP" in inputs and not player.on_ground:
a42e748
         player.jump()
a42e748
 
a42e748
-      if inputs.has_key("DOWN"):
a42e748
+      if "DOWN" in inputs:
a42e748
         pick_up_item = level.pick_up(player.x, player.y)
a42e748
         if pick_up_item != None:
a42e748
           play_sound("coins")
a42e748
@@ -314,10 +314,10 @@
a42e748
           trigger = level.trigger(player.x, player.y)
a42e748
 
a42e748
       #Debug command for flipping:
a42e748
-      if inputs.has_key("SPECIAL"):
a42e748
+      if "SPECIAL" in inputs:
a42e748
         trigger = Trigger(TRIGGER_FLIP, player.x, player.y)
a42e748
 
a42e748
-    if inputs.has_key("PAUSE") and player.current_animation != "dying":
a42e748
+    if "PAUSE" in inputs and player.current_animation != "dying":
a42e748
       paused = not paused
a42e748
 
a42e748
     #Decelerates the player, if he doesn't press any movement keys or when he is dead and on the ground
a42e748
@@ -344,7 +344,7 @@
a42e748
     #Dust effect rising from the character's feet:
a42e748
 
a42e748
     if (player.current_animation == "walking"):
a42e748
-      particles.append(Particle(screen, 10, player.rect.centerx - player.dx / 2 + random.uniform(-2, 2), player.rect.bottom, -player.dx * 0.1, 0.1, 0.3, level.dust_color))
a42e748
+      particles.append(Particle(screen, 10, player.rect.centerx - player.dx // 2 + random.uniform(-2, 2), player.rect.bottom, -player.dx * 0.1, 0.1, 0.3, level.dust_color))
a42e748
 
a42e748
     #Updating level and objects:
a42e748
 
a42e748
@@ -455,7 +455,7 @@
a42e748
             player.orientation = current_scripted_event_element.orientation
a42e748
           current_scripted_event_element.finished = True
a42e748
         elif current_scripted_event_element.event_type == "change_level":
a42e748
-          score.score += (5 + score_mod) * ((player.life + 4) / 5 + 12)
a42e748
+          score.score += (5 + score_mod) * ((player.life + 4) // 5 + 12)
a42e748
           score.levels += 1
a42e748
           current_scripted_event_element.finished = True
a42e748
           if player.current_animation != "gone":
a42e748
--- a/lib/level.py
a42e748
+++ b/lib/level.py
a42e748
@@ -129,8 +129,8 @@
a42e748
     self.bg_animations["default"] = Animation(self.set + "_background", "static")
a42e748
     self.current_animation = "default"
a42e748
     self.rect = (self.bg_animations[self.current_animation].update_and_get_image()).get_rect()
a42e748
-    self.rect.centerx = SCREEN_WIDTH / 2
a42e748
-    self.rect.centery = SCREEN_HEIGHT / 2
a42e748
+    self.rect.centerx = SCREEN_WIDTH // 2
a42e748
+    self.rect.centery = SCREEN_HEIGHT // 2
a42e748
 
a42e748
     self.reset_active_tiles()
a42e748
     return
a42e748
@@ -217,7 +217,7 @@
a42e748
 
a42e748
   #Checks the point for solid ground
a42e748
   def ground_check(self, x, y):
a42e748
-    if self.cached_ground_check.has_key(str(x) + "_" +  str(y)):
a42e748
+    if (str(x) + "_" +  str(y)) in self.cached_ground_check:
a42e748
       return self.cached_ground_check[str(x) + "_" +  str(y)]
a42e748
     else:
a42e748
       if x > SCREEN_WIDTH or y > SCREEN_HEIGHT or x < 0 or y < 0:
a42e748
@@ -333,7 +333,7 @@
a42e748
   def remove_tile(self, coords):
a42e748
     """Remove a tile from the level with coordinates relative to the corner of the area currently visible."""
a42e748
     for t in self.active_tiles:
a42e748
-      if t.rect.collidepoint(coords[0]*TILE_DIM + TILE_DIM / 2, coords[1]*TILE_DIM + TILE_DIM / 2):
a42e748
+      if t.rect.collidepoint(coords[0]*TILE_DIM + TILE_DIM // 2, coords[1]*TILE_DIM + TILE_DIM // 2):
a42e748
         self.active_tiles.remove(t)
a42e748
         self.tiles.remove(t)
a42e748
         self.edited = True
a42e748
--- a/lib/log.py
a42e748
+++ b/lib/log.py
a42e748
@@ -15,7 +15,7 @@
a42e748
     """Add a message to the message log, which can be written on disk later."""
a42e748
 
a42e748
     #Multiple messages of the same type aren't added to the log:
a42e748
-    if Variables.vdict.has_key("last_log_message"):
a42e748
+    if "last_log_message" in Variables.vdict:
a42e748
       if string == Variables.vdict["last_log_message"]:
a42e748
         return
a42e748
         
a42e748
@@ -24,9 +24,9 @@
a42e748
 
a42e748
     Variables.vdict["last_log_message"] = string
a42e748
 
a42e748
-    if Variables.vdict.has_key("log"):
a42e748
+    if "log" in Variables.vdict:
a42e748
         Variables.vdict["log"] = string + "\n" + Variables.vdict["log"]
a42e748
     else:
a42e748
         Variables.vdict["log"] = string
a42e748
 
a42e748
-    return
a42e748
\ No newline at end of file
a42e748
+    return
a42e748
--- a/lib/sound.py
a42e748
+++ b/lib/sound.py
a42e748
@@ -25,7 +25,7 @@
a42e748
   if not Variables.vdict["sound"]:
a42e748
     return
a42e748
   snd = None
a42e748
-  if (not sounds.has_key(sound_id)):
a42e748
+  if sound_id not in sounds:
a42e748
     try:
a42e748
       sound_path = data.filepath(os.path.join("sounds", sound_id + ".ogg"))
a42e748
       snd = sounds[sound_id] = pygame.mixer.Sound(sound_path)
a42e748
--- a/lib/visibleobject.py
a42e748
+++ b/lib/visibleobject.py
a42e748
@@ -27,9 +27,9 @@
a42e748
     self.x = x
a42e748
     self.y = y
a42e748
     if (self.x == None):
a42e748
-      self.x = SCREEN_WIDTH / 2
a42e748
+      self.x = SCREEN_WIDTH // 2
a42e748
     if (self.y == None):
a42e748
-      self.y = SCREEN_HEIGHT / 2
a42e748
+      self.y = SCREEN_HEIGHT // 2
a42e748
 
a42e748
     self.flipping = False
a42e748
     self.flipcounter = 0
a42e748
@@ -122,7 +122,7 @@
a42e748
 
a42e748
   def die(self):
a42e748
     """Make the object die - if the object has a death animation, it will be played first."""
a42e748
-    if self.animations.has_key("dying"):
a42e748
+    if "dying" in self.animations:
a42e748
       self.current_animation = "dying"
a42e748
     else:
a42e748
       self.dead = True
a42e748
--- a/lib/player.py
a42e748
+++ b/lib/player.py
a42e748
@@ -79,7 +79,7 @@
a42e748
 
a42e748
     blood = []
a42e748
 
a42e748
-    if collision_type > 0:
a42e748
+    if collision_type and collision_type > 0:
a42e748
       blood = self.take_damage(collision_type)
a42e748
       if self.current_animation != "dying":
a42e748
         self.dy -= collision_type*PLAYER_JUMP_ACC / 4.5
a42e748
--- a/lib/object.py
a42e748
+++ b/lib/object.py
a42e748
@@ -34,7 +34,7 @@
a42e748
     self.initial_y = y
a42e748
     self.gravity = gravity
a42e748
     self.colliding = colliding
a42e748
-    self.active = (self.x + self.rect.width / 2 > 0) and (self.y + self.rect.height / 2 > 0)
a42e748
+    self.active = (self.x + self.rect.width // 2 > 0) and (self.y + self.rect.height // 2 > 0)
a42e748
 
a42e748
     self.on_ground = False
a42e748
 
a42e748
@@ -76,7 +76,7 @@
a42e748
     VisibleObject.update(self)
a42e748
 
a42e748
     if self.flip_finished and self.itemclass != "player":
a42e748
-      self.active = (self.x + self.rect.width / 2 > 0) and (self.y + self.rect.height / 2 > 0)
a42e748
+      self.active = (self.x + self.rect.width // 2 > 0) and (self.y + self.rect.height // 2 > 0)
a42e748
 
a42e748
     if self.flipping:
a42e748
       return
a42e748
@@ -101,9 +101,9 @@
a42e748
     """Make the object flip with the level to either direction"""
a42e748
     if VisibleObject.flip(self, flip_direction):
a42e748
       if flip_direction == CLOCKWISE:
a42e748
-        self.initial_x, self.initial_y = -self.initial_y + PLAY_AREA_WIDTH / TILES_HOR * (TILES_HOR*2 - FULL_TILES_HOR), self.initial_x
a42e748
+        self.initial_x, self.initial_y = -self.initial_y + PLAY_AREA_WIDTH // TILES_HOR * (TILES_HOR*2 - FULL_TILES_HOR), self.initial_x
a42e748
       else:
a42e748
-        self.initial_x, self.initial_y = self.initial_y, -self.initial_x + PLAY_AREA_WIDTH / TILES_HOR * (TILES_HOR*2 - FULL_TILES_HOR)
a42e748
+        self.initial_x, self.initial_y = self.initial_y, -self.initial_x + PLAY_AREA_WIDTH // TILES_HOR * (TILES_HOR*2 - FULL_TILES_HOR)
a42e748
     return
a42e748
 
a42e748
   def check_collisions(self, level):
a42e748
@@ -116,25 +116,25 @@
a42e748
 
a42e748
     self.on_ground = False
a42e748
 
a42e748
-    if self.x < 0 + self.rect.width / 2:
a42e748
-      self.x = 0 + self.rect.width  / 2
a42e748
+    if self.x < 0 + self.rect.width // 2:
a42e748
+      self.x = 0 + self.rect.width  // 2
a42e748
       self.dx = 0
a42e748
       collision_type = 0
a42e748
 
a42e748
-    if self.x > PLAY_AREA_WIDTH - self.rect.width  / 2:
a42e748
-      self.x = PLAY_AREA_WIDTH - self.rect.width  / 2
a42e748
+    if self.x > PLAY_AREA_WIDTH - self.rect.width  // 2:
a42e748
+      self.x = PLAY_AREA_WIDTH - self.rect.width  // 2
a42e748
       self.dx = 0
a42e748
       collision_type = 0
a42e748
 
a42e748
     # The commented block is the collision code for the upper edge of the screen.
a42e748
     # The spiders and projectiles might need this, but they use simplified
a42e748
     # collision detection for better performance anyway.
a42e748
-    '''if self.y < 0 + self.rect.height / 2:
a42e748
-      self.y = 0 + self.rect.height  / 2
a42e748
+    '''if self.y < 0 + self.rect.height // 2:
a42e748
+      self.y = 0 + self.rect.height  // 2
a42e748
       self.dy = 0'''
a42e748
 
a42e748
-    if self.y > PLAY_AREA_HEIGHT - self.rect.height / 2:
a42e748
-      self.y = PLAY_AREA_HEIGHT - self.rect.height  / 2
a42e748
+    if self.y > PLAY_AREA_HEIGHT - self.rect.height // 2:
a42e748
+      self.y = PLAY_AREA_HEIGHT - self.rect.height  // 2
a42e748
       self.dy = 0
a42e748
       self.on_ground = True
a42e748
       collision_type = 0
a42e748
--- a/lib/locals.py
a42e748
+++ b/lib/locals.py
a42e748
@@ -16,8 +16,8 @@
a42e748
 
a42e748
 TILE_DIM = 40
a42e748
 
a42e748
-PLAY_AREA_CENTER_X = (-FULL_TILES_HOR / 2 + TILES_HOR) * TILE_DIM
a42e748
-PLAY_AREA_CENTER_Y = (-FULL_TILES_VER / 2 + TILES_VER) * TILE_DIM
a42e748
+PLAY_AREA_CENTER_X = (-FULL_TILES_HOR // 2 + TILES_HOR) * TILE_DIM
a42e748
+PLAY_AREA_CENTER_Y = (-FULL_TILES_VER // 2 + TILES_VER) * TILE_DIM
a42e748
 
a42e748
 GRAVITY = 1.0
a42e748
 GRAVITY_PARTICLE = 0.5
a42e748
--- a/lib/mainmenu.py
a42e748
+++ b/lib/mainmenu.py
a42e748
@@ -73,19 +73,19 @@
a42e748
 
a42e748
     menu_image = render_text("World " + str(self.world.number) + ": " + self.world.name, COLOR_GUI)
a42e748
     rect = menu_image.get_rect()
a42e748
-    rect.centerx = SCREEN_WIDTH / 2
a42e748
+    rect.centerx = SCREEN_WIDTH // 2
a42e748
     rect.top = GUI_MENU_TOP - 75
a42e748
     self.bgscreen.blit(menu_image, rect)
a42e748
 
a42e748
     menu_image = render_text(score_text, COLOR_GUI)
a42e748
     rect = menu_image.get_rect()
a42e748
-    rect.centerx = SCREEN_WIDTH / 2
a42e748
+    rect.centerx = SCREEN_WIDTH // 2
a42e748
     rect.top = GUI_MENU_TOP - 50
a42e748
     self.bgscreen.blit(menu_image, rect)
a42e748
 
a42e748
     menu_image = render_text(time_text, COLOR_GUI)
a42e748
     rect = menu_image.get_rect()
a42e748
-    rect.centerx = SCREEN_WIDTH / 2
a42e748
+    rect.centerx = SCREEN_WIDTH // 2
a42e748
     rect.top = GUI_MENU_TOP - 30
a42e748
     self.bgscreen.blit(menu_image, rect)
a42e748
     
a42e748
--- a/lib/menu.py
a42e748
+++ b/lib/menu.py
a42e748
@@ -91,14 +91,14 @@
a42e748
 
a42e748
       menu_bg = pygame.image.load(data.picpath("menu", "bg")).convert_alpha()
a42e748
       rect = menu_bg.get_rect()
a42e748
-      rect.centerx = SCREEN_WIDTH / 2
a42e748
+      rect.centerx = SCREEN_WIDTH // 2
a42e748
       rect.top = GUI_MENU_TOP
a42e748
       self.screen.blit(menu_bg, rect)
a42e748
 
a42e748
       if self.heading_text != None:
a42e748
         menu_head = render_text(self.heading_text)
a42e748
         rect = menu_head.get_rect()
a42e748
-        rect.centerx = SCREEN_WIDTH / 2
a42e748
+        rect.centerx = SCREEN_WIDTH // 2
a42e748
         rect.top = GUI_MENU_TOP + 50 + menu_offset
a42e748
         self.screen.blit(menu_head, rect)
a42e748
 
a42e748
@@ -120,7 +120,7 @@
a42e748
         else:
a42e748
           menu_image = render_text(m, COLOR_GUI)
a42e748
         rect = menu_image.get_rect()
a42e748
-        rect.centerx = SCREEN_WIDTH / 2
a42e748
+        rect.centerx = SCREEN_WIDTH // 2
a42e748
         rect.top = GUI_MENU_TOP + 60 + (menu_visible + 1) * 20 + menu_offset
a42e748
         self.screen.blit(menu_image, rect)
a42e748
         current_menu_index += 1
a42e748
--- a/lib/particle.py
a42e748
+++ b/lib/particle.py
a42e748
@@ -28,9 +28,9 @@
a42e748
     self.radius = radius
a42e748
     self.gravity = gravity
a42e748
     if (self.x == None):
a42e748
-      self.x = SCREEN_WIDTH / 2
a42e748
+      self.x = SCREEN_WIDTH // 2
a42e748
     if (self.y == None):
a42e748
-      self.y = SCREEN_HEIGHT / 2
a42e748
+      self.y = SCREEN_HEIGHT // 2
a42e748
     if (self.dx == None):
a42e748
       self.dx = 0.0
a42e748
     if (self.dy == None):
a42e748
--- a/lib/tile.py
a42e748
+++ b/lib/tile.py
a42e748
@@ -47,8 +47,8 @@
a42e748
   def realign(self):
a42e748
     self.rect.centerx = self.x
a42e748
     self.rect.centery = self.y
a42e748
-    self.x = round((float(self.rect.right)/float(TILE_DIM)), 0)*TILE_DIM - self.rect.width / 2
a42e748
-    self.y = round((float(self.rect.bottom)/float(TILE_DIM)), 0)*TILE_DIM - self.rect.height / 2
a42e748
+    self.x = round((float(self.rect.right)/float(TILE_DIM)), 0)*TILE_DIM - self.rect.width // 2
a42e748
+    self.y = round((float(self.rect.bottom)/float(TILE_DIM)), 0)*TILE_DIM - self.rect.height // 2
a42e748
     if self.rect.height % 2 == 1:
a42e748
        self.y -= 1
a42e748
     if self.rect.width % 2 == 1: