def stopBattle(event): if event.ns == _SPACE.SF_BATTLE: PowerBar.battleEnd() Statistics.t = None Statistics.lastime = 0 Statistics.emo = None Statistics.cache = {}
def updatePowerBar(): if Statistics.okCw() and Statistics.myConf['powerbar_enable']: win_chance = Statistics.getWinChance() if win_chance: color = '#ff0000' if win_chance < 49: color = '#ff0000' elif win_chance >= 49 and win_chance <= 51: color = '#ffff00' elif win_chance > 51: color = '#00ff00' color = '\\c' + re.sub('[^A-Za-z0-9]+', '', color) + 'FF;' PowerBar.updateWinRate(win_chance*1.0/100,color+str(win_chance)+'%',Statistics.myConf)
def updatePowerBar(): if Statistics.okCw() and Statistics.myConf['powerbar_enable']: win_chance = Statistics.getWinChance() if win_chance: color = '#ff0000' if win_chance < 49: color = '#ff0000' elif win_chance >= 49 and win_chance <= 51: color = '#ffff00' elif win_chance > 51: color = '#00ff00' color = '\\c' + re.sub('[^A-Za-z0-9]+', '', color) + 'FF;' PowerBar.updateWinRate(win_chance * 1.0 / 100, color + str(win_chance) + '%', Statistics.myConf)
else: return True startup = True while startup == True: for event in pygame.event.get(): if event.type == pygame.MOUSEBUTTONDOWN: if mouseclick == 1: angle = 0 angle = Angle.SelectAngle() mouseclick = 2 print(angle) if mouseclick == 2: velocity = 0 velocity = PowerBar.SelectVel() print(velocity) startup = False #variable that tells the programe to run running = True #gravitational cosntant g = 1 #timestep dt = 1 inixvelocity = velocity * math.cos(angle) #calculates the vertical component of the speed iniyvelocity = -velocity * math.sin(angle) print(inixvelocity) print(iniyvelocity) #runs the programe forever
isArthur = True background = pygame.image.load(cwd + "/Images/street.png").convert() background = pygame.transform.scale(background, size) gameOver = pygame.image.load(cwd + "/Images/GameOver.png").convert() gameOver = pygame.transform.scale(gameOver, size) win = pygame.image.load(cwd + "/Images/YouWin.png").convert() win = pygame.transform.scale(win, size) player = Player.Player(50, 200, isArthur) xCur = 0 yCur = 0 healthText = Text.Text(str(player.getHealth()), size[0] - 50, 50) healthBar = PowerBar.PowerBar(75, 15, 50) globalTimer = 0 #Audio pygame.mixer.music.play() # -------- Main Program Loop ----------- while not done: # --- Main event loop playerAttack = False for event in pygame.event.get(): if event.type == pygame.QUIT: done = True elif event.type == pygame.KEYDOWN: