简体   繁体   English

Pygame:雪碧不会抽奖

[英]Pygame: Sprite won't draw

My issue is plain and simple: my sprite won't draw. 我的问题很简单:我的精灵不会画画。
Because there's too much files to all post here, I'll link you to the github page for the project: 由于此处要发布的文件太多,因此将您链接到该项目的github页面:
https://github.com/kahrkunne/Julia-Longina-Balbina-Error https://github.com/kahrkunne/Julia-Longina-Balbina-Error
The main file with the game loop is JLBE.py. 游戏循环的主要文件是JLBE.py。 The sprite is initialised at line 15 and then supposed to be drawn at line 45. 该精灵在第15行初始化,然后应该在第45行绘制。

You never set the x and y position of the sprite rect. 您永远不会设置精灵矩形的x和y位置。 You should use the passed variables to the Player class ( xcoord and ycoord ) to set the x and y variable of the Player.rect object. 您应该使用传递给Player类的变量( xcoordycoord )来设置Player.rect对象的x和y变量。

...
self.rect = self.image.get_rect()
self.rect.x = xcoord
self.rect.y = ycoord
...

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

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