def __init__(self): # self.id = random.uniform(0, 999999999) Rectangle.__init__(self) self.handler = Handler() self.magnetos = Magnetos() self.offset = Point() self.pivot = Point() self.selected = False self.resizing = False self.direction = NONE self.control = AUTOMATIC self.z = 0 self.hints = False from ui.canvas import Canvas self.canvas = Canvas() self.handler.is_testing = self.canvas.is_testing self.dash = [] self.thickness = 1.0 self.fill_style = COLOR self.fill_color = Color(0.25, 0.25, 0.25, 0.25) self.stroke_color = Color(0.25, 0.25, 0.25, 1.0) self.gradient = Gradient()
def __init__(self): #self.id = random.uniform(0, 999999999) Rectangle.__init__(self) self.handler = Handler() self.magnetos = Magnetos() self.offset = Point() self.pivot = Point() self.selected = False self.resizing = False self.direction = NONE self.control = AUTOMATIC self.z = 0 self.hints = False from ui.canvas import Canvas self.canvas = Canvas() self.handler.is_testing = self.canvas.is_testing self.dash = [] self.thickness = 1.0 self.fill_style = COLOR self.fill_color = Color(0.25, 0.25, 0.25, 0.25) self.stroke_color = Color(0.25, 0.25, 0.25, 1.0) self.gradient = Gradient()
def __init__(self): Rectangle.__init__(self) self.hidden = False self.position = 0.0 self.direction = NONE self.control = Control() self.control.limbus = True
def __init__(self, name, pos, width, height, color): """ Initialize Block. Args: pos (tuple): Position of the block. width ([type]): Width of the block. height ([type]): Height of the block. color ([type]): Color of the block. """ pygame.sprite.Sprite.__init__(self) Rectangle.__init__(self, name, pos, width, height, color) self.solid = True
def __init__(self): Rectangle.__init__(self) self.active = True self.top = 0 self.left = 0 self.bottom = 0 self.right = 0 self.control = list() index = 0 while index < 8: control = Control() self.control.append(control) index += 1
def __init__(self, name, pos, width, height, color): """ Initialize Coin. Args: pos (tuple): Position of the coin. width ([type]): Width of the coin. height ([type]): Height of the coin. color ([type]): Color of the coin. """ pygame.sprite.Sprite.__init__(self) Rectangle.__init__(self, name, pos, width, height, color) self.coin = True self.instanceGroup = None
def __init__(self, side): Rectangle.__init__(self, side, side)
def __init__(self): Rectangle.__init__(self) self.active = True self.size = 15.0 self.snap = True
def __init__(self): Rectangle.__init__(self) self.position = 0 self.selected = False self.size = 25 self.orientation = NONE
def __init__(self, shape): Rectangle.__init__(self, shape) StraightShape.__init__(self, shape)
def __init__(self, x, y, size, color): Rectangle.__init__(self, x, y, size, size, color)
def __init__(self): Rectangle.__init__(self) self.active = False
def __init__(self, centre_x, centre_y, side, name='Square'): Rectangle.__init__(self, centre_x, centre_y, side, side, name)
def __init__(self, x: int, y: int, size: int, color: SDL_Color): Rectangle.__init__(self, x, y, size, size, color) self._default_color = color
def __init__(self, index, x, y, width, height): self.index = index self.state = ' ' Rectangle.__init__(self, x, y, width, height)
def __init__(self): Rectangle.__init__(self) self.active = True self.tags = list() self.magnetism = 32
def __init__(self, name, x1, y1, x2, y2): Rectangle.__init__(self, x1, y1, x2, y2) self.name = name
def __init__(self, name, x, y, z, width, height, depth): Rectangle.__init__(self, name, x, y, width, height) self._z = z self._depth = depth
def __init__(self, name, pos, width, height, color, room): """ Initialize Player. Args: pos(tuple): Position of the Player. width([type]): Width of the Player. height([type]): Height of the Player. color([type]): Color of the Player. """ pygame.sprite.Sprite.__init__(self) Rectangle.__init__(self, name, pos, width, height, color) self.speed = 5 self.direction = "right" self.player = True self.coins = 0 self.pX = self.x self.pY = self.y # AI self.model = None self.AIKeys = 0 self.room = room # * Will be automatically set at the createInstance() function. self.instanceGroup = None self.controls = { "movement": { str(pygame.K_w): (0, -self.speed, "up"), str(pygame.K_a): (-self.speed, 0, "left"), str(pygame.K_s): (0, self.speed, "down"), str(pygame.K_d): (self.speed, 0, "right"), str(pygame.K_w + pygame.K_a): "upleft", str(pygame.K_w + pygame.K_d): "upright", str(pygame.K_s + pygame.K_a): "downleft", str(pygame.K_s + pygame.K_d): "downright", }, # TODO: Jump function "functions": {} } self.collisionEvents = { "right": (-self.speed, 0), "left": (self.speed, 0), "up": (0, self.speed), "down": (0, -self.speed), # * All speed in this section is multiplied by 0.0707 because # * when it moves diagonally, it moves 1.414 times faster # * Reference: https://digisoln.com/gamemaker/gml/topdownplayer "upright": (-self.speed * 0.707, self.speed * 0.707), "upleft": (self.speed * 0.707, self.speed * 0.707), "downright": (-self.speed * 0.707, -self.speed * 0.707), "downleft": (self.speed * 0.707, -self.speed * 0.707) } # AI self.AIPress = { 0: pygame.K_w, 1: pygame.K_a, 2: pygame.K_s, 3: pygame.K_d, 4: pygame.K_w + pygame.K_a, 5: pygame.K_w + pygame.K_d, 6: pygame.K_s + pygame.K_a, 7: pygame.K_s + pygame.K_d } self.createAI() self.clearKeys = list(pygame.key.get_pressed()) self.totalrewards = 0 self.oldX = self.x self.oldY = self.y self.states = 0 self.epochsEnd = 1 self.epochs = 0 self.initialX = self.x self.initialY = self.y