r/programming • • Dec 14 '19

Challenging projects every programmer should try

http://web.eecs.utk.edu/~azh/blog/challengingprojects.html
636 Upvotes

99 comments sorted by

View all comments

12

u/JuniperFags Dec 14 '19

SpaceInvaders <3

0

u/[deleted] Dec 14 '19

[deleted]

11

u/knome Dec 15 '19

Real time destruction, based on bullets, of the bases

make the invaders one color and the bases another. before drawing a bullet, check the pixel colors you'll be overwriting. all black? draw the bullet. invader color? figure out based on invader block offsets which one you hit. base color? change the collided pixels black.

when the invader offset from the top reaches a certain number, draw a black square over each base.

looking at video of the original arcade machine, it looks like they were alternating between showing the invader bullets and player bullets to allow more moving bullets at a time. so bullet collisions can't happen either

well, bullet collisions probably couldn't have happened because it was likely using a [hardware sprite engine](https://en.wikipedia.org/wiki/Sprite_(computer_graphics)) anyway