SRL Archive - OSR Help

Shorten the distance from where Iam to where I want to be


JuKKa

2012-03-30 04:34:10

How would I do this. I know it's with Sin, Cos and possibly Tan. But as I skipped most of those classes in school, I NEVER LEARNED IT! haha.
Now I need some help here.

This is on the minimap. I have 2 points. First point is MMCX, MMCY (Me where iam standing). Then I want to move the second point 5-10 pixels closer to me. :garfield:


:google:

Jordan155

2012-03-30 04:36:32

From: JuKKa
How would I do this. I know it's with Sin, Cos and possibly Tan. But as I skipped most of those classes in school, I NEVER LEARNED IT! haha.
Now I need some help here.

This is on the minimap. I have 2 points. First point is MMCX, MMCY (Me where iam standing). Then I want to move the second point 5-10 pixels closer to me. :garfield:


:google:


Hey, I am not really understanding the question you said:

"I want to move the second point 5-10 pixels closer to me"

You want to move 5-10 pixels closer to point MMCX, or literally move that location 5-10 pixels closer to you?

JuKKa

2012-03-30 04:39:33

1st point would be MMCX and MMCY.
2nd point would be something like a yellow dot anywhere on the minimap.

What i want to do is move the 2nd point closer to my first point

JuKKa

2012-03-30 05:19:13

NVM, I did this my self.


Function attractPoint(TP: TPoint): TPoint;
Var
DeltaX, DeltaY: Integer;
coeff: Extended;
Begin
DeltaX := MMCX - TP.X;
DeltaY := MMCY - TP.Y;
Coeff := 0.2;
Result := Point(Round(TP.X + coeff * deltaX), Round(TP.Y + coeff * deltaY));
End;