def init(self): #Sound we play when moving. self.m_playSound = parseBool(self.getProperty("playSound", 0, "1")) if (self.m_playSound): self.v_sound = GraLL2.createSound("DoorOpen.wav", True, False) self.attachSound(self.v_sound) self.v_sound.setReferenceDistance(1.2) #Methods. self.open = open self.close = close
def init(self): #Create a Pad mesh, set the JumpPad material, and make a Box physics body. self.createMesh("Template_Pad.mesh") self.setMaterial("Objects/JumpPad") self.createBody(GraLL2.CollisionShape.Box, GraLL2.BodyType.Static, GraLL2.CollisionFlags.Static) #We get the jump impulse from the properties. self.m_impulse = float(self.getProperty("impulse", 0, "15")) #Create sound. self.v_sound = GraLL2.createSound("JumpPad.wav", False, False) self.attachSound(self.v_sound) self.v_sound.setReferenceDistance(1.2) self.v_sound.setGain(7)
def init(self): #Get the properties. soundFile = self.getProperty("soundFile", 0, "Default.wav") loop = parseBool(self.getProperty("loop", 0, "1")) stream = parseBool(self.getProperty("stream", 0, "1")) #Create sound. self.v_sound = GraLL2.createSound(soundFile, loop, stream) self.v_sound.setPosition(self.getPosition()) #Set sound properties. self.v_sound.setDistanceValues( float(self.getProperty("attenuation", 0, "20")), float(self.getProperty("attenuation", 1, "4")), float(self.getProperty("attenuation", 2, "6")) ) self.v_sound.setGain( float(self.getProperty("gain", 0, "1")) )
def init(self): #Create a Pad mesh, set the JumpPad material, and make a Box physics body. self.createMesh("Template_Pad.mesh") self.setMaterial("Objects/JumpPad") self.createBody(GraLL2.CollisionShape.Box, GraLL2.BodyType.Static, GraLL2.CollisionFlags.Static) #Create Player detection cast. unitY = self.getOrientation() * Ngf.Vector3.UNIT_Y self.createBoxCast(Ngf.Vector3(0.3, 0.1, 0.3), 1.2, self.getPosition() + 0.35*unitY, self.getPosition() + 0.45*unitY) #We get the jump impulse from the properties. self.m_impulse = float(self.getProperty("impulse", 0, "15")) * 0.5 #Create sound. self.v_sound = GraLL2.createSound("JumpPad.wav", False, False) self.attachSound(self.v_sound) self.v_sound.setReferenceDistance(1.2) self.v_sound.setGain(7)