def draw_player(self, agent, colour): ''' Draw a player with given position and orientation. ''' size = PLAYER_CONFIG['SIZE'] self.draw_entity(agent, colour) radius_end = size*angle_position(agent.orientation) pos = vector_to_tuple(upscale(agent.position)) end = vector_to_tuple(upscale(agent.position + radius_end)) pygame.draw.line(self.window, self.black, pos, end)
def draw_entity(self, entity, colour): ''' Draws an entity as a ball. ''' pos = vector_to_tuple(upscale(entity.position)) radius = scale(entity.size) pygame.draw.circle(self.window, colour, pos, radius)
def draw_radius(self, position, radius): ''' Draw an empty circle. ''' pos = vector_to_tuple(upscale(position)) radius = scale(radius) pygame.draw.circle(self.window, self.white, pos, radius, 1)