求飞机大战的代码
大哥们能麻烦把飞机大战代码发一下吗 https://fishc.com.cn/thread-64639-1-4.html 飞机大战2.0 | 欢迎大家来找bughttps://fishc.com.cn/thread-168455-1-1.html
(出处: 鱼C论坛)
https://fishc.com.cn/thread-64639-1-4.html
求最佳{:10_254:} import pygame
class MYPlane(pygaem.sprite.Sprite):
def _init_(self, bg_size):
pygame.sprite.Sprite._init_(self)
self.image1 = pygame.image.load("images/mel.png").convert_alpha()
self.image2 = pygame.image.load("images/me2.png").convert_alpha()
self.destroy_images = []
self.destroy_images.extend([\
pygame .image.load("me_destroy_1.png").convert_alpha(), \
pygame .image.load("me_destroy_2.png").convert_alpha(), \
pygame .image.load("me_destroy_3.png").convert_alpha(), \
pygame .image.load("me_destroy_4.png").convert_alpha() \
])
self.rect = self.image1.get_rect()
self.width,self.height = bg_sie,bg_size
self.rect.left,self.rect.top = \
(self.width - self.rect.width)//2,\
self.height - self.rect.height - 60
self.speed = 10
self.active = True
def moveup(self):
if self.rect.top > 0:
self.rect.top -= self.speed
else:
self.rect.top = 0
def moveDown(self):
if self.rect.bottom < self.height - 60:
self.rect.top += self.speed
else:
self.rect.bottom = self.height - 60
def moveLeft(self):
if self.rect.left > 0:
self.rect.left -= self.speed
else:
self.rect.left = 0
def moveRight(self):
if self.rect.right < self.width:
self.rect.left += self.speed
else:
self.rect.right = self.width
页:
[1]