Graphics Programs Reference
float dx, dy;
Matrix.translateM(enemiesMMatrix, 0, enemyOX,
dx = enemyX - enemyOX;
dy = enemyY - enemyOY;
Matrix.translateM(enemiesMMatrix, 0, dx, dy, 0);
Inside the while block, initialize a ( boolean ) flag renderEnemy as true . If
any missile collides with the current Enemy object, this flag will be set to false ,
and the current Enemy object won't be rendered.
Note We are iterating over Enemy objects inside an ArrayList ,
so, the “current Enemy object” refers to the Enemy object being
Next, you need to interpolate the source position of the current Enemy object. As
described in the previous section, while interpolating you also need to test if the cor-
responding Enemy object has entered the plane.
After interpolating the source position of the current Enemy object, start iterating
over the missiles. Create a local variable (of type Missile ) to reference the current
missile. Store the center of this missile by reading its interpolated source position.
Create another local variable difference , of type float . Inside this vari-
able, store the difference between the centers of (current) missile and enemy objects.