Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame, sys, os, random, shelve, time, sipack
- from pygame.locals import *
- pygame.init()
- def Timer():
- s = 0
- while s<=60:
- time.sleep(1)
- s+=1
- print(s)
- def quitGame():
- pygame.quit()
- sys.exit()
- def main():
- background_image = pygame.image.load("invoker.png")
- #os.environ['SDL_VIDEO_CENTERED'] = '1'
- WIN_WIDTH, WIN_HEIGHT = 1440, 885
- canvas = pygame.display.set_mode((WIN_WIDTH, WIN_HEIGHT), pygame.FULLSCREEN)
- pygame.display.set_caption("Invoker Game!")
- canvas.blit(background_image, [0,0])
- # Game states
- GAMESTATE_MAINMENU = 0
- GAMESTATE_INGAME = 1
- GAMESTATE_TUTORIAL = 2
- GAMESTATE_OPTIONS = 3
- GAMESTATE_CREDITS = 4
- GAMESTATE_END = 5
- gameState = GAMESTATE_MAINMENU
- # Define the colors in RGB format
- BLACK = pygame.Color(0,0,0)
- WHITE = pygame.Color(255,255,255)
- QUAS = pygame.Color(93,188,210)
- WEX = pygame.Color(255,0,254)
- EXORT = pygame.Color(254,75,0)
- color1 = WHITE
- color2 = WHITE
- color3 = WHITE
- spell = random.randint(1,10)
- spellText =""
- MENUCLICKEDEVENT = USEREVENT + 1 #??
- SHOWSCOREEVENT = USEREVENT + 2
- gameMenu = ("Start Game" ,
- "Tutorial",
- "Quit")
- fontSize = 36
- fontSpace = 4
- font = pygame.font.Font(None, fontSize)
- fontHue = pygame.font.Font(None, fontSize + 30)
- correctSpell = 0
- #Image
- coldSnapImage = pygame.image.load("img_cold_snap.png").convert()
- ghostWalkImage = pygame.image.load("img_ghost_walk.png").convert()
- iceWallImage = pygame.image.load("img_ice_wall.png").convert()
- tornadoImage = pygame.image.load("img_tornado.png").convert()
- deafeningBlastImage = pygame.image.load("img_deafening_blast.png").convert()
- forgeSpiritImage = pygame.image.load("img_forge_spirit.png").convert()
- empImage = pygame.image.load("img_emp.png").convert()
- alacrityImage = pygame.image.load("img_alacrity.png").convert()
- chaosMeteorImage = pygame.image.load("img_chaos_meteor.png").convert()
- sunStrikeImage = pygame.image.load("img_sun_strike.png").convert()
- tutorial = pygame.image.load("tutorial.jpg").convert()
- cheatImage = pygame.image.load("cheat.jpg").convert()
- blackSquare = pygame.image.load("img_black_square.png").convert()
- dotaBackground = pygame.image.load("endBack.png").convert()
- blackSquare.set_colorkey(BLACK)
- soundNum = 0
- cheat = False
- oldSpell = 0
- oldSpellName ="No spells casted."
- timeInSec = int(round(time.time()))
- # Main game loop
- while True:
- pygame.event.pump()
- for event in pygame.event.get():
- if event.type == QUIT:
- pygame.quit()
- sys.exit()
- if event.type == KEYDOWN:
- color3 = color2
- color2 = color1
- if event.key == K_ESCAPE:
- main()
- if event.key == K_q:
- color1 = QUAS
- if event.key == K_w:
- color1 = WEX
- if event.key == K_e:
- color1 = EXORT
- if event.key == K_TAB:
- if cheat:
- cheat = False
- else:
- cheat = True
- if event.key == K_t:
- correctSpell += 322
- if event.type == MOUSEBUTTONDOWN:
- if gameState == GAMESTATE_MAINMENU:
- eventX = event.pos[0]
- eventY = event.pos[1]
- for i, textPos in enumerate(listOfTextPositions):
- if textPos.left < eventX < textPos.right and textPos.top < eventY < textPos.bottom:
- menuEvent = pygame.event.Event(MENUCLICKEDEVENT, item=i, text=gameMenu[i])
- pygame.event.post(menuEvent)
- elif event.type == MENUCLICKEDEVENT:
- if event.text == "Start Game":
- gameState = GAMESTATE_INGAME
- elif event.text == "Quit":
- quitGame()
- elif event.text == "Tutorial":
- gameState = GAMESTATE_TUTORIAL
- elif event.type == SHOWSCOREEVENT:
- main()
- if gameState == GAMESTATE_MAINMENU:
- canvas.blit(background_image, [0,0])
- menuHeight = (fontSize + fontSpace) * len(gameMenu)
- startY = canvas.get_height() / 2 - menuHeight / 2
- listOfTextPositions = list()
- for menuEntry in gameMenu:
- text = font.render(menuEntry, 1, (250, 250, 250))
- textPos = text.get_rect(centerx=canvas.get_width() / 2, centery=startY + fontSize + fontSpace + 150)
- listOfTextPositions.append(textPos)
- startY = startY + fontSize + fontSpace
- canvas.blit(text, textPos)
- elif gameState == GAMESTATE_TUTORIAL:
- canvas.blit(dotaBackground, [0,0])
- canvas.blit(tutorial, [450,100])
- textSurface4 = font.render("Esc to go back", 1, WHITE)
- canvas.blit(textSurface4, (5,5))
- elif gameState == GAMESTATE_END:
- canvas.fill(BLACK)
- canvas.blit(dotaBackground, [0,0])
- TextSurfaceScore = fontHue.render("Your score was: %s" %(str(correctSpell)),1,WHITE)
- canvas.blit(TextSurfaceScore, (100,50))
- TextSurfaceEsc = font.render("Press ESC to go back",1,WHITE)
- canvas.blit(TextSurfaceEsc, (100,750))
- TextSurfaceValve = font.render("Copyright 2011 Valve Corporation",1,WHITE)
- canvas.blit(TextSurfaceValve, (100,660))
- TextSurfaceCopy = font.render("Dota, Dota 2, and Invoker are registered trademarks of Valve Corporation",1,WHITE)
- canvas.blit(TextSurfaceCopy, (100,700))
- if correctSpell < 14:
- rank = "Noob"
- elif correctSpell >= 14 and correctSpell < 19:
- rank = "Average"
- elif correctSpell >= 19 and correctSpell < 300:
- rank = "Grand Magus"
- else:
- rank = "Solo 322 Kappa"
- #sipack.tweet("Hello world.")
- #Crash here
- TextSurfaceNoob = fontHue.render("Your rank: %s"%rank,1,WHITE)
- canvas.blit(TextSurfaceNoob, (100,135))
- pygame.time.set_timer(SHOWSCOREEVENT, 10000)
- elif gameState == GAMESTATE_INGAME:
- canvas.fill(BLACK)
- timeInSecLoop = int(round(time.time()))
- if timeInSecLoop - timeInSec >= 20:
- gameState = GAMESTATE_END
- pygame.draw.circle(canvas, color1, (450, 400), 40, 0)
- pygame.draw.circle(canvas, color2, (700, 400), 40, 0)
- pygame.draw.circle(canvas, color3, (950, 400), 40, 0)
- keys = pygame.key.get_pressed()
- if spell == 1:
- spellText = "Cold Snap"
- canvas.blit(coldSnapImage, [821,500])
- if color1 == QUAS:
- if color2 == QUAS:
- if color3 == QUAS:
- soundNum = random.randint(1,3)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_coldsnap_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_coldsnap_02.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_coldsnap_03.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif spell == 2:
- spellText = "Ghost Walk"
- canvas.blit(ghostWalkImage, [821,500])
- if color1 == QUAS:
- if color2 == QUAS:
- if color3 == WEX:
- soundNum = random.randint(1,3)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_ghostwalk_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_ghostwalk_02.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_ghostwalk_03.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- if color2 == WEX:
- if color3 == QUAS:
- if color1 == QUAS:
- soundNum = random.randint(1,3)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_ghostwalk_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_ghostwalk_02.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_ghostwalk_03.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- if color1 == WEX:
- if color2 == QUAS:
- if color3 == QUAS:
- soundNum = random.randint(1,3)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_ghostwalk_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_ghostwalk_02.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_ghostwalk_03.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif spell == 3:
- spellText = "Ice Wall"
- canvas.blit(iceWallImage, [821,500])
- if color1 == EXORT:
- if color2 == QUAS:
- if color3 == QUAS:
- soundNum = random.randint(1,3)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_icewall_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_icewall_02.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_icewall_03.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif color1 == QUAS:
- if color2 == EXORT:
- if color3 == QUAS:
- soundNum = random.randint(1,3)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_icewall_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_icewall_02.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_icewall_03.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif color2 == QUAS:
- if color3 == EXORT:
- soundNum = random.randint(1,3)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_icewall_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_icewall_02.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_icewall_03.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif spell == 4:
- canvas.blit(tornadoImage, [821,500])
- spellText = "Tornado"
- if color1 == QUAS:
- if color2 == WEX:
- if color3 == WEX:
- soundNum = random.randint(1,3)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_tornado_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_tornado_02.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_tornado_03.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif color1 == WEX:
- if color2 == WEX:
- if color3 == QUAS:
- soundNum = random.randint(1,3)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_tornado_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_tornado_02.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_tornado_03.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif color2 == QUAS:
- if color3 == WEX:
- soundNum = random.randint(1,3)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_tornado_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_tornado_02.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_tornado_03.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif spell == 5:
- spellText = "Deafening Blast"
- canvas.blit(deafeningBlastImage, [821,500])
- if color1 == QUAS:
- if color2 == WEX:
- if color3 == EXORT:
- soundNum = random.randint(1,5)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_deafeningblast_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_deafeningblast_02.mp3")
- elif soundNum ==3:
- pygame.mixer.music.load("Invo_ability_deafeningblast_03.mp3")
- elif soundNum ==4:
- pygame.mixer.music.load("Invo_ability_deafeningblast_04.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_deafeningblast_05.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif color2 == EXORT:
- if color3 == WEX:
- soundNum = random.randint(1,5)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_deafeningblast_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_deafeningblast_02.mp3")
- elif soundNum ==3:
- pygame.mixer.music.load("Invo_ability_deafeningblast_03.mp3")
- elif soundNum ==4:
- pygame.mixer.music.load("Invo_ability_deafeningblast_04.mp3")
- elif soundNum ==5:
- pygame.mixer.music.load("Invo_ability_deafeningblast_05.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif color1 == WEX:
- if color2 == QUAS:
- if color3 == EXORT:
- soundNum = random.randint(1,5)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_deafeningblast_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_deafeningblast_02.mp3")
- elif soundNum ==3:
- pygame.mixer.music.load("Invo_ability_deafeningblast_03.mp3")
- elif soundNum ==4:
- pygame.mixer.music.load("Invo_ability_deafeningblast_04.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_deafeningblast_05.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif color2 == EXORT:
- if color3 == QUAS:
- soundNum = random.randint(1,5)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_deafeningblast_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_deafeningblast_02.mp3")
- elif soundNum ==3:
- pygame.mixer.music.load("Invo_ability_deafeningblast_03.mp3")
- elif soundNum ==4:
- pygame.mixer.music.load("Invo_ability_deafeningblast_04.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_deafeningblast_05.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif color1 == EXORT:
- if color2 == QUAS:
- if color3 == WEX:
- soundNum = random.randint(1,5)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_deafeningblast_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_deafeningblast_02.mp3")
- elif soundNum ==3:
- pygame.mixer.music.load("Invo_ability_deafeningblast_03.mp3")
- elif soundNum ==4:
- pygame.mixer.music.load("Invo_ability_deafeningblast_04.mp3")
- elif soundNum ==5:
- pygame.mixer.music.load("Invo_ability_deafeningblast_05.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_deafeningblast_06.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif color2 == WEX:
- if color3 == QUAS:
- soundNum = random.randint(1,5)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_deafeningblast_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_deafeningblast_02.mp3")
- elif soundNum ==3:
- pygame.mixer.music.load("Invo_ability_deafeningblast_03.mp3")
- elif soundNum ==4:
- pygame.mixer.music.load("Invo_ability_deafeningblast_04.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_deafeningblast_05.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif spell == 6:
- spellText = "Forge Spirits"
- canvas.blit(forgeSpiritImage, [821,500])
- if color1 == EXORT:
- if color2 == EXORT:
- if color3 == QUAS:
- soundNum = random.randint(1,3)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_forgespirit_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_forgespirit_02.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_forgespirit_03.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif color1 == EXORT:
- if color2 == QUAS:
- if color3 == EXORT:
- soundNum = random.randint(1,3)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_forgespirit_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_forgespirit_02.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_forgespirit_03.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif color1 == QUAS:
- if color2 == EXORT:
- if color3 == EXORT:
- soundNum = random.randint(1,3)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_forgespirit_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_forgespirit_02.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_forgespirit_03.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif spell == 7:
- spellText = "EMP"
- canvas.blit(empImage, [821,500])
- if color1 == WEX:
- if color2 == WEX:
- if color3 == WEX:
- soundNum = random.randint(1,5)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_emp_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_emp_02.mp3")
- elif soundNum ==3:
- pygame.mixer.music.load("Invo_ability_emp_03.mp3")
- elif soundNum ==4:
- pygame.mixer.music.load("Invo_ability_emp_04.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_emp_05.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif spell == 8:
- spellText = "Alacrity"
- canvas.blit(alacrityImage, [821,500])
- if color1 == WEX:
- if color2 == WEX:
- if color3 == EXORT:
- soundNum = random.randint(1,3)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_alacrity_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_alacrity_02.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_alacrity_03.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif color1 == EXORT:
- if color2 == WEX:
- if color3 == WEX:
- soundNum = random.randint(1,3)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_alacrity_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_alacrity_02.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_alacrity_03.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif color1 == WEX:
- if color2 == EXORT:
- if color3 == WEX:
- soundNum = random.randint(1,3)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_alacrity_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_alacrity_02.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_alacrity_03.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif spell == 9:
- spellText = "Chaos Meteor"
- canvas.blit(chaosMeteorImage, [821,500])
- if color1 == EXORT:
- if color2 == EXORT:
- if color3 == WEX:
- soundNum = random.randint(1,4)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_chaosmeteor_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_chaosmeteor_02.mp3")
- elif soundNum ==3:
- pygame.mixer.music.load("Invo_ability_chaosmeteor_03.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_chaosmeteor_04.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif color1 == EXORT:
- if color2 == WEX:
- if color == EXORT:
- soundNum = random.randint(1,4)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_chaosmeteor_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_chaosmeteor_02.mp3")
- elif soundNum ==3:
- pygame.mixer.music.load("Invo_ability_chaosmeteor_03.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_chaosmeteor_04.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif color1 == WEX:
- if color2 == EXORT:
- if color3 == EXORT:
- soundNum = random.randint(1,4)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_chaosmeteor_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_chaosmeteor_02.mp3")
- elif soundNum ==3:
- pygame.mixer.music.load("Invo_ability_chaosmeteor_03.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_chaosmeteor_04.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- elif spell == 10:
- spellText = "Sun Strike"
- canvas.blit(sunStrikeImage, [821,500])
- if color1 == EXORT:
- if color2 == EXORT:
- if color3 ==EXORT:
- soundNum = random.randint(1,3)
- if soundNum ==1:
- pygame.mixer.music.load("Invo_ability_sunstrike_01.mp3")
- elif soundNum ==2:
- pygame.mixer.music.load("Invo_ability_sunstrike_02.mp3")
- else:
- pygame.mixer.music.load("Invo_ability_sunstrike_03.mp3")
- pygame.mixer.music.play(0)
- oldSpell = spell
- spell = random.randint(1,10)
- correctSpell +=1
- if oldSpell == 0:
- canvas.blit(blackSquare, [460,500])
- elif oldSpell == 1:
- canvas.blit(coldSnapImage, [460,500])
- oldSpellName = "Cold Snap"
- elif oldSpell == 2:
- canvas.blit(ghostWalkImage, [460,500])
- oldSpellName = "Ghost Walk"
- elif oldSpell == 3:
- canvas.blit(iceWallImage, [460,500])
- oldSpellName = "Ice Wall"
- elif oldSpell == 4:
- canvas.blit(tornadoImage, [460,500])
- oldSpellName = "Tornado"
- elif oldSpell == 5:
- canvas.blit(deafeningBlastImage, [460,500])
- oldSpellName = "Deafening Blast"
- elif oldSpell == 6:
- canvas.blit(forgeSpiritImage, [460,500])
- oldSpellName = "Forge Spirit"
- elif oldSpell == 7:
- canvas.blit(empImage, [460,500])
- oldSpellName = "EMP"
- elif oldSpell == 8:
- canvas.blit(alacrityImage, [460,500])
- oldSpellName = "Alacrity"
- elif oldSpell == 9:
- canvas.blit(chaosMeteorImage, [460,500])
- oldSpellName = "Chaos Meteor"
- else:
- canvas.blit(sunStrikeImage, [460,500])
- oldSpellName = "Sun Strike"
- hue = timeInSecLoop - timeInSec
- if cheat:
- canvas.blit(cheatImage, [25,50])
- else:
- pygame.draw.rect(canvas, BLACK, (100,100,100,100))
- textSurface1 = font.render("New Spell: %s" %spellText, 1, WHITE)
- canvas.blit(textSurface1, (761, 700))
- textSurface2 = font.render("Correct spells so far: %d" %correctSpell, 1, WHITE)
- canvas.blit(textSurface2, (550, 200))
- textSurface3 = font.render("Click Tab to display cheat sheet",1,WHITE)
- canvas.blit(textSurface3, (15, 15))
- textSurface5 = font.render("Old Spell: %s"%oldSpellName,1,WHITE)
- canvas.blit(textSurface5, (351,700))
- textSurface6 = font.render("Time: %d" %hue,1,WHITE)
- canvas.blit(textSurface6,(WIN_WIDTH/2 - 70,100))
- pygame.display.update()
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement