How do I use mousePressed/mouseClicked for this part? (image order game)

I’m just about done with this work, but I’m stuck on this part. the 4 images are shuffling as needed, but I need it to where the player clicks on the image in the correct order, and then the words “YOU WIN!” or “YOU LOSE” if the player clicks out of order, pops up. the order that the player always needs to click to win is image 01, image 02, image 03, and image 04. It’s a very easy and simple game. I just can’t figure out how to add this part of the game.

as I described use mousePressed, detect where the mouse has been pressed etc.

see Can someone help me with this game? (image order) - #5 by Chrisir

Solving a problem like this teaches you how to program.

Try to break down the problem into single steps and smaller parts.

Grab a sheet of paper and make notes what steps are necessary.

Now make notes what data you need and how this data is connected.

I tried if and else if to make it work, but I get more confused with the code and whats going on. I also looked up instructions on mousePressed() and tutorials, but I still don’t understand how to incorporate it into what I’m trying to do on this project. It’s my first time coding and it’s just getting more and more confusing…

So far the images are shuffling, but thats all I’m able to get it to do

1 Like