We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Once the white ellipse reaches the green ellipse i would like to make a message come across the screen that says "Congratulations you won!", however, I have been looking at other references but I can't seem to find a way to have the game end with the white ellipse colliding with the green ellipse.
Answers
Add a boolean that tracks if you have won. Since you won't have won when the game starts, it should initially be set to false. When your green and white circles intersects, you have won, so set the boolean to true.
Now that you have a boolean that tracks if you have won, you can use it in conditional statements. For example, instead of drawing and simulating the entire game in draw(), you can now first check to see if you have won. If you have, then you can draw a screen that congratulates the player. If you haven't, draw the game and simulate it as before.
This is the same as your earlier problem with wall collisions. Remember how you needed to do something inside the 'if' statement that identified the collision? Again, find the place in your code that checks if the white and green balls are touching. Add the code there as per TfGuy44 's suggestion above.
@jeremydouglass the section in my code where the collision occurs between the green and white ellipse is also the same section where the white ellipse collides with the red barriers, do I need to change this if I want the game to only end when the white ellipse hits the green ellipse?
@TFGuy44 okay I see what you did in your code and I started to try and do this in my own code but I can't seem to come up with a conditional statement to use in my code in relation to the green and white ellipse. Could you possibly help me with this? I am very sorry for asking so many questions, I just don't have any coding experience and I just can't seem to figure this out. I can post what I have tried doing with my code so far.
When I start to add other "if" statements to my code, it causes error in my existing "if" statement
Look, your green ellipse is draw on line 74:
And your white ellipse is drawn on line 107:
Notice the parameters that you are using. These are the X position, Y position, and diameters of your two circles.
How can you tell if these two circles are touching? HINT: How far apart will they be?
What CONDITION must be met for them to be touching?
If that CONDITION is met, what ACTIONS should you do?