def __init__(self, scene_size): self.r1img = 'plf:Ground_GrassMid' self.r2img = 'plf:BG_Colored_grass' self.row1 = Node(parent=self, position=(0,0)) self.row2 = Node(parent=self, position=(0,64)) self.row1.anchor_point = (0,0) self.row2.anchor_point = (0,0) self.row1.z_position = -50 self.row2.z_position = -100 self.r1size = 64 self.r2size = 512 self.row1.scale = 2 self.row2.scale = 1 #self.row1scale = 0.5 #self.row2scale = 0.1 self.row1scale = 10 self.row2scale = 3 for x in range(0, round(scene_size.width) + self.r1size, self.r1size): r1 = SpriteNode(self.r1img, position=(x, self.row1.position.y)) r1.anchor_point = (0,0) self.row1.add_child(r1) for x in range(0,round(scene_size.width) + self.r2size, self.r2size): r2 = SpriteNode(self.r2img, position=(x, self.row2.position.y)) r2.anchor_point = (0,0) self.row2.add_child(r2)
def __init__(self, scene_size): self.gap = 150 px, py = (scene_size.width, random.randint( Pipe.blocksize / 2, scene_size.height - (Pipe.blocksize / 2 + self.gap))) self.position = (px, py) self.img = 'plf:Tile_BoxCrate_double' # space from the opening to the top and bottom self.pbottomh = math.ceil(py) self.ptoph = math.ceil(scene_size.h - (py + self.gap)) ny = 0 for i in range(ny, ny - self.pbottomh, Pipe.blocksize * -1): n = SpriteNode(self.img, position=(0, i)) n.anchor_point = (0, 1) self.add_child(n) ny = self.gap + Pipe.blocksize for i in range(ny, ny + self.ptoph, Pipe.blocksize): n = SpriteNode(self.img, position=(0, i)) n.anchor_point = (0, 1) self.add_child(n)