def __init__(self, pos, age, img_path, batch, group, start_impulse=(0, 0), *args, **kwargs):

        self.age = age
        self.batch = batch

        self.start_impulse = Vec2d(start_impulse)

        self.sprite = loaders.spriteloader(
            img_path, pos=pos, anchor=("center", "center"), batch=batch, group=group, linear_interpolation=True
        )
        self.sprite.visible = False

        self.mass = 0.00001
        self.radius = self.sprite.image.width / 2
        inertia = pymunk.moment_for_circle(self.mass, 0, self.radius)
        self.body = pymunk.Body(self.mass, pymunk.inf)
        self.body.position = Vec2d(pos)
        self.shape = pymunk.Circle(self.body, self.radius)
        self.shape.elasticity = 0.5
        self.shape.friction = 0.1
        self.shape.group = 1

        self.body.apply_impulse(self.start_impulse)
        self.tweener = PiTweener.Tweener()
        self.tweener.add_tween(self, age=0, tween_time=age, tween_type=self.tweener.LINEAR)
        self.tween = False
        self.removed = False
Example #2
0
    def __init__(self, space, position, size, target, padding, speed, image):
        self.speed = abs(speed)
        self.padding = padding
        padding_left = self.padding[0]
        padding_bottom = self.padding[1]
        padding_right = self.padding[2]
        padding_top = self.padding[3]
        self.target = target
        self.space = space
        self.position = position
        mass = 1
        self.body = pymunk.Body(mass, pymunk.inf)
        self.body.position = position
        self.shape = pymunk.Poly.create_box(self.body, size)
        self.shape.friction = 1
        self.shape.group = 2
        self.space.add(self.body, self.shape)

        self.top_body = pymunk.Body()
        self.top_body.position = self.body.position[0], self.body.position[1]

        joint = pymunk.constraint.PivotJoint(self.body, self.top_body, (0,0), (0,0))
        self.space.add(joint)

        if self.target > 0:
            self.left = (self.top_body.position[0] - size[0]//2 - padding_left, self.top_body.position[1] + padding_top + target)
            self.bottom = (self.top_body.position[0] - size[0]//2 - padding_left, self.top_body.position[1] - padding_bottom)
            self.right = (self.top_body.position[0] + size[0]//2 + padding_right, self.top_body.position[1] - padding_bottom)
            self.top = (self.top_body.position[0] + size[0]//2 + padding_right, self.top_body.position[1] + padding_top + target)
            self.bb = pymunk.BB(self.top_body.position[0] - size[0]//2 - padding_left,
                                self.top_body.position[1] - padding_bottom,
                                self.top_body.position[0] + size[0]//2 + padding_right,
                                self.top_body.position[1] + padding_top + target)
        if self.target < 0:
            self.left = (self.top_body.position[0] - size[0]//2 - padding_left, self.top_body.position[1] + padding_top)
            self.bottom = (self.top_body.position[0] - size[0]//2 - padding_left, self.top_body.position[1] - padding_bottom + target)
            self.right = (self.top_body.position[0] + size[0]//2 + padding_right, self.top_body.position[1] - padding_bottom + target)
            self.top = (self.top_body.position[0] + size[0]//2 + padding_right, self.top_body.position[1] + padding_top)
            self.bb = pymunk.BB(self.top_body.position[0] - size[0]//2 - padding_left,
                                self.top_body.position[1] - padding_bottom + target,
                                self.top_body.position[0] + size[0]//2 + padding_right,
                                self.top_body.position[1] + padding_top)
            self.speed *= -1
        
        alpha = 100
        self.color = (200,0,0,alpha)
        self.color2 = (0,200,0,alpha)
        self.color3 = (200,200,0,alpha)

        self.sprite = loaders.spriteloader(image,
                                           size = size,
                                           anchor = ('center','center'),
                                           linear_interpolation = True
                                           )
Example #3
0
    def __init__(self, space, position, size, hinge_pos, 
                 padding, 
                 ang_vel, start, end, 
                 image):
        self.padding = padding
        padding_left = self.padding[0]
        padding_bottom = self.padding[1]
        padding_right = self.padding[2]
        padding_top = self.padding[3]
        self.ang_vel = abs(ang_vel) # Refrain from using negative angular velocities, as it may give unexpected results.
        self.start = start + 57
        self.end = end + 57
        self.size = size
        #self.force = force
        self.space = space
        mass = 3
        self.inertia = pymunk.moment_for_box(mass, size[0], size[1])
        self.body = pymunk.Body(mass, self.inertia)
        self.body.angle = math.radians(start)
        self.body.position = (position[0]-hinge_pos[0], position[1]-hinge_pos[1])
        self.shape = pymunk.Poly.create_box(self.body, size)
        self.shape.friction = 1
        self.shape.group = 2
        self.space.add(self.body, self.shape)

        self.hinge_body = pymunk.Body()
        self.hinge_body.angle = math.radians(start) + math.radians(57)
        self.hinge_body.position = self.body.position[0] + hinge_pos[0], self.body.position[1] + hinge_pos[1]

        pivot = pymunk.constraint.PivotJoint(self.body, self.hinge_body, (hinge_pos), (0,0))
        self.space.add(pivot)

        gear = pymunk.constraint.GearJoint(self.body, self.hinge_body, 1.0, 1.0)
        self.space.add(gear)

        self.left = (position[0] - padding_left, position[1] + padding_top)
        self.bottom = (position[0] - padding_left, position[1]- padding_bottom)
        self.right = (position[0] + padding_right, position[1]- padding_bottom)
        self.top = (position[0] + padding_right, position[1] + padding_top)

        self.bb = pymunk.BB(position[0] - padding_left, #- hinge_pos[0], # left
                            position[1] - padding_bottom, #  - hinge_pos[1], # bottom
                            position[0] + padding_right, # - hinge_pos[0], # right
                            position[1] + padding_top, ) # - hinge_pos[1]) # top
        alpha = 100
        self.color = (200,0,0,alpha)
        self.color2 = (0,200,0,alpha)
        self.color3 = (200,200,0,alpha)

        self.sprite = loaders.spriteloader(image,
                                           size = size,
                                           anchor = ('center','center'),
                                           linear_interpolation = True)
Example #4
0
    def __init__(self, position, padding, image):
        self.position = position
        self.padding = padding
        padding_left = self.padding[0]
        padding_bottom = self.padding[1]
        padding_right = self.padding[2]
        padding_top = self.padding[3]
        #self.text = text
        
        self.bb = pymunk.BB(position[0] - padding_left,
                            position[1] - padding_bottom,
                            position[0] + padding_right,
                            position[1] + padding_top)

        self.left = (position[0] -  padding_left, position[1] + padding_top)
        self.bottom = (position[0]  - padding_left, position[1] - padding_bottom)
        self.right = (position[0] + padding_right, position[1] - padding_bottom)
        self.top = (position[0] + padding_right, position[1] + padding_top)
        
        alpha = 200
        self.color = (200,0,0,alpha)
        self.color2 = (0,200,0,alpha)
        self.color3 = (200,200,0,alpha)

        '''
        image = levelassembler.imageloader(image, 'placeholder.png', (10,10))
        tex = image.get_texture()
        glTexParameteri(tex.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
        glTexParameteri(tex.target, GL_TEXTURE_MIN_FILTER, GL_NEAREST)

        self.sprite = pyglet.sprite.Sprite(image) # batch = level_batch, group = ordered_group)
        #self.sprite.image.width = size[0]
        #self.sprite.image.height = size[1]
        self.sprite.image.anchor_x = 4
        self.sprite.image.anchor_y = 0
        
        self.sprite.scale = .75
        '''
        self.sprite = loaders.spriteloader(image,
                                          anchor= (4,0),
                                          scale = .75,
                                          linear_interpolation = True)
        self.sprite.opacity = 0
        self.stage1 = True
        self.stage2 = False
        self.stage3 = False
        self.stage4 = False
        self.stage5 = False
        self.stage6 = False

        self.fangle = 0
        self.weighted_angle = 0
Example #5
0
	def __init__(self, space, position, size, mass, friction, 
				amount, add, image, 
				menu_box = False,
				placeholder = 'placeholder.png', 
				scale = .5, 
				point_query = False, 
				name = 'None'):
		add_new_x = 0
		add_new_y = 0
		self.space = space
		inertia = pymunk.moment_for_box(mass, size[0],size[1])
		self.shape_list = []
		self.body_list = []

		for i in range(amount):
			self.body = pymunk.Body(mass, inertia)
			self.body.position = (position[0]+add_new_x, position[1]+add_new_y)
			shape = pymunk.Poly.create_box(self.body, size)
			shape.friction = friction
			space.add(self.body, shape)
			self.shape_list.append(shape)
			self.body_list.append(self.body)
			add_new_x += add[0]
			add_new_y += add[1]

		self.sprites = []
		for i in range(amount):
			sprite = loaders.spriteloader(image,
										  placeholder = placeholder,
										  #size = size,
										  scale = scale,
										  anchor = ('center','center'),
										  linear_interpolation = True)
			self.sprites.append(sprite)
		self.point_query = point_query
		self.mouse_pos = [0,0]
		self.mouse_buttons = 0
		self.name = name
		self.map_file = name
		self.contains = False
		self.clicked = False
		self.menu_box = menu_box

		self.grabFirstClick = True
		self.mouseGrabbed = False
Example #6
0
    def setup_batch(self, debug_batch, surface_batch):
        for button in self.buttons:
            button.setup_pyglet_batch(debug_batch, surface_batch, self.mask, None, self.group_4)
        self.bb_outline = debug_batch.add_indexed(
            4,
            pyglet.gl.GL_LINES,
            self.group_4,
            [0, 1, 1, 2, 2, 3, 3, 0],
            (
                "v2f",
                (
                    self.top_left[0],
                    self.top_left[1],
                    self.bottom_left[0],
                    self.bottom_left[1],
                    self.bottom_right[0],
                    self.bottom_right[1],
                    self.top_right[0],
                    self.top_right[1],
                ),
            ),
            ("c4B", (255, 0, 0, 255) * 4),
        )

        img_pos = self.pos[0], self.pos[1] + 9

        self.bg = loaders.spriteloader(
            "menu/images/level_select_menu.png",
            placeholder="placeholder.png",
            pos=img_pos,
            anchor=("center", "center"),
            linear_interpolation=True,
        )
        self.bg.batch = surface_batch
        self.bg.group = self.group_1

        self.fade_in = ListFadeIn(self.buttons, 1, bg_sprite=self.bg)

        self.close_button.setup_pyglet_batch(debug_batch, surface_batch, self.group_2, None, self.group_4)
Example #7
0
    def __init__(self, position, padding, image):
        self.position = position
        self.padding = padding
        padding_left = self.padding[0]
        padding_bottom = self.padding[1]
        padding_right = self.padding[2]
        padding_top = self.padding[3]
        #self.text = text
        
        self.bb = pymunk.BB(position[0] - padding_left,
                            position[1] - padding_bottom,
                            position[0] + padding_right,
                            position[1] + padding_top)
        self.left = (position[0] -  padding_left, position[1] + padding_top)
        self.bottom = (position[0]  - padding_left, position[1] - padding_bottom)
        self.right = (position[0] + padding_right, position[1] - padding_bottom)
        self.top = (position[0] + padding_right, position[1] + padding_top)
        alpha = 200
        self.color = (200,0,0,alpha)
        self.color2 = (0,200,0,alpha)
        self.color3 = (200,200,0,alpha)
        
        self.sprite = loaders.spriteloader(image,
                                           anchor               = ('center', 'center'),
                                           #anchor_offset        = (0,-50)
                                           #scale                = 2,
                                           #linear_interpolation = True,
                                           )
        self.sprite.opacity = 0

        self.particle_emit = False

        self.fangle = 0
        self.weighted_angle = 0
        self.tweener = PiTweener.Tweener()

        self.finish_sound = loaders.Audio()
        self.finish_sound.load('resources/sounds/yay.ogg')
Example #8
0
    def __init__(self,
                 space,
                 starting_pos,
                 level_batch,
                 debug_batch,
                 ui_batch,
                 lfg,
                 lfg2,
                 lfg3,):
        self.space = space
        self.starting_pos = starting_pos
        ## Chassis
        chassis_inertia = pymunk.moment_for_box(.9, 104, 18)
        self.chassis_body = pymunk.Body(.9,chassis_inertia)
        self.chassis_body.position = starting_pos
        self.chassis_body.group = 1
        space.add(self.chassis_body)
        origin = (0,0)
        self.parts =    [
                        ((origin),(-8,13),(10,14),(21,4)),
                        ((origin),(21,4),(47,2),(50,-14)),
                        ((origin),(50,-14),(-56,-13),(-14,-3)),
                        ((-56,-13),(-57,2),(-52,2),(-52,-3)),
                        ((-56,-13),(-52,-3),(-14,-3)),
                        ((origin),(-14,-3),(-8,13))
                        ]

        self.shape_list = []
        for part in self.parts:
            self.part = pymunk.Poly(self.chassis_body, part)
            self.part.friction = 0.3 #0.5
            self.part.group    = 1  # so that the wheels and the body do not collide with eachother
            self.space.add(self.part)
            self.shape_list.append(self.part)
        self.outlines = []
        for shape in self.shape_list:
            s_points = shape.get_vertices()
            if len(s_points) < 4:
                self.tri_outline = debug_batch.add_indexed(3, pyglet.gl.GL_LINES, None, [0,1,1,2,2,0], ('v2f'), ('c4B', (0,120,0,220)*3))
                self.outlines.append(self.tri_outline)
            elif len(s_points) == 4:
                self.quad_outline = debug_batch.add_indexed(4, pyglet.gl.GL_LINES, None, [0,1,1,2,2,3,3,0], ('v2f'), ('c4B', (0,120,0,220)*4))
                self.outlines.append(self.quad_outline)

        ## End Chassis
        ## Wheels
        wheel_mass = .3
        wheel_radius = 13
        wheel_inertia = pymunk.moment_for_circle(wheel_mass, 0, wheel_radius)
        wheel_friction = 1.8
        # L
        l_wheel_base  = 35
        l_wheel_pos                 = (starting_pos[0]-l_wheel_base+wheel_radius,starting_pos[1]-18-wheel_radius)
        self.l_wheel_body           = pymunk.Body(wheel_mass, wheel_inertia)
        self.l_wheel_body.position  = l_wheel_pos
        self.l_wheel_shape          = pymunk.Circle(self.l_wheel_body, wheel_radius)
        self.l_wheel_shape.friction = wheel_friction
        self.l_wheel_shape.group    = 1
        space.add(self.l_wheel_body,self.l_wheel_shape)
        # R
        r_wheel_base = 33
        r_wheel_pos                 = (starting_pos[0]+r_wheel_base-wheel_radius,starting_pos[1]-18-wheel_radius)
        self.r_wheel_body           = pymunk.Body(wheel_mass, wheel_inertia)
        self.r_wheel_body.position  = r_wheel_pos
        self.r_wheel_shape          = pymunk.Circle(self.r_wheel_body, wheel_radius)
        self.r_wheel_shape.friction = wheel_friction
        self.r_wheel_shape.group    = 1
        space.add(self.r_wheel_body,self.r_wheel_shape)
        ## End Wheels
        ## Constraints
        rest_ln     = 25  # 25
        lift        = 25  # 25
        stiff       = 110 # 100
        damp        = .4  # .4

        left_spring   = pymunk.constraint.DampedSpring(self.chassis_body, self.l_wheel_body, (-l_wheel_base, 0),  (0,0), rest_ln, stiff, damp)
        right_spring  = pymunk.constraint.DampedSpring(self.chassis_body, self.r_wheel_body, (r_wheel_base, 0),   (0,0), rest_ln, stiff, damp)

        left_groove    = pymunk.constraint.GrooveJoint(self.chassis_body, self.l_wheel_body, (-l_wheel_base, -12), (-l_wheel_base, -lift),   (0,0))
        right_groove   = pymunk.constraint.GrooveJoint(self.chassis_body, self.r_wheel_body, (r_wheel_base, -12),  (r_wheel_base, -lift),    (0,0))

        space.add(left_spring,left_groove,right_spring,right_groove)
        ##
        ## Sprites

        plxelated = True

        self.truck_sprite = loaders.spriteloader('truck.png', 
                                                 anchor=('center','center'),
                                                 anchor_offset=(7,0),
                                                 scale = .5,
                                                 batch=level_batch,
                                                 group=lfg2,
                                                 linear_interpolation=plxelated)
        self.l_wheel_sprite = loaders.spriteloader('wheel.png', 
                                                   anchor=('center','center'),
                                                   scale = .5,
                                                   batch=level_batch,
                                                   group=lfg3,
                                                   linear_interpolation=plxelated)
        self.r_wheel_sprite = loaders.spriteloader('wheel.png', 
                                                   anchor=('center','center'),
                                                   scale = .5,
                                                   batch=level_batch,
                                                   group=lfg3,
                                                   linear_interpolation=plxelated)
        self.l_sus_sprite = loaders.spriteloader('suspension.png', 
                                                 anchor=('center',9),
                                                 scale = .5,
                                                 batch=level_batch,
                                                 group=lfg,
                                                 linear_interpolation=plxelated)
        self.r_sus_sprite = loaders.spriteloader('suspension.png', 
                                                 anchor=('center',9),
                                                 scale = .5,
                                                 batch=level_batch,
                                                 group=lfg,
                                                 linear_interpolation=plxelated)
        ##
        self.accel_amount       = 4
        self.player_max_ang_vel = 100
        self.mouseGrabbed       = False
        self.grabFirstClick     = True
Example #9
0
	def __init__(self, space, starting_position, segment_size, amount, slack, image):

		self.starting_position = starting_position
		self.segment_size = segment_size
		self.space = space

		self.segment_mass = .5
		self.segment_list = []
		self.body_list = []
		self.add = 0
		for i in range(amount):
			self.segment_inertia      		= pymunk.moment_for_box(self.segment_mass, self.segment_size[0], self.segment_size[1])
			self.segment_body              	= pymunk.Body(self.segment_mass, self.segment_inertia)
			self.segment_body.position     	= self.starting_position[0]+self.add,self.starting_position[1]
			self.segment_shape             	= pymunk.Poly.create_box(self.segment_body, self.segment_size)
			self.segment_shape.friction    	= .8
			self.segment_shape.group       	= 2

			self.space.add(self.segment_body, self.segment_shape)
			self.body_list.append(self.segment_body)
			self.segment_list.append(self.segment_shape)


			self.add += self.segment_size[0]

		# Here I create two bodies that attach to each end of the bridge
		self.start_constraint = pymunk.Body()
		self.start_constraint.position = self.starting_position[0]-self.segment_size[0]//2,self.starting_position[1]

		self.end_constraint = pymunk.Body()
		self.end_constraint.position = self.starting_position[0]+self.add-self.segment_size[0]//2 - slack,self.starting_position[1]

		self.rest_ln = 0
		self.stiffness = 100
		self.damp = 8
		
		self.startPivot = pymunk.constraint.PivotJoint(self.start_constraint, self.body_list[0], (0,0), (self.segment_size[0]//-2,0))
		self.endPivot = pymunk.constraint.PivotJoint(self.end_constraint, self.body_list[-1], (0,0), (self.segment_size[0]//2,0))
		
		self.space.add(self.startPivot,self.endPivot)
		

		self.target_connect = 0
		# Pin Joint
		for seg in self.body_list[1:]:
			self.bridgeJoint = pymunk.constraint.PivotJoint(self.body_list[self.target_connect], seg, 
															(self.segment_size[0]//2,0), (self.segment_size[0]//-2,0))
			self.space.add(self.bridgeJoint)
			self.target_connect += 1
		'''
		## Primitives
		self.bridgeOutlineList = []
		for thing in self.body_list:
			self.bridgeOutlineDraw = debug_batch.add_indexed(4, pyglet.gl.GL_LINES, ordered_group, [0,1,1,2,2,3,3,0], ('v2f'), ('c3B', (0,0,0)*4))
			self.bridgeOutlineList.append(self.bridgeOutlineDraw)

		self.bridgeFillList = []
		for thing in self.body_list:
			self.bridgeFillDraw = debug_batch.add_indexed(4, pyglet.gl.GL_TRIANGLES, ordered_group, [0,1,2,2,3,0], ('v2f'), ('c4B', (0,0,0,50)*4))
			self.bridgeFillList.append(self.bridgeFillDraw)
		
		
		self.bridgeAnchors = debug_batch.add(2, pyglet.gl.GL_POINTS, ordered_group, ('v2f', (self.start_constraint.position[0],self.start_constraint.position[1],
																	self.end_constraint.position[0],self.end_constraint.position[1])),
																	('c3B', (0,255,0)*2))
		'''
		
		glPointSize(4)

		self.sprites = []
		'''
		image = levelassembler.imageloader(image, 'placeholder.png', (self.segment_size))
		image.anchor_x = image.width/2
		image.anchor_y = image.height/2
		'''
		for i in range(amount):
			sprite = loaders.spriteloader(image,
                                           size = segment_size,
                                           anchor = ('center','center'),
                                           linear_interpolation = True
                                           )
			#sprite.scale = .5
			self.sprites.append(sprite)
Example #10
0
	def __init__(self, 
				 position, 
				 image_file,
				 rot_pwr_img=False,
				 blend_img=(255,255,255),
				 blend_bar=(255,255,255),
				 pwr_type='None', 
				 grav_mod_dir=(0,-800), grav_fin_dir=(0,-800), 
				 accel_mod_amount=4, accel_fin_amount=4,
				 space_step_mod=.015, space_step_fin=.015,
				 dur=0,
				 activ_dist=75,
				 *args,**kwargs):
		self.rot_pwr_img 		 = rot_pwr_img
		self.bar_blend 			 = blend_bar
		self.position 			 = position
		self.pwr_type			 = pwr_type
		self.grav_mod_dir 		 = grav_mod_dir
		self.grav_finish_dir 	 = grav_fin_dir
		self.accel_mod_amount 	 = accel_mod_amount
		self.accel_finish_amount = accel_fin_amount

		self.space_step_mod 	 = space_step_mod
		self.space_step_fin 	 = space_step_fin

		self.activation_dist 	 = activ_dist

		self.duration = dur

		self.orig_dur = self.duration

		self.space_step_rate = self.space_step_mod

		self.sprite = loaders.spriteloader(image_file, 
										   pos 					= position,
										   anchor 				= ('center','center'),
										   scale 				= .5,
										   linear_interpolation = False
										   )
		tex = self.sprite.image.get_texture()
		glTexParameteri(tex.target, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
		glTexParameteri(tex.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST)

		self.sprite.color = blend_img
		self.blend_img = blend_img

		if rot_pwr_img:
			self.sprite.rotation = -Vec2d(grav_mod_dir).get_angle_degrees()+90

		self.sprite_grav_rotation = -Vec2d(grav_mod_dir).get_angle_degrees()+90

		self.collected = False
		self.do_action = False
		self.action_done = True

		self.bar_pos = -30

		self.sprite_opacity = 255
		self.sprite_scale = .5
		self.sprite_rotation = self.sprite_grav_rotation

		self.placed_in_queue = False
		self.modded = False

		self.sprite_color_r,self.sprite_color_g,self.sprite_color_b = 255,255,255

		self.scale_tweener = PiTweener.Tweener()
		self.tween_added = False
		self.duration_tween = PiTweener.Tweener()
		self.duration_tween_added = False

		self.collect_sound = loaders.Audio()
		self.collect_sound.load('resources/sounds/powerup_collected.wav')
Example #11
0
	def setup_pyglet_batch(self, level_batch, ui_batch, ordered_group, ordered_group2, ordered_group3, screen_res, ordered_group_bg=None):
		self.ui_batch = ui_batch
		self.sprite.batch = level_batch
		self.sprite.group = ordered_group3
		self.screen_res = screen_res


		self.mask_width = 200
		self.orig_mask_width = self.mask_width
		self.mask_height = 10

		self.mask_x = (screen_res[0]//2)-(self.mask_width//2)
		self.mask_y = self.bar_pos

		###

		img = pyglet.resource.image('p_b.png')
		bar_height = img.height//2
		bar_width = (img.width//2)

		self.mask_group = GroupWithMask(self.mask_x,self.mask_y,
										self.mask_width,bar_height, 
										parent=ordered_group2)
		
		l_cap_b_img = img.get_region(0,0,img.width//2,bar_height)
		self.l_cap_b = loaders.image_sprite_loader(l_cap_b_img, 
												   pos 						= (self.mask_x,self.mask_y),
												   batch 					= ui_batch,
												   group 					= ordered_group,
												   anchor 				    = (bar_width,0),
												   linear_interpolation 	= True)
		r_cap_b_img = img.get_region(bar_width+1,0,bar_width,bar_height)
		self.r_cap_b = loaders.image_sprite_loader(r_cap_b_img, 
												   pos 						= (self.mask_x+self.mask_group.width,self.mask_y),
												   batch 					= ui_batch,
												   group 					= ordered_group,
												   anchor 				    = (0,0),
												   linear_interpolation 	= True)

		b_meter = pyglet.image.Texture.create(self.mask_group.width,bar_height)
		b_meter_img = img.get_region(bar_width,0,1,bar_height).get_image_data()
		offset = 0
		while offset <= self.mask_group.width:
			b_meter.blit_into(b_meter_img,offset,0,0)
			offset += 1
		self.b_meter = loaders.image_sprite_loader(b_meter, 
												   pos 						= (self.mask_x,self.mask_y),
												   batch 					= ui_batch,
												   group 					= ordered_group,
												   anchor 					= (0,0),
												   linear_interpolation 	= True)

		##

		l_cap_f_img = img.get_region(0,bar_height,bar_width,bar_height)
		self.l_cap_f = loaders.image_sprite_loader(l_cap_f_img, 
												   pos 						= (self.mask_x,self.mask_y),
												   batch 					= ui_batch,
												   group 					= ordered_group2,
												   anchor 				    = (bar_width,0),
												   linear_interpolation 	= True)
		r_cap_f_img = img.get_region(bar_width+1,bar_height,bar_width,bar_height)
		self.r_cap_f = loaders.image_sprite_loader(r_cap_f_img, 
												   pos 						= (self.mask_x+self.mask_group.width,self.mask_y),
												   batch 					= ui_batch,
												   group 					= ordered_group2,
												   anchor 				    = (0,0),
												   linear_interpolation 	= True)

		f_meter = pyglet.image.Texture.create(self.mask_group.width,bar_height)
		f_meter_img = img.get_region(bar_width,bar_height,1,bar_height).get_image_data()
		offset = 0
		while offset <= self.mask_group.width:
			f_meter.blit_into(f_meter_img,offset,0,0)
			offset += 1
		self.f_meter = loaders.image_sprite_loader(f_meter, 
												   pos 						= (self.mask_x,self.mask_y),
												   batch 					= ui_batch,
												   group 					= self.mask_group,
												   anchor 					= (0,0),
												   linear_interpolation 	= True)

		if self.bar_blend != (255,255,255):
			self.l_cap_f.color,self.r_cap_f.color,self.f_meter.color = self.bar_blend,self.bar_blend,self.bar_blend

		self.sprite_list = [self.l_cap_b,self.r_cap_b,self.b_meter,
							self.l_cap_f,self.r_cap_f,self.f_meter]


		self.power_label = pyglet.text.Label(text = self.pwr_type,
											 font_name = 'Calibri', font_size = 8, bold = True,
											 x = screen_res[0]//2, y = self.mask_y+16, 
											 anchor_x = 'center', anchor_y = 'center',
											 color = (255,255,255,255),
											 batch = ui_batch,
											 group=ordered_group2)

		self.power_label_shadow = pyglet.text.Label(text = self.pwr_type,
											 		font_name = 'Calibri', font_size = 8, bold = True,
											 		x = screen_res[0]//2, y = self.mask_y+16, 
											 		anchor_x = 'center', anchor_y = 'center',
											 		color = (0,0,0,240),
											 		batch = ui_batch,
											 		group=ordered_group)

		self.background_sprite = loaders.spriteloader('progress_bar_container.png', 
								  					  pos 						= (screen_res[0]//2,-20),
								  					  anchor 					= ('center','center'),
								  					  batch 					= ui_batch,
								  					  group 					= ordered_group_bg,
								  					  linear_interpolation 	=	 True)

		self.flash = False

		self.smooth = self.bar_pos

		self.a = 1
		self.emitter = particles2D.Emitter(pos = self.position)
		particle_img = pyglet.resource.image('spark.png')
		self.factory = particles2D.powerup(.5,
										   ((-1,1),(.1,2.5)),
										   particle_img,
										   color_overlay=self.blend_img,
										   batch=level_batch,
										   group=ordered_group3)
		self.emitter_spurt = particles2D.Spurt(self.emitter)
Example #12
0
    def __init__(self, space, position, hinge_pos, 
                 padding, 
                 ang_vel, start, end, 
                 image):
        self.padding = padding
        padding_left = self.padding[0]
        padding_bottom = self.padding[1]
        padding_right = self.padding[2]
        padding_top = self.padding[3]
        self.ang_vel = abs(ang_vel) # Refrain from using negative angular velocities, as it may give unexpected results.
        self.start = start + 57
        self.end = end + 57
        #size = 20,20
        #self.force = force
        self.space = space
        mass = 3
        #self.inertia = pymunk.moment_for_box(mass, size[0], size[1])
        
        '''
        self.shape = pymunk.Poly.create_box(self.body, size)
        self.shape.friction = 1
        self.shape.group = 2
        self.space.add(self.body, self.shape)
        '''
        self.body = pymunk.Body(pymunk.inf, pymunk.inf)
        self.body.angle = math.radians(start)
        self.shapelist = [
            pymunk.Segment(self.body, (333.9878888620935, 201.3931176121986), (324.543444417649, 201.3931176121986), 4),
            pymunk.Segment(self.body, (324.60529688755037, 201.4223178430688), (305.1608524431059, 204.14454006529104), 4),
            pymunk.Segment(self.body, (305.1608524431059, 204.14454006529104), (282.6052968875503, 215.8112067319577), 4),
            pymunk.Segment(self.body, (282.6052968875503, 215.8112067319577), (265.8830746653281, 235.25565117640218), 4),
            pymunk.Segment(self.body, (265.8830746653281, 235.25565117640218), (257.32751910977254, 264.42231784306887), 4),
            pymunk.Segment(self.body, (257.32751910977254, 264.42231784306887), (258.8830746653281, 289.7000956208467), 4),
            pymunk.Segment(self.body, (258.8830746653281, 289.7000956208467), (268.60529688755025, 311.0889845097356), 4),
            pymunk.Segment(self.body, (268.60529688755025, 311.0889845097356), (285.71640799866145, 327.4223178430689), 4),
            pymunk.Segment(self.body, (285.71640799866145, 327.4223178430689), (312.9386302208837, 338.70009562084675), 4),
            pymunk.Segment(self.body, (312.9386302208837, 338.70009562084675), (347.1608524431059, 339.0889845097356), 4),
            pymunk.Segment(self.body, (347.1608524431059, 339.0889845097356), (381.3830746653282, 331.31120673195784), 4),
            pymunk.Segment(self.body, (381.3830746653282, 331.31120673195784), (412.8830746653282, 312.64454006529115), 4),
            pymunk.Segment(self.body, (412.8830746653282, 312.64454006529115), (440.8830746653283, 284.64454006529115), 4),
            pymunk.Segment(self.body, (440.8830746653283, 284.64454006529115), (459.93863022088385, 251.58898450973552), 4),
            pymunk.Segment(self.body, (459.93863022088385, 251.58898450973552), (468.8830746653283, 219.31120673195772), 4),
            pymunk.Segment(self.body, (468.8830746653283, 219.31120673195772), (467.7164079986617, 180.42231784306878), 4),
            pymunk.Segment(self.body, (467.7164079986617, 180.42231784306878), (457.6052968875505, 146.9778733986243), 4),
            pymunk.Segment(self.body, (457.6052968875505, 146.9778733986243), (442.43863022088385, 119.75565117640204), 4),
            pymunk.Segment(self.body, (442.43863022088385, 119.75565117640204), (410.54974133199494, 89.03342895417978), 4),
            pymunk.Segment(self.body, (410.54974133199494, 89.03342895417978), (378.660852443106, 72.31120673195754), 4),
            pymunk.Segment(self.body, (378.660852443106, 72.31120673195754), (332.38307466532814, 64.14454006529087), 4)
            ]

        
        self.body.position = (self.shapelist[0].a)#(position[0]-hinge_pos[0], position[1]-hinge_pos[1])
        self.seg_list = []

        for shape in self.shapelist:
            s = shape
            s.a[0] -= self.body.position[0]
            s.a[1] -= self.body.position[1]
            s.b[0] -= self.body.position[0]
            s.b[1] -= self.body.position[1]
            s.friction = 1
            s.group = 2
            self.seg_list.append(s)
        self.space.add(self.body, self.shapelist)

        self.hinge_body = pymunk.Body()
        self.hinge_body.angle = math.radians(start) + math.radians(57)
        self.hinge_body.position = self.body.position[0] + hinge_pos[0], self.body.position[1] + hinge_pos[1]

        pivot = pymunk.constraint.PivotJoint(self.body, self.hinge_body, (hinge_pos), (0,0))
        self.space.add(pivot)

        gear = pymunk.constraint.GearJoint(self.body, self.hinge_body, 1.0, 1.0)
        self.space.add(gear)

        self.left = (position[0] - padding_left, position[1] + padding_top)
        self.bottom = (position[0] - padding_left, position[1]- padding_bottom)
        self.right = (position[0] + padding_right, position[1]- padding_bottom)
        self.top = (position[0] + padding_right, position[1] + padding_top)

        self.bb = pymunk.BB(position[0] - padding_left, #- hinge_pos[0], # left
                            position[1] - padding_bottom, #  - hinge_pos[1], # bottom
                            position[0] + padding_right, # - hinge_pos[0], # right
                            position[1] + padding_top, ) # - hinge_pos[1]) # top
        
        self.color = (200,0,0)
        self.color2 = (0,200,0)
        self.color3 = (200,200,0)
        '''
        image = levelassembler.imageloader(image, 'placeholder.png', (10,10))
        tex = image.get_texture()
        glTexParameteri(tex.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
        glTexParameteri(tex.target, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
        self.sprite = pyglet.sprite.Sprite(image) # batch = level_batch, group = ordered_group)
        #self.sprite.image.width = size[0]
        #self.sprite.image.height = size[1]
        self.sprite.image.anchor_x = 82
        self.sprite.image.anchor_y = 140
        #self.sprite.scale = .5
        '''
        self.sprite = loaders.spriteloader(image,
                                           #size = size,
                                           anchor = (82,140),
                                           linear_interpolation = True
                                           )
	def __init__(self, 
					map_zip,
					space,
					screen_res,
					debug_batch,
					background_batch,
					level_batch,
					ui_batch,
					lfg3,
					lfg2,
					lfg,
					lbg,
					pbg4,
					pbg3,
					pbg2,
					pbg,
					bg,
					editor_mode = False):
		self.debug_batch 		= debug_batch
		self.background_batch 	= background_batch
		self.level_batch 		= level_batch
		self.ui_batch 			= ui_batch
		self.lfg3 				= lfg3
		self.lfg2 				= lfg2
		self.lfg 				= lfg
		self.lbg 				= lbg
		self.pbg4				= pbg4
		self.pbg3				= pbg3
		self.pbg2 				= pbg2
		self.pbg 				= pbg
		self.bg 				= bg
		self.editor_mode 		= editor_mode

		self.space = space
		self.screen_res = screen_res
		self.map_zip = zipfile.ZipFile(map_zip)

		self.map_zip.extract('map_config.cfg', path = 'temp')
		self.map_zip.extract('map_layout.map', path = 'temp')
		self.map_zip.close()

		self.mapConfig          = configparser.ConfigParser()
		self.mapConfig.read('temp/map_config.cfg')
		self.mapName            = self.mapConfig.get("MapConfig", "Name")
		self.mapAuthor          = self.mapConfig.get("MapConfig", "Author")
		self.mapWidth           = self.mapConfig.getint("MapConfig","Width")
		self.mapHeight          = self.mapConfig.getint("MapConfig","Height")
		self.playerType         = str(self.mapConfig.get("MapConfig", "Player_Type"))
		self.start_Position_X   = self.mapConfig.getint("MapConfig", "Player_Start_Position_X")
		self.start_Position_Y   = self.mapConfig.getint("MapConfig", "Player_Start_Position_Y")
		self.start_Position     = self.start_Position_X,self.start_Position_Y
		self.tile_size          = int(self.mapConfig.get("MapConfig", "Tile_Size"))
		print("Name: "+self.mapName+"by "+self.mapAuthor)
		print("Map size: "+str(self.mapWidth)+", "+str(self.mapHeight))
		print("Player Type: "+self.playerType)
		print("Starting Position: "+str(self.start_Position_X),str(self.start_Position_Y))
		print("Tile size: "+str(self.tile_size))
		################################ End Map Config
		self.map_file = open('temp/map_layout.map')
		self.screen_res = screen_res
		self.aspect = screen_res[0]/screen_res[1]
		static_body = pymunk.Body()
		dirt_body = pymunk.Body()

		self.map_segments = [] # creates a list to hold segments contained in map file
		self.elevators = []
		self.bridges = []
		self.jellies = []
		self.mobis = []
		self.boxes = []
		self.collectables = []
		self.detectors = []
		self.triggers = []
		self.powerups = []

		for line in self.map_file:
			line = line.strip() # refer to http://programarcadegames.com/index.php?chapter=searching
			#print(line)
			if line == "": continue # skip blank lines
			if line.startswith("#"): continue # skip comments

			#====================================#
			if line.startswith("pymunk.Segment"): # Add static segments and objects first
				line = eval(line) # converts string to an object ('segment' -> <segment>)
				#print(line)
				line.friction = .5
				
				line.group = 2
				if line.body == dirt_body:
					line.collision_type = 2
				else: line.collision_type = 3
				self.map_segments.append(line)
				continue
			if line.startswith("elevator"):
				#print(line)
				line = eval(line)
				self.elevators.append(line)
				continue
			if line.startswith("bridge"):
				#print(line)
				line = eval(line)
				self.bridges.append(line)
				continue
			if line.startswith("jelly"):
				#print(line)
				line = eval(line)
				self.jellies.append(line)
				continue
			if line.startswith("mobi"):
				#print(line)
				line = eval(line)
				self.mobis.append(line)
				continue
			if line.startswith("box.Boxes"):
				#print(line)
				line = eval(line)
				self.boxes.append(line)
				continue
			if line.startswith("collectable.Collectable"):
				line = eval(line)
				self.collectables.append(line)
				continue
			if line.startswith("trigger"):
				line = eval(line)
				self.triggers.append(line)
				continue
			if line.startswith("playerdetector"):
				#print(line)
				line = eval(line)
				self.detectors.append(line)
				continue
			if line.startswith("powerup"):
				#print(line)
				line = eval(line)
				self.powerups.append(line)
				continue
		self.map_file.close()

		self.space.add(self.map_segments)
		for line in self.map_segments:
			p1 = line.a 
			p2 = line.b 
			self.stuff = self.debug_batch.add(2, pyglet.gl.GL_LINES, self.lfg,
										('v2f/static', (p1[0],p1[1],p2[0],p2[1])),
										('c3B/static', (125,10,160,200,20,60)))
		for line in self.collectables:
			line.setup_pyglet_batch(self.level_batch, self.ui_batch, self.lfg3)
		for line in self.boxes:
			line.setup_pyglet_batch(self.debug_batch, self.level_batch, self.lfg)
		for line in self.bridges:
			line.setup_pyglet_batch(self.debug_batch, self.level_batch, self.lfg)
		for line in self.mobis:
			line.setup_pyglet_batch(self.debug_batch, self.level_batch, self.lfg2)
		for line in self.triggers:
			line.setup_pyglet_batch(self.debug_batch, self.level_batch, self.ui_batch, self.lfg3, screen_res)

		'''
		Alright, in case if I forget. What I'm about to do is temporarly add 
		the map's zip file to the resource path and directly load the zip's
		contained images. That way I do not have to extract everything from 
		within the zip every time I want to load the map's images. This should
		not only help with speed, but make everything relatively cleaner. But
		since each image is within a subdirectory within the zip file, I have
		to navigate to that directory directly by putting 'images/' before
		the image. Once I'm done loading all of that, I pop the zip from the
		resource module's searchable path.
		'''

		pyglet.resource.path.append(map_zip)
		pyglet.resource.reindex()

		self.bg_tiled = BackgroundTiler('images/bg.png', scale=.5, tile_size = self.tile_size)
		self.bg_tiled.setup(self.level_batch, self.bg, (self.mapWidth,self.mapHeight))

		self.bottom_tiled = BackgroundTiler('images/bottom.png', scale=.5, tile_size = self.tile_size)
		self.bottom_tiled.setup(self.level_batch, self.pbg, (self.mapWidth,self.mapHeight))

		self.middle_tiled = BackgroundTiler('images/middle.png', scale=.5, tile_size = self.tile_size)
		self.middle_tiled.setup(self.level_batch, self.pbg2, (self.mapWidth,self.mapHeight))

		#self.top_tiled = BackgroundTiler('images/top.png', scale=.5, tile_size = self.tile_size)
		#self.top_tiled.setup(self.level_batch, self.pbg4, (self.mapWidth,self.mapHeight))

		self.level_tiled = BackgroundTiler('images/level.png', scale=.5, tile_size = self.tile_size)
		self.level_tiled.setup(self.level_batch, self.lbg, (self.mapWidth,self.mapHeight))

		pyglet.resource.path.pop(-1)
		pyglet.resource.reindex()

		self.level_name 		= pyglet.text.Label(text = self.mapName,
													font_name = 'Calibri', font_size = 8, bold = True,
													x = 1, y = screen_res[1]+2,
													anchor_x = 'left', anchor_y = 'top',
													color = (0,0,0,200),
													batch = self.ui_batch)
		self.level_author_name 	= pyglet.text.Label(text = ' by '+self.mapAuthor,
													font_name = 'Calibri', font_size = 8, bold = True,
													x = self.level_name.content_width+1, y = screen_res[1]+2,
													anchor_x = 'left', anchor_y = 'top',
													color = (0,0,0,120),
													batch = self.ui_batch)
		self.level_name.set_style('background_color', (255,255,255,80))
		self.level_author_name.set_style('background_color', (255,255,255,80))

		if self.playerType == 'Truck':
			self.player = playernew.Truck(self.space, 
										(self.start_Position), 
										self.level_batch, 
										self.debug_batch,
										self.ui_batch,
										self.lfg, 
										self.lfg2, 
										self.lfg3)
		if self.playerType == 'None' or editor_mode == True:
			self.player = None

		for line in self.powerups:
			line.setup_modifiers(self.player, self.space)
			line.setup_pyglet_batch(self.level_batch, self.ui_batch, 
									self.lfg, self.lfg2, lfg3, 
									self.screen_res, 
									ordered_group_bg=self.lbg)

		if not editor_mode:
			self.gt = gametime.GameTime()
			self.time_ui 	= loaders.spriteloader('time_ui.png', 
											anchor=(0,0),
											pos = (5,5),
											batch=self.ui_batch,
											group=self.lfg,
											linear_interpolation=True)
			self.time_label = pyglet.text.Label(text = '00:00:00',
											font_name = 'Calibri', font_size = 11, bold = True, italic = True,
											x = 50, y = 5,
											anchor_x = 'left', anchor_y = 'bottom',
											color = (255,255,255,255),
											batch = self.ui_batch,
											group = self.lfg3)

		self.powerup_queue = powerup.PowerUpQueue()
		self.active_powerups = []
		self.space_step_rate = 0.015
Example #14
0
    def __init__(self, space, body_position, level_batch, debug_batch, ordered_group_lfg, ordered_group_lfg2, ordered_group_lfg3):
        self.space = space
        #self.map_size = map_size

        self.lcircle = Circle()
        self.rcircle = Circle()

        # body
        self.body_position      = body_position
        self.body_mass          = .9
        self.body_size          = (104,18) #(70,15)
        self.body_inertia       = pymunk.moment_for_box(self.body_mass, self.body_size[0], self.body_size[1])
        self.car_body           = pymunk.Body(self.body_mass, self.body_inertia)
        self.car_body.position  = self.body_position
        #self.body_poly          = pymunk.Poly.create_box(self.car_body, self.body_size)
        self.space.add(self.car_body)
        self.origin = (-9,2)
        self.parts =    [((self.origin),(50,-8),(49,7),(24,8)),
                        ((self.origin),(24,8),(10,20),(-7,20)),
                        ((self.origin),(-51,2),(-55,-8),(50,-8)),
                        ((-55,-8),(-55,6),(-51,10),(-51,2)),
                        ]
        self.shape_list = []
        for part in self.parts:
            self.part = pymunk.Poly(self.car_body, part)
            self.part.friction = 0.3 #0.5
            self.part.group    = 1  # so that the wheels and the body do not collide with eachother
            self.space.add(self.part)
            self.shape_list.append(self.part)

        # left wheel
        self.left_wheel_mass            = .3
        self.left_wheel_radius          = 13
        self.left_wheel_position_x      = self.body_position[0]-(self.body_size[0]//2) + self.left_wheel_radius
        self.left_wheel_position_y      = self.body_position[1] - self.body_size[1]
        self.left_wheel_position        = self.left_wheel_position_x, self.left_wheel_position_y
        
        self.inertiaL                   = pymunk.moment_for_circle(self.left_wheel_mass, 0, self.left_wheel_radius)
        self.left_wheel_b               = pymunk.Body(self.left_wheel_mass, self.inertiaL)
        self.left_wheel_b.position      = self.left_wheel_position
        self.left_wheel_shape           = pymunk.Circle(self.left_wheel_b, self.left_wheel_radius)
        self.left_wheel_shape.friction  = 1.8
        self.left_wheel_shape.group     = 1  # so that the wheels and the body do not collide with eachother
        self.left_wheel_shape.collision_type = 1
        
        self.space.add(self.left_wheel_b, self.left_wheel_shape)

        # right wheel
        self.right_wheel_mass           = .3
        self.right_wheel_radius         = 13
        self.right_wheel_position_x     = self.body_position[0]+(self.body_size[0]//2) - self.right_wheel_radius
        self.right_wheel_position_y     = self.body_position[1] - self.body_size[1]
        self.right_wheel_position       = self.right_wheel_position_x, self.right_wheel_position_y
        
        self.inertiaR                   = pymunk.moment_for_circle(self.right_wheel_mass, 0, self.right_wheel_radius)
        self.right_wheel_b              = pymunk.Body(self.right_wheel_mass, self.inertiaR)
        self.right_wheel_b.position     = self.right_wheel_position
        self.right_wheel_shape          = pymunk.Circle(self.right_wheel_b, self.right_wheel_radius)
        self.right_wheel_shape.friction = 1.8
        self.right_wheel_shape.group    = 1  # so that the wheels and the body do not collide with eachother
        
        self.space.add(self.right_wheel_b, self.right_wheel_shape)

        # Springs and Other Constraints
        self.rest_ln        = 25 # 20
        self.lift           = 25
        self.stiff          = 100 # 90
        self.damp           = .4 # .8
        self.wheel_base     = 34
        
        self.left_spring   = pymunk.constraint.DampedSpring(self.car_body, self.left_wheel_b, (-self.wheel_base, 0), (0,0), self.rest_ln, self.stiff, self.damp)
        self.right_spring  = pymunk.constraint.DampedSpring(self.car_body, self.right_wheel_b, (self.wheel_base, 0), (0,0), self.rest_ln, self.stiff, self.damp)

        self.left_groove    = pymunk.constraint.GrooveJoint(self.car_body, self.left_wheel_b, (-self.wheel_base, -5), (-self.wheel_base, -self.lift), (0,0))
        self.right_groove   = pymunk.constraint.GrooveJoint(self.car_body, self.right_wheel_b, (self.wheel_base, -5), (self.wheel_base, -self.lift), (0,0))

        self.space.add(self.left_spring, self.right_spring, self.left_groove, self.right_groove)


        self.player_sprite = loaders.spriteloader('truck.png', 
                                                  anchor=('center','center'),
                                                  anchor_offset=(7,-1),
                                                  scale = .5,
                                                  batch=level_batch,
                                                  group=ordered_group_lfg2,
                                                  linear_interpolation=True)

        self.wheel_sprite_l = loaders.spriteloader('wheel.png', 
                                                  anchor=('center','center'),
                                                  #anchor_offset=(7,-1),
                                                  scale = .5,
                                                  batch=level_batch,
                                                  group=ordered_group_lfg3,
                                                  linear_interpolation=True)

        self.wheel_sprite_r = loaders.spriteloader('wheel.png', 
                                                  anchor=('center','center'),
                                                  #anchor_offset=(7,-1),
                                                  scale = .5,
                                                  batch=level_batch,
                                                  group=ordered_group_lfg3,
                                                  linear_interpolation=True)


        self.suspension_sprite_l = loaders.spriteloader('suspension.png', 
                                                  anchor=('center',9),
                                                  #anchor_offset=(7,-1),
                                                  scale = .5,
                                                  batch=level_batch,
                                                  group=ordered_group_lfg,
                                                  linear_interpolation=True)

        self.suspension_sprite_r = loaders.spriteloader('suspension.png', 
                                                  anchor=('center',9),
                                                  #anchor_offset=(7,-1),
                                                  scale = .5,
                                                  batch=level_batch,
                                                  group=ordered_group_lfg,
                                                  linear_interpolation=True)

        self.band_debug = debug_batch.add(2, pyglet.gl.GL_LINES, ordered_group_lfg3,
                                          ('v2f'),
                                          ('c3B', (255,125,255)*2))


        self.mouseGrabbed = False
        self.grabFirstClick = True
        self.player_max_ang_vel = 100