def __init__(self, field, id, p=None, r=None, effects=None, color=None): if color is None: self.m_color = DEF_LINECOLOR else: self.m_color = color self.m_body_color = DEF_BODYCOLOR self.m_shape = Circle() self.m_bodyshape = Circle() super(MyCell, self).__init__(field,id,p,r,effects)
class MyCell(Cell): """Represents one person/object on the floor. Create a cell as a subclass of the basic data element. Stores the following values: m_color: color of cell set_location: set the location value for this cell as an XY tuple makeBasicShape: create the set of arcs that will define the shape """ def __init__(self, field, id, p=None, r=None, effects=None, color=None): if color is None: self.m_color = DEF_LINECOLOR else: self.m_color = color self.m_body_color = DEF_BODYCOLOR self.m_shape = Circle() self.m_bodyshape = Circle() super(MyCell, self).__init__(field,id,p,r,effects) def update(self, p=None, r=None, effects=None, color=None): """Store basic info and create a DataElement object""" if color is not None: self.m_color = color super(MyCell, self).update(p,r,effects) #def set_location(self, p): # moved to superclass #def add_connector(self, connector): # moved to superclass #def del_connector(self, connector): # moved to superclass def render(self): if self.m_location: self.m_shape.update(self.m_field, self.m_location, self.m_radius, self.m_color, solid=False) self.m_shape.render() if DRAW_BODIES: self.m_bodyshape.update(self.m_field, self.m_location, self.m_body_radius, self.m_body_color, solid=True) self.m_bodyshape.render() def draw(self): if self.m_location: self.m_shape.draw() if DRAW_BODIES: self.m_bodyshape.draw()