The formula would be this normally
var __x = _xmouse - this._x ;
var __y = _ymouse - this._y ;
var angle = Math.atan2(__y, __x)
But this is not possible in scratch because of the lack of the atan2 function.
There is probably a way but I am not a math expert and am not sure how to replace the atan2.
If I were you I would just use the point to block.
Last edited by archmage (2009-05-14 19:26:32)
Offline
No you can't use what I posted. Scratch doesn't have a atan2 function.
Offline
keroro645 wrote:
How do you make it so that you can point towards a certain coordinate?
Like this:
http://i57.photobucket.com/albums/g228/BoltBait/PointAway.gif
(only, you'll have to modify this a bit. It is designed to point away from a sprite)
Where it says "X position of sprite2" use your X coordinate, etc.
Last edited by BoltBait (2009-05-14 19:51:45)
Offline
atan2 considers quadrants whereas atan does not.
If that doesn't make sense then let me put it this way, with atan you can get angles 0 to 90 with atan2 you can get every angle which is what you need.
Offline
have a invisible sprite that the guy can point to
Offline
archmage wrote:
atan2 considers quadrants whereas atan does not.
If that doesn't make sense then let me put it this way, with atan you can get angles 0 to 90 with atan2 you can get every angle which is what you need.
atan * 4 = atan2?
Last edited by frogger3140 (2010-03-31 14:48:26)
Offline
frogger3140 wrote:
archmage wrote:
atan2 considers quadrants whereas atan does not.
If that doesn't make sense then let me put it this way, with atan you can get angles 0 to 90 with atan2 you can get every angle which is what you need.atan * 4 = atan2?
DON'T. BUMP. OLD. THREADS.
It's been happening too much lately.
Offline
I realize this is an old thread, but for those of you wondering how to do it, use this:
Edit:
Wait nevermind.
There is a way better way to do it.
Uploading image now . . .
Edit2:
There far sleeker way uploaded.
Last edited by demosthenes (2010-03-31 15:07:34)
Offline