This site requires JavaScript, please enable it in your browser!
Greenfoot back
jeppe9756
jeppe9756 wrote ...

2021/11/4

MouseClicked(this) does not work

jeppe9756 jeppe9756

2021/11/4

#
When i press the object, it does not work, but if i press in the top left corner it works. I have a lot of different objects i want to move at the same time by the same mouseclick, but i can only get them to do it, if i use "null" instead of "this". This makes it impossible to have for instance a button next to, that does not click all the time. My code isnt anything complicated, but the mouseClicked statement just works in a weird way
danpost danpost

2021/11/4

#
jeppe9756 wrote...
the mouseClicked statement just works in a weird way
You probably have one or more objects that are over top of the button. When weirdness occurs, pause the scenario and right-click on the button to see what type actors are at that location. A possible fix is to add the following line to your world constructor:
setPaintOrder(Button.class);
You need to login to post a reply.