@sdktester15,
Thanks for asking this question.
The good news is , you do not have to modify anything, because SSK math2d already has functions for determining if a point is in from of a display object:
https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/math2D/#is-in-front
-- target is the point or another object -- observer is typically your player object -- ignore offsetAngle in this usage math2d.isInFront( target, observer [, offsetAngle] )
For example, if you wanted to see if an object at position < 100, 100 > was in front of ‘player’ you could do this:
-- Long hand example to show you how to build the 'target' point from \<x,y\> local x = 100 local y = 100 local point = { x = x, y = y } if( math2d.isInFront( point, player ) ) then end -- Compact version of call: math2d.isInFront( {x = x, y = y}, player )
The bad news is , I don’t think this is a great approach to finding a position in from of the player. Why? Because it sounds like you’re going to be generating random <x,y> values till you find one in front and that is time consuming. If however, you’re simply testing known positions (like from a list of asteroids), then this is fine.