Here is the section of code that I'm trying to do it with:
removeList = [] # Find the tiles that shouldn't be in view and add to remList for t in blocktiles: for tile in self.view: # 90 Degree angle if t.rect.x == self.rect.x: if tile.rect.y < t.rect.y: if not tile in removeList: removeList.append(tile) continue # 0 < angle < 90 degrees if tile.rect.y < t.rect.y and ((t.rect.y - self.rect.y)/(t.rect.x - self.rect.x))*(tile.rect.x - self.rect.x)-(((t.rect.y - self.rect.y)/(t.rect.x - self.rect.x))*(tile.rect.x - self.rect.x)) % 32 == tile.rect.y - self.rect.y: if not tile in removeList: removeList.append(tile) # Does the actual removing for tile in removeList: self.view.remove(tile)
blockTiles is a subset of view btw.
The logic behind it was that the player and the obstruction create a line joining them and the line that is behind the block goes out of view.
So I figure when the player is facing UP:
for all y(tiles) > yb(blocktile):
(blocktile.y - player.y)/(blocktile.x - player.x) * (anytiles.x - player.x) == anytiles.y - player.y
[Edited by - milan_b on July 1, 2010 5:15:50 PM]