I am doing a project for my computer Science class and I am having some serious trouble with it. I am trying to make it so that I can launch ellipses. Basically you click on the circle you want to launch then drag back, when the mouse is released the circle will launch forward. It is similar to the game called knockout on game pigeon.
1 Like
Show your code
How did you get?
Sorry I don’t have my code on me right now because I am in the car. Also I already got rid of my previous launch circles code because it didn’t work
We can’t do this for you…
1 Like
but grab a pen and paper and make a plan
You need a plan to be successful.
My plan would be:
-
make setup and draw
-
draw launch ellipse
-
have a mousePressed that checks when the mouse has pressed on the ellipse. Set a boolean
hold
to true -
during hold is true, draw a 2nd ellipse or symbol at mouseX,mouseY to see how far we drag the symbol (make a line between the 2 ellipses)
-
on mouseReleased set hold to false and set a boolean isLaunched to true
-
in draw() when isLaunched is true, launch.
2 Likes
Thanks your plan was really helpful
1 Like