View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Moon Lander Matlab Game Example of getting keypressed

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

4.0 | 3 ratings Rate this file 29 Downloads (last 30 days) File Size: 11.6 KB File ID: #38927 Version: 1.3
image thumbnail

Moon Lander Matlab Game Example of getting keypressed


Héctor Corte (view profile)


06 Nov 2012 (Updated )

Lunar Lander game in Matlab, fully functional, and an example of how to get keypressed in figures.

| Watch this File

File Information

Version 0.3 (beta, so please, give feedback).
This is a game and also an example of how to read/use keypress functionality from figures.

it's a tribute to Moon Lander[1], without any lucrative pourpouse.

The game opens a figure with the spaceship that must land on the square
avoiding hitting the land.

Use the arrows to turn the spaceship and the spacebar to fire the engine.

[1] Lunar Lander, Game,

This function was written by :
Héctor Corte
B.Sc. in physics 2010
M.Sc. in Complex physics systems 2012
NPL (National Physical Laboratory), London,United kingdom.

Required Products MATLAB
MATLAB release MATLAB 7.10 (R2010a)
MATLAB Search Path
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
01 Oct 2016 Jay Janusz

I close matlab and redownloaded the file and now it works perfectly :)

30 Sep 2016 Jay Janusz

When run says:

Undefined function or variable 'spaceship'.

Error in Moon03 (line 52)


Is there something I need to add to the program for it to run properly/update matlab?

Comment only
23 Feb 2016 Aldo Tamariz B  
07 Nov 2012 Héctor Corte

Héctor Corte (view profile)

Thanks. I have fixed that and also the engine now don't stops when pushing another key.

Comment only
07 Nov 2012 christie harper

need to move intro() to after spaceship & terrain are initialized

09 Nov 2012 1.1

I fixed the problem with the intro. And now the engine stays on fire despite you push another keys at the same time of spacebar.

09 Nov 2012 1.2

Fixed the problem with the intro. And now the engine stays on fire despite you push other keys.

06 Apr 2015 1.3

This new version has better graphics and uses a class to handle the spaceship. It is now a better example for a game.

Contact us