def getDamagePercentText(self, i): if self.cameraPlayer == 1: if i == 0: i = 1 else: i = 0 c = self.players[i] return textrect.render_textrect(c.getDamagePercentText(), DAMAGE_PERCENT_FONT, self.damagePercentRects[i], ALMOST_BLACK, BLACK, 1, True)
def createEndingText(self): tempText = ["is defeated", "is victorious", "retreats"] self.endingText = [] for i in range(2): sublist = [] p = self.players[i] for j in range(3): t = p.name + " " + tempText[j] image = textrect.render_textrect(t, COUNTDOWN_FONT, self.countdown.rect, COUNTDOWN_COLOR, ALMOST_BLACK, 1, True) sublist.append(image) self.endingText.append(sublist) sublist = [] t = "FINISH!" image = textrect.render_textrect(t, COUNTDOWN_FONT, self.countdown.rect, COUNTDOWN_COLOR, ALMOST_BLACK, 1, True) sublist.append(image) self.endingText.append(sublist)
def __init__(self, inChars, terrainLeft, terrainRight): super(Model, self).__init__() self.rect = Rect((0, 0), BATTLE_ARENA_SIZE) self.testBool = False self.testBool2 = False self.players = inChars for p in self.players: p.beginBattle() pos = (self.rect.centerx, self.rect.height - BATTLE_AREA_FLOOR_HEIGHT) self.players[0].setLoc(add_points(pos, ((-BATTLE_PLAYER_START_DISTANCE / 2), 0))) self.players[0].facingRight = True self.players[1].setLoc(add_points(pos, ((BATTLE_PLAYER_START_DISTANCE / 2), 0))) self.players[1].facingRight = False self.keys = [[False, False, False, False, False, False, False, False, False], [False, False, False, False, False, False, False, False, False]] self.keysNow = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]] self.frameByFrame = [0, 0] self.returnCode = [0, 0] self.projectiles = [] self.retreatProhibitTime = boundint.BoundInt(0, RETREAT_PROHIBIT_TIME, RETREAT_PROHIBIT_TIME) self.retreatPhase = 0 self.cameraPlayer = 0 self.netPlayer = 0 self.catBar = None self.createBars() self.resetHitMemory() self.endingVal = -1 self.endingValTick = 0 self.fx = [] self.platforms = getPlatforms(terrainLeft, terrainRight) self.countdown = countdown.Countdown(BATTLE_COUNTDOWN_LENGTH) self.createEndingText() self.damageTagRects = [] self.damagePercentRects = [] for i in range(2): rect = Rect((0, 0), (80, 100)) if (i == 0): rect.left = 0 else: rect.right = SCREEN_SIZE[0] rect.top = SCREEN_SIZE[1] - 55 self.damageTagRects.append(rect) rect2 = Rect((0, 0), (80, 100)) if (i == 0): rect2.left = 0 else: rect2.right = SCREEN_SIZE[0] rect2.top = rect.top + 18 self.damagePercentRects.append(rect2) self.damageTag = textrect.render_textrect("Strength", STRUCTURE_COUNT_FONT, self.damageTagRects[0], ALMOST_BLACK, BLACK, 1, True)
def __init__(self, inChars, terrainLeft, terrainRight): super(Model, self).__init__() self.rect = Rect((0, 0), BATTLE_ARENA_SIZE) self.testBool = False self.testBool2 = False self.players = inChars for p in self.players: p.beginBattle() pos = (self.rect.centerx, self.rect.height - BATTLE_AREA_FLOOR_HEIGHT) self.players[0].setLoc( add_points(pos, ((-BATTLE_PLAYER_START_DISTANCE / 2), 0))) self.players[0].facingRight = True self.players[1].setLoc( add_points(pos, ((BATTLE_PLAYER_START_DISTANCE / 2), 0))) self.players[1].facingRight = False self.keys = [[ False, False, False, False, False, False, False, False, False ], [False, False, False, False, False, False, False, False, False]] self.keysNow = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]] self.frameByFrame = [0, 0] self.returnCode = [0, 0] self.projectiles = [] self.retreatProhibitTime = boundint.BoundInt(0, RETREAT_PROHIBIT_TIME, RETREAT_PROHIBIT_TIME) self.retreatPhase = 0 self.cameraPlayer = 0 self.netPlayer = 0 self.catBar = None self.createBars() self.resetHitMemory() self.endingVal = -1 self.endingValTick = 0 self.fx = [] self.platforms = getPlatforms(terrainLeft, terrainRight) self.countdown = countdown.Countdown(BATTLE_COUNTDOWN_LENGTH) self.createEndingText() self.damageTagRects = [] self.damagePercentRects = [] for i in range(2): rect = Rect((0, 0), (80, 100)) if (i == 0): rect.left = 0 else: rect.right = SCREEN_SIZE[0] rect.top = SCREEN_SIZE[1] - 55 self.damageTagRects.append(rect) rect2 = Rect((0, 0), (80, 100)) if (i == 0): rect2.left = 0 else: rect2.right = SCREEN_SIZE[0] rect2.top = rect.top + 18 self.damagePercentRects.append(rect2) self.damageTag = textrect.render_textrect("Strength", STRUCTURE_COUNT_FONT, self.damageTagRects[0], ALMOST_BLACK, BLACK, 1, True)