コード例 #1
0
ファイル: Tank.py プロジェクト: kubapok/tank-game
 def turnLeft(self):
     if not self.fuel:
         tankPrint("You don't have any fuel!")
         return
     self.direction = Tank.toLeft[self.direction]
     self.aim = Tank.toLeft[self.aim]
     self.lower = rot_center(self.lower, 90)
     self.upper = rot_center(self.upper, 90)
コード例 #2
0
ファイル: Tank.py プロジェクト: kubapok/tank-game
    def __init__(self,x,y, aim):
        self.image = pygame.image.load(os.path.join('Images','bullet.png')).convert_alpha()
        if aim == 'up':
            pass
        elif aim == 'right':
            self.image = rot_center(self.image, 270)
        elif aim == 'down':
            self.image = rot_center(self.image, 180)
        elif aim == 'left':
            self.image = rot_center(self.image, 90)
        else:
            assert False

        self.lifeTime = Bullet.existTime
        self.rect = self.image.get_rect()
        self.rect.x = x
        self.rect.y = y
        self.direction = aim

        Bullet.bullets.append(self)
コード例 #3
0
ファイル: Tank.py プロジェクト: kubapok/tank-game
 def towerRight(self): #it shuld be turret not tower, but I am too lazy to change now
     if not self.fuel:
         tankPrint("You don't have any fuel!")
         return
     self.aim = Tank.toRight[self.aim]
     self.upper = rot_center(self.upper, 270)