Well since i really suck in math and i have a problem..
I have a coordinate which is inside MMX1, MMY1, MMX2, MMY2 and i want to move that coordinate 5 - 10 pixels towards MMCX, MMCY.
Now please gimme some code :P
Well since i really suck in math and i have a problem..
I have a coordinate which is inside MMX1, MMY1, MMX2, MMY2 and i want to move that coordinate 5 - 10 pixels towards MMCX, MMCY.
Now please gimme some code :P
Code:
- Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
- Solarwind: Dude, you are like... t3h s3x.
- Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
- benjaa: woah.... Jukka is the man Guildminer pwns all
- NaumanAkhlaQ: And JuKKa Is my Her0!
SCAR Code:Procedure GetCloser(Var Point: TPoint; Origin: TPoint; HowMuchCloser: Integer);
Var
Angle, Dist: Integer;
Begin
Angle := Round(Degrees(ArcTan2(Origin.y - Point.y, Origin.x - Point.x))) - 90;
If Angle < 0 Then
Angle := Angle + 360;
Dist := Distance(Point.x, Point.y, Origin.x, Origin.y) - HowMuchCloser;
Point.x := Origin.x + Round(Dist * Cos(Radians(Angle - 90)));
Point.y := Origin.y + Round(Dist * Sin(Radians(Angle - 90)));
End;
Stupid leecherYou've been glancing at the thread for like half an hour without saying thank you
@Math people: Don't complain about the "-90", I've thinked, tested and it's worked.
Look - and example:
ArcTan2 would return me a -90 for example. -90 points to west, then we make it -180, and add 360, voila, it's to south as supposed to.
yeah i just noticed.. i dont need that anymore xP i found a easier way to do the thing i wanted ... a secret for now.
Code:
- Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
- Solarwind: Dude, you are like... t3h s3x.
- Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
- benjaa: woah.... Jukka is the man Guildminer pwns all
- NaumanAkhlaQ: And JuKKa Is my Her0!
There are currently 1 users browsing this thread. (0 members and 1 guests)