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

2013/12/1

How to follow mouse?

JasonZhu JasonZhu

2013/12/1

#
I am making a game where the player shoots arrows. I came into realization that I don't know how to make it so that the arrow is shot where ever my mouse is in the game window... I have never did anything with the mouse before. Anyone know how it's done?
danpost danpost

2013/12/1

#
The Greenfoot class has a 'getMouseInfo' method. Check out the documentation on the MouseInfo class for what methods you might want to use from there. Just be aware that 'getMouseInfo' could return 'null'.
JasonZhu JasonZhu

2013/12/1

#
There doesn't happen to be a return coordinate method for the mouse...
danpost danpost

2013/12/1

#
Did you look at the methods in the MouseInfo class? They are there.
JasonZhu JasonZhu

2013/12/1

#
I looked. Is there something I'm not seeing?
erdelf erdelf

2013/12/1

#
u can return the coordinates with the methods getX() and getY() of the MouseInfo class
JasonZhu JasonZhu

2013/12/1

#
Righty, thanks
danpost danpost

2013/12/1

#
There are only like 5 or 6 methods within the class. I do not see how you could miss the two you are referring to.
You need to login to post a reply.