def setup_ship(self, grid): ''' Create the ship surface ''' # create ship surface form_ship = self.get_component('f ship') # if not ship set -> put question mark image if not np.any(grid): form_ship.set_surface(img_question) else: ship = Ship.from_grid(grid, 0) ship.compile() form_ship.set_surface(ship.get_surface('original'))
def create_ship(self, grid): ''' Create the Ship object given its grid. Set its starting position & color according to its team. ''' self.ship = Ship.from_grid(grid, self.team) self.ship.compile() # set starting position & color if self.team == 1: self.ship.set_pos(Spec.POS_P1) self.ship.set_color(Spec.COLOR_P1) else: self.ship.set_pos(Spec.POS_P2) self.ship.set_color(Spec.COLOR_P2) self.ship.orien = np.pi