Python Exploration #5

This week Jordan showed us how to set up the enemies in the game. The aliens move as a fleet, which needs to be defined before it is created. The fleet uses an edge detection function to determine when they have hit either edge of the screen so they can start moving in the opposite direction. The fleet is then spread across the screen - 2 alien widths across. The number of rows is similarly determined by the current screen height.

The player wins when all the aliens have been shot. The game then restarts with a faster fleet of aliens and larger bullets. The player loses when an alien makes contact with an alien, or an alien makes contact with the bottom of the screen. The game then pauses for an amount of time determined by a sleep function. After the sleep ends, the player gets another opportunity to play the same level again. Once the players loses 3 times the game is over.

Previous
Previous

Codewars Part 3

Next
Next

Outsystems Web Developer Specialization