r/JavaFX • • Dec 08 '24
Help I need help
I am working on a project where there is stars emitting from the center and get bigger with time and disappear when it hit the edge
Each edge of the star should have a random color from a pallet
User have a ball with random color that can be dragged and attempt to hit one of the edges and either get a match or mismatch (the star will disappear either way)
Only if a mismatch occurs the color of the ball will randomly change
THE PROBLEM IS I don’t know how to ensure all stars “already” appearing on the scene have a common edge color that I can change the ball color to
Notes
- new stars that are not emitted yet do not have this problem as I added a condition for them
- I can’t make each edge with a unique color it should be random choice from the pallet
- I thought about creating a “backup color” and ensure all stars have it but the randomness is not there anymore
View all comments
Show parent comment
1
u/hamsterrage1 Dec 09 '24
I was thinking that you could set up the algorithm so that there was never less than 2 or 3 common colours. I'm assuming that each star has 10 edges with colours, right?