admin管理员组文章数量:1401796
I'm trying to make a running and jumping game where I want the sprite to be able to do one double jump.
The problem is that when I click the button a second time while the ninja is in the air, it hardly jumps a second time at all. It just moves up a tiny little bit and isn't a proper second jump. Any advice?
The code I'm using to do the jump is:
let jumpUpAction = SKAction.moveBy(x: 0, y: 80, duration: 0.15)
let jumpUpAction2 = SKAction.moveBy(x: 0, y: 20, duration: 0.025)
let jumpDownAction = SKAction.moveBy(x: 0, y: -80, duration: 0.15)
let jumpDownAction2 = SKAction.moveBy(x: 0, y: -20, duration: 0.025)
let jumpSequence = SKAction.sequence([
jumpUpAction, jumpUpAction2,
jumpDownAction, jumpDownAction2
])
ninja.run(jumpSequence)
But when I click the button while the ninja is in the air it hardly jumps a second time at all.
本文标签: iosSpritekit Implementing a double jumpStack Overflow
版权声明:本文标题:ios - Spritekit: Implementing a double jump - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744288301a2598989.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论