Using array's to animate shapes


I’m trying to achieve a number based game where specific numbers move across a screen in a straight line (like invaders) and the user has to match the numbers with a “cannon”. A new invader spawns behind the first invader once the previous one moves 100px from the right hand side of the screen and this continuously happens until one of the invaders reaches the cannon where the game stops. Every time a number is matched by the cannon, the matched invader is deleted.

The invaders and cannon are all shapes to form a digital looking number. I’ve written a function to retrieve the numbers and the format goes like: getNumber(x axis, y axis (height/4), number between 0-9).

I’m struggling however to figure out a way to retrieve a number from an array and store the x axis position of that particular invader. I’ve managed to successfully do one invader however I’m rather confused on how I would achieve multiple.

For reference, the game looks like the familiar numbers game on a Casio calculator which you can find here:

Thanks in advanced!

Hi munixed,

Can we see what you’ve got so far?