所以我使用带有图像的 spritenode 并且我没有设置它的位置。有趣的是,我在设置它的位置时遇到了问题,所以我没有设置它,默认情况下它被设置为页面中心(出于明显的原因),最终完美。所以现在在我的 touchesbegan 方法中,如果原始图像被按下,我希望更改所述图像,所以我正在检查触摸位置是否等于(图像的)节点的位置。然后,如果这是真的,我将其替换为名为“nowaves”的新图像。
for touch in touches
{
let location = touch.location(in: self)
if (location == audioPlaying.position)
{
audioPlaying = SKSpriteNode(imageNamed: "nowaves")
}
else
{
大家觉得我有必要读吗?好吧,正如我要求的那样,我对其进行了测试,但没有结果。这是我尝试过的:
audioPlaying.size = CGSize(width: frame.size.width / 13, height: frame.size.height / 20)
addChild(audioPlaying)
如果有人知道问题是什么,我希望得到一些反馈,谢谢:D