File Exchange

image thumbnail

Matlab Space Invaders VideoGame

version 1.0 (879 KB) by

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

18 Downloads

Updated

View License

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.

 References:
 [1] Space Invaders, Game,
     http://en.wikipedia.org/wiki/Space_Invaders

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.
 Email: leo_corte@yahoo.es

Comments and Ratings (1)

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!

MATLAB Release
MATLAB 7.10 (R2010a)

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

» Watch video