Joabos wrote:
I'm doing a project, and I need to insert collision detection and response on it. Here's the code. What am I doing wrong?#Update all sprites, map self.player.update(dt)#Collide other spritescollisions = rabbyt.collisions.aabb_collide_single(self.player, self.spriteList)for col in collisions:pass#Collide with mapcollisions = rabbyt.collisions.aabb_collide_single(self.player, self.map_manager.map_sprites()) for tile in collisions: #Create a bounding line of all the tiles self.player.collide(tile) if len(collisions) > 0: #Collide the sprite with the bounding line pass """ if self.player.bottom < tile.top and self.player.top > tile.top: self.player.collide(tile.attributes['col_type'], DIRECTION.DOWN, tile.top) elif self.player.top > tile.bottom and self.player.bottom < tile.bottom: self.player.collide(tile.attributes['col_type'], DIRECTION.UP, tile.bottom) elif self.player.left < tile.right and self.player.right > tile.right: self.player.collide(tile.attributes['col_type'], DIRECTION.LEFT, tile.right) elif self.player.right > tile.left and self.player.left < tile.left: self.player.collide(tile.attributes['col_type'], DIRECTION.RIGHT, tile.left) """#Collide with boundaries"""if self.player.right > self.window_width: self.player.collide(COL_TYPE.WALL, DIRECTION.RIGHT, self.window_width) elif self.player.left < 0: self.player.collide(COL_TYPE.WALL, DIRECTION.LEFT, 0)if self.player.bottom < 0:self.player.collide(COL_TYPE.WALL, DIRECTION.DOWN, 0) """
What are all those triple-quoted strings? -- http://mail.python.org/mailman/listinfo/python-list
