【问题标题】:How does work touchBegin on SKSpriteNode(SKNode) on SpriteKit?SpriteKit 上的 SKSpriteNode(SKNode) 上的 touchBegin 是如何工作的?
【发布时间】:2014-12-03 08:38:29
【问题描述】:

我将 SpriteKit 与 Swift 一起使用。我通过覆盖 SKSpriteNode 上的 touchesBegin 实现的按钮。但我不明白它是如何接触到的。有时按钮如果超过它有 SKSpriteNode 则不会捕获,有时相反。请给我解释一下。

谢谢!

【问题讨论】:

  • 我们可以看看一些代码吗?

标签: button swift sprite-kit touchesbegan touches


【解决方案1】:

我认为您遇到的问题是由于 .userInteractionEnabled 设置而未注册。确保你使用sprite.userInteractionEnabled = true,因为它默认为 false。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-20
    • 1970-01-01
    相关资源
    最近更新 更多