You've already forked tiny-project
Changes
This commit is contained in:
45
plane_fighting/bullet.py
Normal file
45
plane_fighting/bullet.py
Normal file
@@ -0,0 +1,45 @@
|
||||
import pygame,os
|
||||
|
||||
abspath = os.getcwd() + "/"
|
||||
class Bullet1(pygame.sprite.Sprite):
|
||||
def __init__(self, position):
|
||||
pygame.sprite.Sprite.__init__(self)
|
||||
|
||||
self.image = pygame.image.load(abspath + "images/bullet1.png").convert_alpha()
|
||||
self.rect = self.image.get_rect()
|
||||
self.rect.left, self.rect.top = position
|
||||
self.speed = 11
|
||||
self.active = False
|
||||
self.mask = pygame.mask.from_surface(self.image)
|
||||
|
||||
def move(self):
|
||||
self.rect.top -= self.speed
|
||||
|
||||
if self.rect.top < 0:
|
||||
self.active = False
|
||||
|
||||
def reset(self, position):
|
||||
self.rect.left, self.rect.top = position
|
||||
self.active = True
|
||||
|
||||
class Bullet2(pygame.sprite.Sprite):
|
||||
def __init__(self, position):
|
||||
pygame.sprite.Sprite.__init__(self)
|
||||
|
||||
self.image = pygame.image.load(abspath + "images/bullet2.png").convert_alpha()
|
||||
self.rect = self.image.get_rect()
|
||||
self.rect.left, self.rect.top = position
|
||||
self.speed = 14#14
|
||||
self.active = False
|
||||
self.mask = pygame.mask.from_surface(self.image)
|
||||
|
||||
def move(self):
|
||||
self.rect.top -= self.speed
|
||||
|
||||
if self.rect.top < 0:
|
||||
self.active = False
|
||||
|
||||
def reset(self, position):
|
||||
self.rect.left, self.rect.top = position
|
||||
self.active = True
|
||||
|
Reference in New Issue
Block a user