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.
David Buckingham (2021). Dave's MATLAB Pong (https://www.mathworks.com/matlabcentral/fileexchange/31177-dave-s-matlab-pong), MATLAB Central File Exchange. Retrieved .
Inspired: Asteroids Matlab Version Game
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Create scripts with code, output, and formatted text in a single executable document.
Thanks for putting this together. Great work!
everything works well except the paddles will not move with player input sometimes after a while.
using r2018a
Wonderful code! And very well commented, indeed!
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
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).
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.
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.
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.
interesting