내 장면은 다음과 같습니다 : 나는 SpriteKit
을 사용하고 있는데 나는 네 개의 버튼이 장면을 만들어 버튼을 선택하면 버튼 주위에 원을 그리는 방법은 무엇입니까?
.
사용자가 그 중 하나를 두드리는 경우 선택한 버튼 주위에 검은 색 원이 나타나야합니다. 사용자가 다른 버튼을 선택하면 이전 원이 사라지고 새 버튼에 원이 생깁니다.
누구든지이 작업을 수행하는 방법을 알고 있습니까?
여기 내 코드입니다 : 당신이 이것을 달성 할 수있는 몇 가지 방법이 있습니다
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
for touch in touches{
let locationUser = touch.location(in: self)
if atPoint(locationUser) == blueButton {
}
if atPoint(locationUser) == purpleButton {
}
if atPoint(locationUser) == redButton {
}
if atPoint(locationUser) == orangeButton {
}
}
}
Alternative Sub-Title : OOP가 어떻게 간단한 것들을 엄청난 양의 눈에 띄게 만듭니다. 진행. – Confused