def __init__(self, x, y, width, height, resources, object_id=0): Rectangle.__init__(self, x, y, width, height) self.resources = resources self.is_destroyed = False if object_id != 0: self.id = object_id else: self.id = GameObject.GAME_OBJECT_ID GameObject.GAME_OBJECT_ID += 1
def __init__(self, position=Coordinate(), size=1.0, id=None, classes=None): """Keyword arguments: @param position: a Coordinate defining the position in the SVG document @type position: Coordinate @param size: the size of the square, i.e. the length of each side @param id: The unique ID to be used in the SVG document @type id: string @param classes: Classnames to be used in the SVG document @type classes: string or sequence of strings """ if isinstance(position, Coordinate): Rectangle.__init__(self, position, size, size, id=id, classes=classes) else: raise TypeError("position must be of type 'Coordinate'")
def __init__(self, game, position): self.game = game self.finishedTurn = False Rectangle.__init__(self, self.game, position, [16, 16], [136, 0, 0]) self.movementPattern = [ [0, -3], [-1, -2], [0, -2], [1, -2], [-2, -1], [-1, -1], [0, -1], [1, -1], [2, -1], [-3, 0], [-2, 0], [-1, 0], [1, 0], [2, 0], [3, 0], [-2, 1], [-1, 1], [0, 1], [1, 1], [2, 1], [-1, 2], [0, 2], [1, 2], [0, 3], ] self.legalMovementPattern = self.movementPattern[:] self.showMovement = False self.movementRectangles = [] for position in self.legalMovementPattern: realPosition = [ x + y for x, y in zip(self.position, [coordinate * 16 for coordinate in position]) ] self.movementRectangles.append( Rectangle(self.game, realPosition, self.size, [0, 255, 0], 1))
def __init__(self, coordinate, type, subtype, name, address): Rectangle.__init__(self, coordinate, coordinate) self.type = type self.subtype = subtype self.name = name self.address = address
def __init__(self, width): self._name = 'Square' Rectangle.__init__(self, width, width) # calling constructor of base class
def __init__(self,x,y,side): Rectangle.__init__(self,x,y,side,side)
def __init__(self, width, height, window_width, window_height): Rectangle.__init__(self, width, height) self.__window_height = window_height self.__window_width = window_width self.__color = (0, 184, 46)