4.5
4.5 | 4 ratings Rate this file 19 Downloads (last 30 days) File Size: 6.03 KB File ID: #31177 Version: 1.3
image thumbnail

Dave's MATLAB Pong

by

 

24 Apr 2011 (Updated )

a fast-paced two-player game

| Watch this File

File Information
Description

I tried to make my code as neat and understandable as possible. Lots of comments explain how everything works. Program is broken down into several understandable subroutines. There are (almost?) no "magic numbers", all values are clearly defined and explained at the beginning. This makes it very easy to modify things like colors, speeds, layout, physical behavior. Please post any suggestions or requests, I'd appreciate ideas for how to improve this program.

Acknowledgements

This file inspired Asteroids Matlab Version Game.

MATLAB release MATLAB 7.11 (R2010b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (7)
10 May 2015 brian grove

I can't figure out why the bounce function works. Why does the vector/(v(1)^2+v(2)^2) "bounce" the ball correctly? I can't find any formulas that make this true

Comment only
03 Mar 2012 nsbd

nsbd (view profile)

 
31 Dec 2011 Nhan Nguyen

hey, I just have a small knowledge about matlab (just enough to calculate and plot some shape) but base on your game, i have made a fund game. Link: http://www.mediafire.com/?f7jg9wf3amt3db7. Enjoy.
Control the green rectangle (a plane) by pressing left or right arrow. Press 's' to shoot a bomb (a small circle in the plane).

25 May 2011 David Buckingham

There certainly can be improvements. The game speed is controlled by a call to pause() with a fixed delay argument on line 336. Although imprecise, the resulting frame-rate is quite independent of the number of keys pressed.

Comment only
25 May 2011 David Buckingham

There certainly can be improvements. The game speed is controlled by a call to pause() with a fixed delay argument on line 335. Although imprecise, the resulting frame-rate is quite independent of the number of keys pressed.

Comment only
21 May 2011 Suleman Shafqat

Suleman Shafqat (view profile)

Great job. well commented, i must say U ROCK.
but there can be improvements, the logic might have been better if u have used timerfcn, with some fixed period, in that case the speed of game would have been independent of number of keys pressed by the user in each iteration. i hope u will not mind the suggestion.

26 Apr 2011 Joachim

interesting

Updates
25 Apr 2011 1.1

changed tags. changed description

26 Apr 2011 1.3

new release of program includes several minor updates, not enough space here but they're listed at the top of the code. also wrote a more thorough description, updated tags, and updated the picture to reflect the program's new look.

Contact us