Rohan Balaji
Published © GPL3+

Space Invaders

A classic arcade game built using two TI microcontrollers.

IntermediateShowcase (no instructions)7 hours1,390
Space Invaders

Things used in this project

Hardware components

TM4C Microcontroller
Texas Instruments TM4C Microcontroller
×2
Breadboard (generic)
Breadboard (generic)
×2
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×2
Sitronix ST7735R 18-bit color 1.8" TFT LCD display
×1
Resistor 10k ohm
Resistor 10k ohm
×2
Resistor 1k ohm
Resistor 1k ohm
×7
Jumper wires (generic)
Jumper wires (generic)
×1
3.5 MM AUDIO JACK
×1
Low Profile Slide Potentiometer
×1

Software apps and online services

Arm KEIl IDE

Story

Read more

Code

Collision Detection

C/C++
A snippet of code used to detect collision between a missile and an enemy
for(l = 0; l<150; l++){
  for(m = 0; m<num_aliens; m++){
	  if(((Missile1[l].y -13) <  Enemy1[m].y)){
		 if(((Missile1[l].y-13) > (Enemy1[m].y -10))){
		  if((Missile1[l].x) > Enemy1[m].x & Missile1[l].x < (Enemy1[m].x + 16)){
			 if(Missile1[l].x != -1 & Missile1[l].y != -1 & Enemy1[m].x != -1 & Enemy1[m].y != -1){
				  DisableInterrupts();
					Missile1[l].x = -1;
					Missile1[l].y = -1;
					Enemy1[m].x = -1;
					Enemy1[m].y = -1;
				  player1.score++;
					ST7735_FillScreen(0x0000); 
					EnableInterrupts();
				  Timer1_Init(&Sound_Killed, 7256);
					}
				}
			}
		}
	}
}		

Github Repo for Main C Code

This repo includes one of the many files in the project. All header files have been removed to maintain the integrity of the embedded systems court taught at UT.

Credits

Rohan Balaji

Rohan Balaji

0 projects • 5 followers
Student at The University of Texas at Austin

Comments