Jump to content




My minimap's offscreen points don't show up how I want


  • You cannot reply to this topic
1 reply to this topic

#1 LDDestroier

  • Members
  • 1,095 posts
  • LocationACDC Town

Posted 10 June 2015 - 04:00 PM

I made a gps minimap program, and it's really been the only thing I've been working on. The way it deals with off-screen waypoints is it draws it on the side it's gone past, but also at it's x position. Let me draw a diagram to explain.
Posted Image

I really need help with this little problem, as I've put it off too long...and don't have quite the skills to fix it myself.

Pastebin is at here: x9ajKSc0
Code:
Spoiler

Edited by LDDestroier, 10 June 2015 - 04:03 PM.


#2 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 10 June 2015 - 05:08 PM

Well, I haven't looked at your code at all, but the way you'd handle this is pretty simple.

First, make two equations for the line: one which gives you y, one that gives you x.
y = (px/py) * x
This is derived from y = mx + b, where we assume the first point is (0, 0) and b is 0.

Then, we can reverse this to get x from y:
x = (px/py) / y

Next, test max / min values of x / y to find a set of coordinates that appear on screen when added to the position on the map.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users