I am using Riyuzakisan’s MouseMove to control the dynamic movement of my avatar. I am trying to add a delay between the key press and the applyMovement. When my character jumps, it is an instant reaction and the animation is way out of sync. I want the applyMovement to happen 15 frames after the key press. Does anyone know how to do this?
The applyMovement happens here;
def state_onGround(self): controls = self.core.controls ### Adjust Speed and Damping ### if controls.crouch: self.speed *= 0.3 self.damping = 0.85 else: if controls.run and (controls.forward and not controls.back): self.speed = self.runspeed self.damping = 0.18 if controls.jump and self.ray: self.finalVelocity = self.jumpspeed self.run_state = self.state_inAir if not self.col: self.run_state = self.state_inAir ### Apply ### self.assignVelocity() self.applyMovement() self.limitVelocity() self.applyDamping()
and the key press is controlled here;
def main(self): key = logic.keyboard.events self.jump = key[events.SPACEKEY]