def jump_effect(self, dt): #TODO: Try to use this, but we need more reaction (this method should be called by clock in self.jump()) self.JUMPING_STEPS += 1 window.set_gravity(False) if self.y > window.bufferedHeight + 10: pyglet.clock.unschedule(self.jump_effect) window.set_gravity(True) return #Security fix to prevent ignore pipes in the sky :) if self.JUMPING_STEPS < self.JUMP_MAX_STEPS: #can jump SprObj.jump(self, self.JUMP_INCREASE_LEVEL, self.JUMP_CHANGE_ANGLE) else: pyglet.clock.unschedule(self.jump_effect) window.set_gravity(True) self.JUMPING_STEPS = 0
def jump(self): play_audio('assets/audio/flap.wav') window.set_gravity(False) SprObj.jump(self, self.JUMP_STEPS, self.JUMP_CHANGE_ANGLE) window.set_gravity(True)