dimanche 11 juin 2023

How do I randomize 3 specific colors in a shape (circle) whenever I click the verify button?

I'm 3 months into coding and I'm working on a little and quick game for school while using Javascript. Bare with me If I'm can't grasp anything :(.

Here's the scenario: I have 6 circles, 3 on top (all black), 3 at the bottom (whenever I click each circle, it switches color between yellow, red and blue). To win the game, I have to pick different colors from the bottom circles so it matches the top circles when I click the button "Verify". As I click the button "Verify" the top 3 (black circles) will have to randomize colors between yellow, red and blue. I already figured out how to switch colors with onClick for the bottom circles. I just have no clue have to randomize 3 specific colors (yellow, red and blue) when I click the "Verify" button.

Please help :|.

I tried making an array but I got confused afterwards.




Aucun commentaire:

Enregistrer un commentaire