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

2021/6/3

Is there any way to simulate a mouse click?

lary_ lary_

2021/6/3

#
I want to simulate a mouse click on an actor when I first enter in a new world. Is there any way to do that?
Gbasire Gbasire

2021/6/3

#
what do you exactly mean by that ?
lary_ lary_

2021/6/3

#
Gbasire wrote...
what do you exactly mean by that ?
When I change to a new world, I want the game to automatically click on an actor by simulating this, not the player clicking on that actor :/ it's hard to explain
Gbasire Gbasire

2021/6/3

#
Are you sure you can't just make so that when the world is loaded, the actor does a specific thing at some point ?
RcCookie RcCookie

2021/6/3

#
Emulating mouse clicks and actually moving the mouse around is possible. However this will not work online, and it is, like Gbasire mentioned, most certainly not the ideal solution. Furthermore, the mouse coordinates are fixed to the screen, not to the scenario, so you first had to get the current window position and size, or move the window. If however you still want to experiment with it, take a look at java.jo.Robot.
lary_ lary_

2021/6/4

#
Got it! I just wanted to know if I could do that in Greenfoot because in Unity, for exemple, there's a function to do that. Anyways, I solved the problem by following what you guys suggested. Thanks :)
You need to login to post a reply.