changeset 31:35398b8cb61f default tip

Adapt qq3.py to some more Python3 incompatible changes
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Thu, 05 Oct 2017 18:25:58 +0200
parents ce58427c5826
children
files level.map qq3.py
diffstat 2 files changed, 20 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/level.map	Fri Jun 03 22:20:08 2016 +0200
+++ b/level.map	Thu Oct 05 18:25:58 2017 +0200
@@ -1,22 +1,22 @@
 [level]
 tileset = ground.png
-map =   %%%.%%%%%%%%%%%
-        %.......%.%.%.%
-        %.>....%.%.h.%%
-        %...@.......%.%
-        %......s...%.%%
-        %..............
-        %%.%.%.%...%.%%
-        %...........%.%
-        %%.%.%.%......%
-        ...........s..%
-        %%.%%.%%%..b..%
-        %..%%.%%%.bb%.%
-        %%.%%.%%%....%%
-        %.....%%%...%.%
-        %%%%%%%%%%%%%%%
+map =   XXX.XXXXXXXXXXX
+        X.......X.X.X.X
+        X.>....X.X.h.XX
+        X...@.......X.X
+        X......s...X.XX
+        X..............
+        XX.X.X.X...X.XX
+        X...........X.X
+        XX.X.X.X......X
+        ...........s..X
+        XX.XX.XXX..b..X
+        X..XX.XXX.bbX.X
+        XX.XX.XXX....XX
+        X.....XXX...X.X
+        XXXXXXXXXXXXXXX
 
-[%]
+[X]
 name = wall
 wall = true
 block = true
--- a/qq3.py	Fri Jun 03 22:20:08 2016 +0200
+++ b/qq3.py	Thu Oct 05 18:25:58 2017 +0200
@@ -57,10 +57,10 @@
         image = pygame.image.load(filename).convert()
         image_width, image_height = image.get_size()
         tile_table = []
-        for tile_x in range(0, image_width//width):
+        for tile_x in range(0, image_width // width):
             line = []
             tile_table.append(line)
-            for tile_y in range(0, image_height//height):
+            for tile_y in range(0, image_height // height):
                 rect = (tile_x*width, tile_y*height, width, height)
                 line.append(image.subsurface(rect))
         return tile_table
@@ -108,7 +108,8 @@
     def _get_pos(self):
         """Check the current position of the sprite on the map."""
 
-        return (self.rect.midbottom[0]-12)/24, (self.rect.midbottom[1]-16)/16
+        return ((self.rect.midbottom[0] - 12) // 24,
+                (self.rect.midbottom[1] - 16) // 16)
 
     def _set_pos(self, pos):
         """Set the position and depth of the sprite on the map."""