Like the title says how do u calculate distance WITHOUT using the "distance to" block. I making a scrolling game so many blocks are useless and the distance to block is one of them. Any help is appreciated.
-thank you
Offline
set a to (sprite1X-sprite2X)
set b to (sprite1Y-sprite2Y)
set distance to (sqrt((a*a)+(b*b)))
There you go
Offline
archmage wrote:
set a to (sprite1X-sprite2X)
set b to (sprite1Y-sprite2Y)
set distance to (sqrt((a*a)+(b*b)))
There you go
^ ^ ^ ^
| | | |
Pythagorean theorum
Last edited by songhead95 (2009-10-15 16:47:01)
Offline
songhead95 wrote:
archmage wrote:
set a to (sprite1X-sprite2X)
set b to (sprite1Y-sprite2Y)
set distance to (sqrt((a*a)+(b*b)))
There you go^ ^ ^ ^
| | | |
Pythagorean theorum
Yeah, pretty much. As way to do it without the variables:
Set Distance to Sqrt ( (x2-x1)(x2-x1)+ (y2-y1)(y2-y1))
Offline