python在项目中遇到的问题(2)pygame的遇到一些函数

这一系列比较杂,真是遇到什么写什么,等自己有时间再好好整理整理

pygame.Surface.blit():draw one image onto another

用法

blit(source,position,area=None,specical_flag=0)
Draws a source image onto this Surface. The draw can be positioned with the destination ( pygame.Rect 对象) argument.

例子

self.screen.blit(img, pygame.Rect(0,0,60,60).topleft)
这里第一个参数是图像,这里图像是通过img=pygame.image.load(“images/big.png”).convert_alpha()方法加载
第二个参数位置,这里是pygame.Rect()对象,pygame.Rect()对象接受四个参数,前两个参数分别是左上角坐标位置,后两个参数是这个矩形的长和宽。

猜你喜欢

转载自blog.csdn.net/tinpo_123/article/details/80281996
今日推荐