useful websites

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Before Playstation, there was Pong, at one time the ultimate in video game entertainment. For those of you not familiar with this game please refer to the Wikipedia entry (http://en.wikipedia.org/wiki/Pong) and the many fine websites extolling the game and its virtues. Pong is not so very different in structure from the Billiard ball simulation that you developed earlier in the course. They both involve a ball moving and colliding with obstacles. The difference in this case is that two of the obstacles are under user control. The goal of this project is to develop your own version of Pong in MATLAB using the keyboard as input, for example, one player could move the left paddle up and down using the q and a keys while the right paddle is controlled with the p and l keys. You may check the code for the Lunarlander game which demonstrates some of the techniques you can use to capture user input. You will also probably find the plot, set, line and text commands useful in your program. You have used most of these before in the billiard simulation and you can use Matlabs online help to get more details on the many options these functions offer. Your program should allow you to play a game to 11 keeping track of score appropriately. The general structure of the code is outlined below in pseudo code While not done Update Ball State (position and velocity) taking into account collisions with walls and paddles Check for scoring and handle appropriately Update Display Note that in this case it is implicitly assumed that capturing the user input and moving the paddles is being handled with callback functions which removes that functionality from the main loop. For extra credit you could consider adding extra features like spin or gravity to the ball flight or providing a single player mode where the computer controls one of the paddles.
最新发布
05-30

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值