Cyber Invaders: Space Grid · Step 3 of 4
Alien Grid Invasion & AABB Collisions
In Step 3, generate a marching grid of cyber alien invaders across rows and columns. Implement AABB bounding box collision math between your laser projectiles and the alien armada!
What you will learn
- Alien Fleet Grid Generation: Iterate rows and columns (e.g. 3 rows x 6 columns) to spawn structured alien squadrons.
- Laser AABB Collision Check: Evaluate if a laser intersects an alien: laser.x < alien.x + alien.w && laser.x + laser.w > alien.x && laser.y < alien.y + alien.h && laser.y + laser.h > alien.y.
Open this interactive lesson · Browse all lessons
In the editor, complete the marked TODOs. Use Stuck on a TODO? to reveal hints or a worked example, then run the lesson checks.