Code archives/Algorithms/Homing physics ( 2D )
Blitz3D Forums/Blitz3D Programming/Code archives/Algorithms/Homing physics ( 2D )
| ||
Ehhh... Maybe a stupid question but what does the lines, For ee.enemy=Each enemy If ee<>e dex#=(e\x-ee\x) dey#=(e\y-ee\y) do? ee isn't declared in the code?!?! |
| ||
Is it the old value of e? |
| ||
For ee.enemy=Each enemy If ee<>e dex#=(e\x-ee\x) dey#=(e\y-ee\y) do? ee isn't declared in the code?!?! It is -- look at the For ee... line. He's using ee.enemy to cycle through the list of enemies. It's being compared against the outer For e... loop to check each entry against all the others: ; Run through list of 'enemies' in this outer loop... For e.enemy = each enemy ; OK, inside that loop, we have another loop to check each list entry against the current 'e'... For ee.enemy = each enemy ; But if e = ee we're looking at the same entry, so ignore it... If e <> ee Blah () EndIf Next Next |
| ||
Ahhh... I understand... It's an internal loop, within the loop - just to check the values against all enemies... Thanks!!! |
| ||
You could Interpolate the position of the homing item by the coordinates of the two objects. |