RIGHTto move the laser base (blue rectangle at bottom) left or right.
UP- to fire a laser beam at the income invaders.
- Classic Gaming / Space Invaders
- YouTube - SPACE INVADERS PART 2 ARCADE MAME VIDEO GAME TAITO 1979 invadpt2
Source code: (View on Github)
Notes / Learnings:
Animation of the invading ships
This is something I struggled to get right. I wanted to mimic the heartbeat style marching of the invaders across the screen as seen in the YouTube video.
So I turned to the
frameCount variable. I was using this variable to determine which row was moving, and using division and modulus together to determine the row.
frameCount variable of the current frame starts at
1. Which I would have seen if I closely read the reference docs for
This was fixed in this commit.
Also, I don’t like how I had to pre-calculate the
maxAllowedX values to detect when to turn around. I think there is a better way to go about this if I were to revisit it.
Some things I would do if I pick this back up:
- Implement the concept of being hit by incoming missiles and limit the number of ships you have as a player.
- Add sound (I haven’t worked to much with sound in Processing/p5.js yet).
- Implement scoring.
- Fix the issue that the invaders shoot missiles from any row / column.
- Add the Mystery Ship which hovers above the invaders.
- Explore Touch Screen interactivity to allow for playing on a smart phone / tablet.
- Implement levels, maybe exploring the p5js.SceneManager with increasing difficultly. There are some config parameters that control the difficulty, that would facilitate this: