|
I am having a lot of trouble being able to solve the opacity challenge. In the code I currently have, the opacity is applied from the beginning (making spoilers of the result lol). I can't get the ternary conditional to happen after the user chooses the right option. Any help? Thank!!!
|
|
The ternary is working in terms of the opacity, however you need to reset the opacity in preparation for the next flag guess. I have used your code as the basis for this reply, so hopefully it is easier for you to understand the differences.
Also you don't need the double spacer, you can specify the minimum amount of spacing needed (to prevent items overlapping)
After resetting the game, you need to randomize the next flag selection in the new game.
Finally need to add
Hope this helps. |
|
It has worked and I have also been able to improve my code thanks to your suggestions. Thank you very much for your very complete answer! |
TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.