def __init__(self, position = (0, 0), node_list = []): Polygon.__init__(self, node_list) Translatable.__init__(self, position) Named.__init__(self) self.__connected_objects = [] self.__pointed_objects = [] self.add_name('_arrow_')
def __init__(self, x, y, rotation): Polygon.__init__(self, points=[Point(-10,-10), Point(7,-4), Point(15,-15), Point(15,8), Point(15,15), Point(7,9), Point(0,7)], x=x, y=y, rotation=rotation) self.accelerate(1.5) self.rotate(random.randrange(720)) self.angular_velocity = (random.randrange(0,300)/100)
def __init__(self, position=(0, 0), node_list=[]): Polygon.__init__(self, node_list) Translatable.__init__(self, position) Named.__init__(self) self.__connected_objects = [] self.__pointed_objects = [] self.add_name('_arrow_')
def __init__(self, p1, p2, p3): verticies = np.array([p1, p2, p3], dtype=np.float32) elements = np.array([[0, 1, 2]], dtype=np.int32) self.vertex = """ #version {version} in vec2 position; void main(void) { gl_Position = vec4(position, 0.0, 1.0); } """ self.fragment = """ #version {version} out vec4 out_color; void main(void) { out_color = vec4(1.0, 0.0, 0.0, 1.0); } """ Polygon.__init__(self, verticies, None, elements)
def __init__(self, x, y, world_width, world_height): Polygon.__init__(self, x, y, 0, 0, random.uniform(0, 359.9), world_width, world_height) self.mSpinRate = random.randint(-90, 90) self.accelerate(random.randint(10, 20)) self.setPolygon( self.createRandomPolygon(random.randint(10, 40), random.randint(7, 12)))
def __init__(self, x, y, world_width, world_height): dx = 0 dy = 0 rotation = 0 Polygon.__init__(self, x, y, dx, dy, rotation, world_width, world_height) point_list = [(10, 0), (-10, -10), (-5, 0), (-10, 10)] self.setPolygon(point_list)
def __init__(self, position, rotation, color): p1 = Point(0,-4) p2 = Point(0,4) p3 = Point(20,0) self.outline = [p3, p1, p2] self.position = position self.rotation = rotation self.color = color Polygon.__init__(self, self.outline, self.position, self.rotation, self.color)
def __init__(self, position, rotation, color): self.position = position self.rotation = rotation self.color = color self.points = [ point.Point(400, 300), point.Point(360, 290), point.Point(360, 310) ] Polygon.__init__(self, self.points, position, rotation, color)
def __init__(self, x, y, world_width, world_height): dx = 0 dy = 0 rotation = random.uniform(0, 359.9) Polygon.__init__(self, x, y, dx, dy, rotation, world_width, world_height) point_list = self.createRandomPolygon(20, random.randint(5, 9)) self.setPolygon(point_list) self.mSpinRate = random.uniform(0.1, 90) * random.choice((1, -1)) self.accelerate(random.uniform(10, 20))
def __init__(self, position, rotation, color): p1 = Point(0, -4) p2 = Point(0, 4) p3 = Point(20, 0) self.outline = [p3, p1, p2] self.position = position self.rotation = rotation self.color = color Polygon.__init__(self, self.outline, self.position, self.rotation, self.color)
def __init__(self): shape = [Point(24, 0), Point(-12, -12), Point(0, 0), Point(-12, 12)] position = Point(config.SCREEN_X/2, config.SCREEN_Y/2) self.rotation = config.SHIP_INITIAL_DIRECTION color = config.SHIP_COLOR Polygon.__init__(self, shape, position, self.rotation, color) self.accelerate = (0, 0) self.stop = Point(0, 0) pygame.mixer.init() self.fire_sfx = pygame.mixer.Sound("laser.wav") self.count = 5 self.shield_health = 100 self.nuke_count = 1
def __init__(self, context, x, y, w, h, density, rot=0): self.w = w self.h = h self.mid = Vec2d(x + self.w / 2, y + self.h / 2) mass = density * w * h moofin = (w**2 + h**2) / 12 * mass Polygon.__init__(self, context, self.get_vertices(rot), mass, moofin, immovable=True) self.rot = rot
def __init__(self, position, rotation, color, rotation_speed, motion): self.outline = [] for angle in range(0, 360, 360/config.ROCK_POLYGON_SIZE): radius = random.uniform(config.ROCK_MIN_RADIUS, config.ROCK_MAX_RADIUS) angle_rad = math.radians(angle) (x,y) = math.cos(angle_rad) * radius, math.sin(angle_rad) * radius p = Point(x,y) self.outline.append(p) self.position = position self.rotation = rotation self.color = color self.rotation_speed = rotation_speed self.motion = motion Polygon.__init__(self, self.outline, self.position, self.rotation, self.color) self.accelerate(self.motion)
def __init__(self, position, rotation, color, rotationspeed, rockspeed): self.position = position self.rotation = rotation self.color = color self.rotationspeed = rotationspeed self.points = [] for i in range(0, 360, 360 / config.ROCK_POLYGON_SIZE): radius = random.uniform(config.ROCK_MIN_RADIUS, config.ROCK_MAX_RADIUS) r = math.radians(i) x = (math.cos(r) * radius) y = (math.sin(r) * radius) self.points.append(point.Point(x, y)) Polygon.__init__(self, self.points, position, rotation, color) self.rockspeed = rockspeed self.accelerate(self.rockspeed)
def __init__(self, x, y, world_width, world_height): self.mSpinRate = random.uniform(-90, 90) Polygon.__init__(self, x, y, 0, 0, random.uniform(0, 359.9), world_width, world_height) Polygon.setPolygon(self, self.createRandomPolygon(30, 6)) randDX = random.randint(8, 14) randDY = random.randint(8, 14) fooX = random.randint(0, 1) fooY = random.randint(0, 1) if fooX == 0: randDX = -1 * randDX if fooY == 0: randDX = -1 * randDY self.dx = randDX self.dy = randDY return
def __init__(self, position, rotation, color, rotation_speed, motion): self.outline = [] for angle in range(0, 360, 360 / config.ROCK_POLYGON_SIZE): radius = random.uniform(config.ROCK_MIN_RADIUS, config.ROCK_MAX_RADIUS) angle_rad = math.radians(angle) (x, y) = math.cos(angle_rad) * radius, math.sin(angle_rad) * radius p = Point(x, y) self.outline.append(p) self.position = position self.rotation = rotation self.color = color self.rotation_speed = rotation_speed self.motion = motion Polygon.__init__(self, self.outline, self.position, self.rotation, self.color) self.accelerate(self.motion)
def __init__(self, x, y, rotation): Polygon.__init__(self, points=[ Point(10, 10), Point(30, -14), Point(60, 0), Point(60, 60), Point(60, 60), Point(14, 76), Point(10, 60) ], x=x, y=y, rotation=rotation) self.accelerate(0.5) self.rotate(random.randrange(180)) self.angular_velocity = (random.randrange(0, 120) / 100)
def __init__(self, x, y, rotation): Polygon.__init__(self, points=[ Point(0, 0), Point(13, -7), Point(20, 0), Point(30, 17), Point(30, 30), Point(7, 38), Point(0, 20) ], x=x, y=y, rotation=rotation) self.accelerate(0.8) self.rotate(random.randrange(360)) self.angular_velocity = (random.randrange(0, 190) / 100)
def __init__(self): shape = [] position = Point(random.uniform(0, config.SCREEN_X), random.uniform(0, config.SCREEN_Y)) color = config.ASTEROID_COLOR self.speed = random.uniform(config.ASTEROID_MIN_SPEED, config.ASTEROID_MAX_SPEED) rotation = random.uniform(0.0, 359.99) if random.randint(0, 1): self.speed *= -1 for i in range(config.ASTEROID_POLYGON_SIZE): radius = random.uniform(config.ASTEROID_MIN_RADIUS, config.ASTEROID_MAX_RADIUS) radian = math.radians(i * 360 / config.ASTEROID_POLYGON_SIZE) x = math.cos(radian) * radius y = math.sin(radian) * radius shape.append(Point(x, y)) Polygon.__init__(self, shape, position, rotation, color) self.ast_speed = random.uniform(config.ASTEROID_MIN_SPEED, config.ASTEROID_MAX_SPEED) self.accelerate(self.ast_speed)
def __init__(self): verticies = np.array([[-1, 1], [1, 1], [1, -1], [-1, -1]], dtype=np.float32) uvs = np.array([[0, 0], [1, 0], [1, 1], [0, 1]], dtype=np.float32) elements = np.array([[0, 1, 2], [2, 3, 0]], dtype=np.int32) self.vertex = """ #version {version} in vec2 position; in vec2 uv; out vec2 pass_uv; void main(void) { pass_uv = uv; gl_Position = vec4(position, 0.0, 1.0); } """ self.fragment = """ #version {version} in vec2 pass_uv; out vec4 out_color; uniform sampler2D textureSampler; void main(void) { vec4 textureColor = texture(textureSampler, pass_uv); out_color = textureColor; } """ Polygon.__init__(self, verticies, uvs, elements)
def __init__(self): Polygon.__init__(self, 3)
def __init__(self, x, y, world_width, world_height): Polygon.__init__(self, x, y, 0, 0, 0, world_width, world_height) self.setPolygon([(10, 0), (-10, 10), (-10, -10)])
def __init__(self, position = (0, 0), node_list = []): Polygon.__init__(self, node_list) Translatable.__init__(self, position) Named.__init__(self) self.add_name('_arrow_')
def __init__(self, **kwargs): points = [(0, 0), (0, 1), (1, 0.5)] Polygon.__init__(self, points=points, **kwargs) return