上传文件至 ''
This commit is contained in:
parent
2ce48c47f0
commit
561742fc61
|
@ -0,0 +1,14 @@
|
||||||
|
import pygame
|
||||||
|
|
||||||
|
class Ship: # 管理飞船的类
|
||||||
|
|
||||||
|
def __init__(self, ai_game): # 初始化飞船并设置其初始位置
|
||||||
|
self.screen = ai_game.screen
|
||||||
|
self.screen_rect = ai_game.screen.get_rect()
|
||||||
|
|
||||||
|
self.image = pygame.image.load('images/ship.bmp') # 加载飞船图像并获取其外接矩形
|
||||||
|
self.rect = self.image.get_rect()
|
||||||
|
self.rect.midbottom = self.screen_rect.midbottom # 对于每艘新飞船,都将其放在屏幕的中央
|
||||||
|
|
||||||
|
def blitme(self): # 在指定位置绘制飞船
|
||||||
|
self.screen.blit(self.image, self.rect)
|
Loading…
Reference in New Issue