Line 25: Since the current bullet, in the array that's being looped through, is going to be referenced a number of times, it is assigned to the temporary variable 'b'.
Line 26: The top of the screen is 0 on the Y axis. When the whole of the bullet is outside of the screen we want to remove, so an IF statement is used to check to see if the bullet is above the point (-50 Y) at which it should be removed.
Line 28 - 30: If not (else) the bullet's MC is then removed from the stage and it's reference is removed from the array. Line 32: A variable is used for when we don't want to check if the bullet is hitting the asteroid. This will be when the asteroid has just been hit.
Line 33: b (the current bullet in the loop) is checked to see if it hits ob, which will be the the instance name given to the asteroid later on. It's been named 'ob' because we may want to use different objects, instead of an asteroid, later on.
Line 34: Now that the bullet has hit the asteroid, 'hit' is set to true, to stop it from being checked.
Line 35: If 'b' hits 'ob', the asteroid animation will play, where all four rocks move away.
Line 36 - 37: The bullet's MC is then removed from the stage and it's reference is removed from the array.
|