# HG changeset patch # User Radomir Dopieralski # Date 1507220758 -7200 # Node ID 35398b8cb61fce34401f6b839210c42a23dae633 # Parent ce58427c58263abdd02a10976ca5514d20c2701b Adapt qq3.py to some more Python3 incompatible changes diff -r ce58427c5826 -r 35398b8cb61f level.map --- 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 diff -r ce58427c5826 -r 35398b8cb61f qq3.py --- 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."""