def __init__(self): Tank.__init__(self) self.sensors = [Sensor(-45, 90, 75, False), Sensor(45, 90, 75, False), Sensor(0, 10, 50, True)] self.clockwise = random.random() < 0.5 self.tread_accel = 120 self.tread_max = 120
def __init__(self, coords, direction, phoenix, image=None, enemy=None): self.player = pygame.image.load(image).convert_alpha() self.player = pygame.transform.scale( self.player, (PART_SIZE, PART_SIZE)) self.direction = direction self.screen = pygame.display.set_mode(SCREEN_SIZE) self.phoenix = phoenix self.enemy = enemy Tank.__init__(self, coords, self.direction, self.phoenix, self.enemy)
def __init__(self): Tank.__init__(self, TYPE, POSITION, WIDTH, HEIGTH, PRIORITY, SPEED, HEALTH, MAX_BULLETS, STRENGHT) self.score = 0 self.shot_speed = 5 self.lives = LIVES self.bonus = None self.level = 0 self.freeze_timer = 0
def __init__(self): Tank.__init__(self) self.sensors = [Sensor(0, 45, 90, True)] #speed = int((0.5 - random.random())*500) self.speed = 500 print(self.speed) self.set_speed('l', self.speed) self.set_speed('r', self.speed)
def __init__(self, tank_img, point=None): #目标坦克坐标,目标boos坐标 if not point: point = (random.uniform(0, 960), 0) Tank.__init__(self, tank_img, point=point) self.state = 'notfind' # 是否发现目标 self.speed = 2.0 self.last_move_time = 0 self.name = 'ai' self.distance = 150.0 self.range = 40.0
def __init__(self): Tank.__init__(self) self.sensors = [Sensor(0, 90, 75, False), Sensor(180, 90, 75, False)] self.clockwise = True self.forward = 1 r = 200 g = 50 b = 50 self.primary_color = '#{:02X}{:02X}{:02X}'.format(r, g, b) r = 10 g = 10 b = 10 self.secondary_color = '#{:02X}{:02X}{:02X}'.format(r, g, b)
def __init__(self, level, isBonus=False): level = str(level) Tank.__init__(self, 'TANK', QPoint(0, 0), WEIGHT, HEIGHT, 1, TANKS[level]['SPEED'], TANKS[level]['HP'], TANKS[level]['MAX'], 1) self.isBonus = isBonus self.timer_move = 60 self.shot_speed = TANKS[level]['SHOT_SPEED'] self.change_pixmap(TANKS[level]['IMG']) self.type_tank = TANKS[level]['IMG'] if self.type_tank == 'ARMOR_TANK': self.change_pixmap(self.type_tank + str(self.health)) if isBonus: self.set_pixmap_red() self.value = TANKS[level]['VALUE'] self.movement_status = 'STOP' self.isBreak = False self.chance_shoot = 0.95 if level == '5': self.isBreak = True if level == '4': self.chance_shoot = 0.99
def __init__(self): Tank.__init__(self) self.sensors = [Sensor(0, 90, 75, False), Sensor(90, 90, 75, False),Sensor(180, 90, 75, False),Sensor(270, 90, 75, False)] self.clockwise = random.random() < 0.5
def __init__(self): Tank.__init__(self) self.sensors = [Sensor(0, 10, 60, True), Sensor(0, 120, 100, False), Sensor(120, 120, 100, False), Sensor(240, 120, 100, False)]
def __init__(self): Tank.__init__(self) self.sensors = [Sensor(0, 180, 75, False), Sensor(0, 180, 50, False), Sensor(0, 180, 25, False)] #, Sensor(0, 10, 50, True)] self.clockwise = random.random() < 0.5
def __init__(self): Tank.__init__(self) self.sensors = [Sensor(0, 90, 50, False), Sensor(0, 5, 400, True)] self.clockwise = random.random() < 0.5
def __init__(self): Tank.__init__(self) self.sensors = [Sensor(30, 60, 150, True), Sensor(-30, 60, 150, True), Sensor(0, 10, 50, True)] self.clockwise = True # random.random() < 0.5