import pygame
class Ship():
def __init__(self,screen):
self.screen=screen
self.image=pygame.image.load('images/ship.bmp')
self.rect=self.image.get_rect()
self.screen_rect=screen.get_rect()
self.rect.centerx=self.screen_rect.centerx
self.rect.bottom=self.screen_rect.bottom
self.moving_right=False
self.moving_left=False
def update(self):
if self.moving_right:
self.rect.centerx +=1
if self.moving_left:
self.rect.centerx -=1
def blitme(self):
self.screen.blit(self.image,self.rect)
在從入門到實踐中的外星人游戲中為什么我的飛船一直點滑鼠動不了,代碼都沒有問題我是照著打的檢查了好幾遍只有load那兒顯示找不到參考load中的image.py 可是螢屏中有飛船但是運行代碼飛船動不了。
uj5u.com熱心網友回復:
如果需要看其他模塊可以說一下,內容太多了。是個新手請大家解答uj5u.com熱心網友回復:
把你呼叫updata的代碼模塊發上來轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/150384.html
上一篇:請教,python爬蟲問題
下一篇:迷宮問題
