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, 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.
 Space Invaders, Game,
This function was written by :
B.Sc. in physics 2010
M.Sc. in Complex physics systems 2012
NPL (National Physical Laboratory), London,United kingdom.
Héctor Corte (2020). Matlab Space Invaders VideoGame (https://www.mathworks.com/matlabcentral/fileexchange/39277-matlab-space-invaders-videogame), MATLAB Central File Exchange. Retrieved .
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!