I have three different objects (dublicates): "robot", "missile" and "direction missile". They are all differentiated by their Alterable Value A and T. When "robot" with AV A=1 shoots a missile at "robot" AV A=4, the "missile" and the "direction missile" have AV A=1 and AV T=4.
Problem (1): "direction missile" shall always look at the "robot" it was shot at, means "direction missile" AV T=4 shall look at "robot" AV A=4.
When a new instance of "direction missile" is created, the old one stops looking at the robot.
Problem (2): When "missile" is colliding with any object, the "missile" and the "direction missile" with same AV A shall be destroyed
Sometimes ALL "direction missile" are destroyed.
I think the main problem is, that I dont know how to compare EVERY instance ob "object1" with EVERY instance of "object2".
With
+ Alterable Value A "object1" = Alterable Value A "object2"
- ...
I compare all instances of "object1" only with the newest of "object2" (but I need to compare with ALL instances of "object2").
So, changing the event to
+ Alterable Value A "object2" = Alterable Value A "object1"
- ...
Please give a more detailed description, or post a source file, and name your alterable values.
If you say *exactly* what you're trying to do, I could probably make an example file for you.
1.) You haven't described how you're assigning targets, so I'm going to assume it's by clicking - if not, you'll have to say.
+ Player clicks on "Robot"
-> Create "Direction Missile"
-> Direction Missile: Set "Target" to Fixed Value of "Robot"
+ Fixed Value of "Robot" = Target("Direction Missile")
-> Direction Missile: Set angle to ATan2(Y("Direction Missile) - Y("Robot"), X("Robot") - X("Direction Missile"))
2.) What's the difference between a "Missile" and "Direction Missile"?
Do they both have other alterable values? (apart from A and T)
Chances are, it doesn't matter which "direction missile" is destroyed, as long as there are always the same number of each. You could probably just say:
+ "Missile" collides with...
+ Pick "Direction Missile" at random
-> Destroy "Missile"
-> Destroy "Direction Missile"
Heres a link to the game so far. For really testing it, u need at least two computers because it is a LAN game... But maybe u can figure out whats wrong, just with the source file...
The problems are in "Rakete" and "Kollisionen" in the first "Multiplayer" frame (its better for testing).
To see, how the missiles act, start the game, host a game, right click, point the cursor over the appearing mech, mouse wheel up till in the left upper corner is a "2" and left click.
Uploaded the working example, just for the ones interested in it... (its german, but u will figure out whats new. its the only fastloop in it and the first one i ever used )