TurtleYawns
Member
I'm pretty basic at GMS2 script and I'm trying to learn new stuff every day but I struggle to get my head around stuff I haven't dabbled with before at all and would like some help (please annotate what the code does if you post any as I may not understand its purpose or how to manipulate it, thank you).
So I am attempting for an instance to check nearby instances and to return the nearest that meets requirements, all of the instances in the code will be the same type of instance but will have different values to their variables. example:
obj_animal wants to form a list of all obj_animal that meet the following requirements:
var range = distance to other or var range > distance to other
var targetsize = other.size or > other.size
var targetthreat = other.threat or > other.threat
Then it will return the nearest object that meets those 3 criteria.
I imagine it will be either using a list, map or an array to store the instances but I don't know how to order them exactly and I'm sure there is probably a simple way of grouping all of these into a list that can be deleted once used.
So I am attempting for an instance to check nearby instances and to return the nearest that meets requirements, all of the instances in the code will be the same type of instance but will have different values to their variables. example:
obj_animal wants to form a list of all obj_animal that meet the following requirements:
var range = distance to other or var range > distance to other
var targetsize = other.size or > other.size
var targetthreat = other.threat or > other.threat
Then it will return the nearest object that meets those 3 criteria.
I imagine it will be either using a list, map or an array to store the instances but I don't know how to order them exactly and I'm sure there is probably a simple way of grouping all of these into a list that can be deleted once used.