Alien invaders

Consolidating the concepts of the two previous lessons, this game is a version of the classic 'Space invaders'. The code is used to create movie clips dynamically as the game runs, and to test for collisions between two arrays of clips. Action Script concepts include:

  • Duplicating movie clips dynamically
  • Use of ‘depth' to position movie clips within the layers of a Flash document
  • Using array methods to populate and de-populate arrays (push, splice)
  • Counting backwards through a FOR loop
  • Using the ‘length' property of an array as a condition in a loop
  • Using nested loops to detect collisions