def spinAnimation(pokeballs, locations, animationSpeed, enemyPokemon, targetSurf, teams, track, bkgImg, rotateTimes=4): global WINDOWWIDTH, WINDOWHEIGHT assets.ballSound.play() totalRotation = 360 * rotateTimes enemyPokemon.rect.center = (WINDOWWIDTH / 2, WINDOWHEIGHT / 2) for rotationStep in range(0, totalRotation, animationSpeed): checkForQuit() musicRepeat(track) newDim = None for event in pygame.event.get(): if event.type == VIDEORESIZE: newDim = event.size elif event.type == KEYUP: if event.key == K_ESCAPE: terminate() elif event.type == QUIT: terminate() if newDim: WINDOWWIDTH, WINDOWHEIGHT = newDim[0], newDim[1] DISPLAYSURF = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT), pygame.RESIZABLE, display=0) enemyPokemon.rect.center = (WINDOWWIDTH / 2, WINDOWHEIGHT / 2) offset = pokeBallTween(rotationStep / totalRotation) * 360 drawBackground(bkgImg, targetSurf) targetSurf.blit(enemyPokemon.surface, enemyPokemon.rect) enemyPokemon.drawHP(targetSurf, WINDOWWIDTH, WINDOWHEIGHT) for n in range(len(pokeballs)): location = assets.getTrigoFromCenter((locations[n] + offset), ballOffset, WINDOWWIDTH / 2, WINDOWHEIGHT / 2) pokeballs[n].rect.center = location targetSurf.blit(pokeballs[n].surface, pokeballs[n].rect) for team in teams: team.drawTeamLabel(targetSurf, WINDOWWIDTH) pygame.display.flip() FPSCLOCK.tick(FPS)
def drawFlashcards(flashList, targetSurf): global WINDOWWIDTH, WINDOWHEIGHT flashLocationList = [ assets.getTrigoFromCenter(0, flashOffset, WINDOWWIDTH / 2, WINDOWHEIGHT / 2), assets.getTrigoFromCenter(60, flashOffset, WINDOWWIDTH / 2, WINDOWHEIGHT / 2), assets.getTrigoFromCenter(120, flashOffset, WINDOWWIDTH / 2, WINDOWHEIGHT / 2), assets.getTrigoFromCenter(180, flashOffset, WINDOWWIDTH / 2, WINDOWHEIGHT / 2), assets.getTrigoFromCenter(240, flashOffset, WINDOWWIDTH / 2, WINDOWHEIGHT / 2), assets.getTrigoFromCenter(300, flashOffset, WINDOWWIDTH / 2, WINDOWHEIGHT / 2) ] for n in range(len(flashList)): current = flashList[n] currentRect = current.get_rect() currentRect.center = flashLocationList[n] targetSurf.blit(current, currentRect)
def drawPokeBallDefaultLocations(pokeballs, locations, targetSurf): for n in range(len(pokeballs)): current = pokeballs[n] current.rect.center = assets.getTrigoFromCenter( locations[n], ballOffset, WINDOWWIDTH / 2, WINDOWHEIGHT / 2) targetSurf.blit(current.surface, current.rect)
flashOffset = 280 locationAngles = [0, 60, 120, 180, 240, 300] quizPath = r'.\quiz' possibleUnits = ['U1', 'U2', 'U3', 'U4', 'U5', 'U6'] subSets = ['1', '2'] # tracks = ['johtoTrainerBattle', 'gymBattle', 'darkCave'] # track = random.choice(tracks) menuTrack = 'menu' teamTurn = 0 # bkgImg = assets.backgrounds['grass'] locations = [ assets.getTrigoFromCenter(0, ballOffset, WINDOWWIDTH / 2, WINDOWHEIGHT / 2), assets.getTrigoFromCenter(60, ballOffset, WINDOWWIDTH / 2, WINDOWHEIGHT / 2), assets.getTrigoFromCenter(120, ballOffset, WINDOWWIDTH / 2, WINDOWHEIGHT / 2), assets.getTrigoFromCenter(180, ballOffset, WINDOWWIDTH / 2, WINDOWHEIGHT / 2), assets.getTrigoFromCenter(240, ballOffset, WINDOWWIDTH / 2, WINDOWHEIGHT / 2), assets.getTrigoFromCenter(300, ballOffset, WINDOWWIDTH / 2, WINDOWHEIGHT / 2) ] def main(teams, initObjects, teamTurn, quizObject): global FPSCLOCK, WINDOWWIDTH, WINDOWHEIGHT