был очень разочарован, и мне сказали использовать переполнение стека для помощи!
Вот моя проблема: я не могу заставить счет уменьшиться после пересечения самолета с птицей!
func behaviorFunctions() {
dynamicItemBehavior = UIDynamicItemBehavior(items: [bird1, plane1])
collisionBehavior = UICollisionBehavior(items: [bird1, plane1])
collisionBehavior.translatesReferenceBoundsIntoBoundary = true
collisionBehavior.addBoundary(withIdentifier: "plane1" as NSCopying, for: UIBezierPath(rect: plane1.frame))
collisionBehavior.addBoundary(withIdentifier: "bird1" as NSCopying, for: UIBezierPath(rect: bird1.frame)); animator.addBehavior(dynamicItemBehavior!)
animator.addBehavior(collisionBehavior)
collisionBehavior.action = {
for _ in self.imageArrayBird!{
if(self.plane1.frame.intersects(self.bird1.frame)){
self.score = self.score - 50
}
}
}
}
В чем здесь проблема? Как мне это исправить?
Заранее благодарю за любые ответы!