저는 현재 클릭/돈 게임을 만들고 있는데 도움이 필요합니다. 기본적으로 앱은 클릭 할 때마다 +1 동전을주는 버튼으로 구성됩니다. 예를 들어 "10 동전을위한 이중 동전"을 구입하면 금액을 +1에서 +2로 변경하고 싶습니다. Xcode UIbutton 함수
Click here to see how the app looks right now, it might be easier to understand.
에서
는 관련이있을 수있는 몇 가지 코드입니다.@IBAction func button(_ sender: UIButton) {
score += 1
label.text = "Coins: \(score)"
errorLabel.text = ""
func doublee(sender:UIButton) {
score += 2
}
@IBAction func points(_ sender: UIButton) {
if score >= 10 {
score -= 10
label.text = "Coins: \(score)"
doublePoints.isEnabled = false
xLabel.text = "2X"
xLabel.textColor = UIColor.blue
} else {
errorLabel.text = "ERROR, NOT ENOUGH MONEY"
}
프로그래밍을 시작한 후 모든 의견을 환영합니다. 고맙습니다!
어떤 문제가 있습니까? –