简体   繁体   English

Pygame - 如何更快地对图像进行 blit

[英]Pygame - How to blit an image quicker

Typing out screen.blit(surface,(posx,posy)) over and over again for my games is very annoying.为我的游戏一遍screen.blit(surface,(posx,posy))输入screen.blit(surface,(posx,posy))非常烦人。 Is there a quicker way to do this?!有没有更快的方法来做到这一点?!

Using a function can make it a lot shorter, for example例如,使用函数可以使它变得更短

def blit(img,x,y):
   screen.blit(img, (round(x),round(y)))

To call it you would use something like: blit(mypicture,324,532)要调用它,您可以使用以下内容: blit(mypicture,324,532)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM