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

2013/5/19

How to make a dart shoot out of my dart gun

arinb arinb

2013/5/19

#
I don't know how to make the dart's image shoot out to where the user's mouse click is... help please?
danpost danpost

2013/5/19

#
Does your dart gun always point toward the location of the mouse?
arinb arinb

2013/5/19

#
yes
arinb arinb

2013/5/19

#
well, i actually have the dart rotating at the mouse right now...
danpost danpost

2013/5/19

#
Then, if you use the 'move' method for the flight of the dart, you should come close to where the mouse was when the dart was fired. That is, provided that it moves at a fair rate of speed (the faster, the more accurate).
arinb arinb

2013/5/19

#
it is moving now, but it never reaches my mouse... it is just rotating around it at the moment...
danpost danpost

2013/5/19

#
Put a check in the Dart class, first determine its distance from where the mouse was clicked and set its location there if within one move of the location. If not that close, do the normal move (use an 'if-else').
You need to login to post a reply.