Trying to make The War Logo a button

Hello! Newbie here. I’m trying to make the logo a button that “refreshes” or makes the score and cards start from zero when Pressed. I’ve already gotten quite far on my own (in my terms) but I cannot figure out how to reset the scores to zero once Logo button is pressed. I have included a photo with my code. What I have written so far is that, Once logo is pressed, left and right image will go back to the “back” image. I also wrote code so that the number can turn back into “0” when logo is pressed, but when I press the deal button again, the scores go back to where they were before , they don’t start from zero. I hope this makes sense. If anyone can help, please let me know. I’m so proud of my progress so far but this issue has me stumped. Thanks so much I’m advance.

Well done! It does feel great to to achieve the coding process all on your own! Well done.

I can’t remember, but I expect there is a variable something like var leftScore = 0 .

So, try this.

leftScore = 0
rightScore = 0
leftScoreLabel.text = String("\(leftScore)")
rightScoreLabel.text = String("\(rightScore)")

You want to put the actual variable in there rather than a string.


1 Like

Wow that worked. Thank you so much for your kind words as well. I’m so glad I joined this community!
This was close to what I was trying to do before but I just wasn’t quite getting it. I really appreciate your time and help.

Welcome to the community @nabellie417

The intention is to be a friendly and supportive community.