Lunar Lander Python

Python version of my Lunar Lander implementation for the Fundamentals of Computing course


Project maintained by aayala4 Hosted on GitHub Pages — Theme by mattgraham

Project

This project is a translation of Alex Ayala's Lunar Lander project from Fundamentals of Computing. The original project was written in C++ and this project is written in Python 3 using Pygame Zero. The inspiration for this project came from a desire to translate Alex's old code into an updated Python version. Our end goal for this project was to have a working game with improvements from the old version. Some updates that we included were the addition of sound and updated fonts.

How to use

Installation

There are two ways to install the project. One is via a package and the next is via cloning the GitHub repository.

Package

The package has almost all of the necessary files to run the game. You need to have Python 3 and Pygame Zero installed. Next, you need to download the font pack to get the game to work. The instructions to do that are found in this readme. Feel free to view the official release as well.

Click here for the tar package.

Click here for the zip package.

Git Cloning

To install the project via Git Cloning, clone the GitHub repository. Make sure that you have the latest version of Python 3 and Pygame Zero installed. Next, you need to download the font pack to get the game to work. The instructions to do that are found in this readme.

Note

The old C++ files that our project is based off of can be found in the cppLander folder in our repository.

Running the Game

To run the program, double check that you have Python 3 and Pygame Zero installed. Our main python file is lunarLander.py. Next, simply run the command python3 lunarLander.py within the project directory from your command line such as (Terminal for MacOS, Bash for Ubuntu, etc.)

Screenshots

Below are screenshots from the game.

Title Page

Title Page

To play, use the arrow keys to control the ship as shown on the photo above. The other instructions are above in the title page.

Gameplay

Normal Gameplay

Here is what the screen will look like during normal gameplay.

Fuel

Out of Fuel

The rocket gets a certain amount of fuel per round. When the fuel expires, the game is done. The image above shows the screen when you run out of fuel.

Crash

Crash

If you land too fast or don't land with the ship in a vertical angle, you will crash the ship. You also lose 100 fuel units. You automatically get 5 points on a crash.

Hard Landing

Hard Landing

If you land with a vertical speed between -13 and -25 and a horizontal speed between -25 and 25, you will earn15*multiplierpoints. This is a hard landing.

Good Landing

Good Landing

If you land with a vertical speed between 0 and -12 and a horizontal speed between -25 and 25, you will earn50*multiplierpoints and 50 extra fuel units. This is a good landing.

Contribute

To contribute to this project, familiarize yourself with Lunar Lander, this version of the game, and Pygame Zero. If you have found an issue or want to add any features, create an issue within the issues tab of the GitHub repository. If you would like to contribute your code, make a pull request to the project to be reviewed by the project maintainers.