View License

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

» Watch video

Highlights from
Matlab Space Invaders VideoGame

5.0 | 1 rating Rate this file 31 Downloads (last 30 days) File Size: 879 KB File ID: #39277 Version: 1.0
image thumbnail

Matlab Space Invaders VideoGame



A tribute to Space Invaders coded in Matlab. Just take fun and get ideas for more games.

| Watch this File

File Information

Version 0.1 (beta, so please, give feedback).

This is a game and also an example of how to read/use keypress
functionality from figures.

This is a tribute to Space invaders[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 move the spaceship and the spacebar to fire laser against the enemies.

 [1] Space Invaders, 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.

MATLAB release MATLAB 7.10 (R2010a)
Other requirements You don't need toolboxes to run the game, but need image adquisition toolbox to try some of the extra-code I provide to change game features like sprites.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
25 Mar 2013 Mingjing Zhang

Mingjing Zhang (view profile)

Very cool game with an authentic retro feel. However I do have two complaints about it:

1. it may be a better idea not to write the code for keyboard handling in KeypressFcn. Because that way you would experience a delay (~0.5 s) after the first keypress. Instead, set a variable to true in KeypressFcn and false in KeyreleaseFcn, and check the status of this variable in the main loop to determine whether this key is pressed or not;

2. The bullets travel too fast. They usually go right through an enemy without hitting it. Possible solutions are 1) slowing down the bullets (less distance per frame, slower apparent speed), or 2) not slowing down the bullets, but increasing the frame rate(less distance per frame, same apparent speed), or 3) using better collision detection algorithm (same distance per frame, same apparent speed).

Anyway, I do like this game. Please keep writing more stuffs like this!

Contact us