Swift 如果播放机正在触摸屏幕,如何检查每个帧?
如何检查播放机是否每帧都触摸屏幕?我想要一些类似的东西,当你在游戏几何短跑中一直触摸屏幕时,如果你触摸到地面,你就会一直跳跃。我试过了,但没有成功:Swift 如果播放机正在触摸屏幕,如何检查每个帧?,swift,sprite-kit,Swift,Sprite Kit,如何检查播放机是否每帧都触摸屏幕?我想要一些类似的东西,当你在游戏几何短跑中一直触摸屏幕时,如果你触摸到地面,你就会一直跳跃。我试过了,但没有成功: override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { isTouching = true } 请尝试以下代码: var isTouching = false override func touchesBegan(_ touche
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
isTouching = true
}
请尝试以下代码:
var isTouching = false
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
isTouching = true
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
isTouching = false
}
var isTouching=false
覆盖func TouchesBegind(Touchs:Set,带有事件:UIEvent?){
isTouching=true
}
覆盖函数touchesend(touchs:Set,带有事件:UIEvent?){
isTouching=false
}
请尝试以下代码:
var isTouching = false
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
isTouching = true
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
isTouching = false
}
var isTouching=false
覆盖func TouchesBegind(Touchs:Set,带有事件:UIEvent?){
isTouching=true
}
覆盖函数touchesend(touchs:Set,带有事件:UIEvent?){
isTouching=false
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
isTouching = true
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
isTouching = false
}
if isTouching == true {
do something
}
else {
do something else
}