From 3396aade01aa9c9d22e923728f1341deb4fe7f3b Mon Sep 17 00:00:00 2001 From: Mateu Batle Date: Mon, 15 Nov 2010 03:00:04 +0000 Subject: Fixed bug that made the game crash Repeated last line until the end of track is reached by the player --- (limited to 'game1') diff --git a/game1/tracktmx.py b/game1/tracktmx.py index d99bade..51d76d7 100755 --- a/game1/tracktmx.py +++ b/game1/tracktmx.py @@ -96,7 +96,10 @@ class Track(): x = (xpos + layer.x) * self.world_map.tilewidth y = (ypos + layer.y) * self.world_map.tileheight # get the gid at this position - img_idx = layer.content2D[xpos][ypos] + ypos_safe = ypos + if ypos_safe >= layer.height: + ypos_safe = layer.height - 1 + img_idx = layer.content2D[xpos][ypos_safe] material = self.world_map.indexed_tiles_tileset[img_idx] idx += 1 if img_idx: @@ -125,7 +128,7 @@ class Track(): screen.blit(screen_img, (x - cam_offset_x + offx, y - cam_offset_y + offy + horizon_y)) #num = num + 1 if material == "goals": - surface = self.getTextSurface(xpos, ypos, img_idx) + surface = self.getTextSurface(xpos, ypos_safe, img_idx) screen.blit(surface, (x - cam_offset_x + offx + 10, y - cam_offset_y + offy + horizon_y + 10)) """ -- cgit v0.9.1