Android [Solved] How to make object homing to different objects that are similar?

U

Uberpink

Guest
is it possible to have multiple similar objects ,and make the homing misile point and lock onto random of the similar objects?

like if u have 3 homing missiles and 5 targets.... the homing missiles choose random of those 5 to home to....

currently using this "one motion_add(point_direction...... but they all home to the same object
 

samspade

Member
The answer is yes. Without posting code, it's difficult to say exactly what is going on in yoru case, but it sounds like you are confusing objects and instances. It might be helpful to read the following:
I would (and actually did once for a mini-space dog-fight game) handle this situation using a with statement. Loop through all the possible targets, excluding yourself, ether looking to find the closest instance or perhaps compiling a list or array of instances and picking randomly from there. Examples of both are in the third link.
 
U

Uberpink

Guest
sorry hehe yep ofcourse instances:) i call them objects.... but yeah its instances im using

ahhhhh yes ofcourse, homing to the closest instance would work since rockets are spread all around and also the targets, but will check the links,, thanks:)
 
Top