LightReader

Chapter 12 - Chapter 12: Enemies, Bullets, and Spawns

March 30th, 9:00 AM. "Enemy AI," Chris announced, pointing at the whiteboard. "Let's make something to shoot at."

Max, already deep in the Godot documentation, was reading about Path2D and PathFollow2D nodes. "I think we can make them move along predefined paths."

Tyrone designed a simple enemy sprite – a red, spiky blob (his artistic interpretation of a space alien).

They spent the morning experimenting with path-following. Max managed to get the enemy blob to move along a simple loop. Chris added a KinematicBody2D to the enemy, setting up collision detection.

The first attempt at player-enemy collision…didn't go well. The spaceship simply bounced off the blob.

"We need to damage the player," Chris said. "Or destroy the spaceship."

Max added a health variable to the spaceship and implemented a simple damage system. On collision, the spaceship's health decreased. When it reached zero… kaboom. (Tyrone insisted on a dramatic explosion animation).

By 9:00 PM, they had a red blob that moved and could destroy the spaceship (and a satisfying explosion to go with it).

"One step away from Pac-Man." Max jokes to them.

March 31st. Shooting mechanics. Max took the lead. He created a new scene for the projectile – a simple blue laser.

"We'll use instance() to create copies of this laser when the player shoots," he explained.

Chris connected the spacebar key to a function that created a new laser instance at the spaceship's position.

Tyrone added a shooting sound effect (a classic "pew pew").

The first few lasers…didn't go anywhere. They just sat there, stubbornly attached to the spaceship.

"Velocity!" Max exclaimed, snapping his fingers. "We need to give them velocity."

He added a script to the laser, setting its initial velocity based on the spaceship's facing direction. Now the lasers flew across the screen. Success!

By evening, the spaceship could shoot. Blue lasers zipped across the screen, ready to…well, they didn't hit anything yet.

"Now, to connect the laser and to Blob." Max smirk to Tyrone.

April 1st. Enemy spawning. Chris tackled this one. He created a Timer node.

"Every few seconds," he explained, "this timer will trigger a function that creates a new enemy."

He positioned the spawn point off-screen, so the enemies would appear to fly in.

Max connected the laser's collision to the enemy's health, making the blob explode (with a different, less dramatic explosion) when hit.

Tyrone added a simple score counter, increasing the score every time an enemy was destroyed.

The first few spawns…were a bit chaotic. Enemies appeared too frequently, overwhelming the spaceship.

"Whoa, slow down!" Tyrone shouted, frantically dodging a swarm of red blobs.

Chris adjusted the timer, spacing out the spawns. They tweaked the enemy speed, the laser damage, the player's health, trying to find a balance.

By 9:00 PM, they had a working, albeit basic, shoot 'em up. The spaceship could shoot, enemies spawned, and the score went up.

"We have a game loop!" Chris exclaimed, feeling a surge of accomplishment. He master the basic of timing and implementing and combining it to the project.

Max was already thinking about improvements. "Needs more enemy types. And power-ups. Definitely power-ups." He get how to make enemy AI work and implementing bullet damage system.

Tyrone, ever the artist, wanted more visual polish. "Better explosions. More detailed enemies. Maybe some particle effects." He is ready for a good art implementation in near future.

Three days, three milestones. They'd gone from a wobbling spaceship to a basic, but functional, shoot 'em up. The learning curve was steep, but they were climbing it, one line of code, one sprite, one explosion at a time.

More Chapters