编码的泥泞路对于我这个学习能力不是很强的真的不是很好走,一步一个坑...QAQ
这一次我又不能发子弹了,对着随书源代码(我的其他博客有介绍下载随书的成品源文件)排了一遍错误,发现是因为语句顺序错了!
错误:
正确:
错误分析:
【pygame.display.
flip
() :
Update the full display Surface to the screen
flip() -> None
This will update the contents of the entire display. If your display mode is using the flags pygame.HWSURFACE
and pygame.DOUBLEBUF
, this will wait for a vertical retrace and swap the surfaces. If you are using a different type of display mode, it will simply update the entire contents of the surface.
When using an pygame.OPENGL
display mode this will perform a gl buffer swap.】
(以上来源于pygame documentation:http://www.pygame.org/docs/index.html)
即,它是把整个屏幕给更新了
如果我把他放在bullet的上面,那么就看不到更新的bullet了
总结:语句顺序会导致错误,治本的办法是搞清楚语句的含义(不是要求背诵,而是看到语句关联上一个运行状态)
总是会遇到各种各样的错误...解决它,然后就能进步了
学习的时候最好跟着教程做,在教程的基础上进行小幅度改动并及时写反馈,不然错误一个加一个真的会崩溃!(我已经成了个照着敲的Ctrl-C&V了2333,然而还是不断地遇到错误!)
peace & love