Can you have multiple instances of the same sprite

Hello, I am experienced with other game engines and trying to figure out arcade. I am trying to develop the classic Space Invaders with my class. I want to have a row of invaders moving back and forth on the screen. Is there an inherit way of creating multiple instances of the same sprite, say myLargeInvader. In my example, only one of the invaders is handled in the ON GAME UPDATE.

Other engines know to apply code to all instances of myLargeInvader…curious, if and how arcade manages this?

If you give them a unique kind (in this case, Enemy), you can get an array of all of them and apply the action to each of them in a loop in your game update:

array of sprites of kind is currently in the arrays category.

Like @jwunderl said…

Thanks, that is helpful insight into this engine. The array is nice so I can redirect the entire row to change course.

1 Like

Thanks again for the help. Here is a complete version with the following features:

  1. 3 rows of invaders move back and forth
  2. Base ship can only fire once per second
  3. The invaders speed up as the number of invaders decrease
  4. If the invaders get low enough to collide with base, game over
  5. If you destroy all invaders, game over with a win

Plenty of concepts to teach students. Will start recording the lessons now. A challenge for students will be to have the Invaders fire randomly downward, but never more than two invaders shots on the screen at once.

3 Likes

Awesome! If you record some lessons (and don’t mind making them public) please post them in the forum! We love to have more content to point people too.

Will do

very useful - much to learn here!