import colors from polygon import * class Floor(Polygon): """ Subclass for polygons as floor tiles wich don't have collisions. """ def __init__(self, *points, color=colors.DARK_RED): """Initilise 'self' with standard color 'DARK_RED'.""" Polygon.__init__(self, *points, color=color) def draw_shadow(self, screen, offset, source, color=None): """Overide 'draw_shadow' to not draw a shadow.""" pass def cut(self, source, portal): """ Return 'self' but cut to fit in the view from 'source' though 'portal'. Makes use of 'Polygon.cut'. """ rest = Polygon.cut(self, source, portal) if len(rest) > 2: return Floor(*rest, color=self.color) else: return Polygon() def dist_to(self, source): """Overide 'dist_to' to never cause collisions.""" return float('inf')