def __init__(self,screen): self.screen = screen self.title = pygame.transform.scale(data.load_image('sm3.png'),(640,460)) self.menu = genmenu(['START', lambda: placeholder1(screen)],['RESUME', lambda: placeholder2(screen)], ['HOW TO PLAY', lambda: placeholder3(screen)], ['QUIT', lambda: quit()]) self.menu.changeFont('smb256.ttf',28) self.menu.position(430,260) self.menu.defaultColor((0,0,0)) self.menu.choiceColor((255,0,125)) self.clock = pygame.time.Clock() pygame.display.set_caption('Super Mario Bros. 3') data.play_music('title.wav') event = pygame.event.get() self.menu.create(self.screen) self.menu.choose(event) self.main_loop()
def save_menu(self): saves = Savefile().read() save1,save2,save3 = 'FILE OPEN','FILE OPEN', 'FILE OPEN' if saves != []: if saves[0] != []: save1 = saves[0][0]+' '+saves[0][1] if saves[1] != []: save2 = saves[1][0]+' '+saves[1][1] if saves[2] != []: save3 = saves[2][0]+' '+saves[2][1] self.menu3 = genmenu([save1, lambda: self.save1(self.toon,self.lvl,self.lives)],[save2, lambda: self.save2(self.toon,self.lvl,self.lives)],[save3,lambda: self.save3(self.toon,self.lvl,self.lives)]) self.menu3.changeFont('smb256.ttf',28) self.menu3.position(320,200) self.menu3.defaultColor((0,0,0)) self.menu3.choiceColor((255,0,125))
def makeMenu(self): if self.saves == []: return False else: saves = self.saves save1, save2, save3 = 'FILE OPEN', 'FILE OPEN', 'FILE OPEN' if saves[0] != []: save1 = saves[0][0] + ' ' + saves[0][1] if saves[1] != []: save2 = saves[1][0] + ' ' + saves[1][1] if saves[2] != []: save3 = saves[2][0] + ' ' + saves[2][1] self.menu = genmenu([save1, lambda: s0(self.screen, saves[0])], [save2, lambda: s0(self.screen, saves[1])], [save3, lambda: s0(self.screen, saves[2])])
def __init__(self, screen): self.screen = screen self.title = pygame.transform.scale(data.load_image('sm3.png'), (640, 460)) self.menu = genmenu(['START', lambda: placeholder1(screen)], ['RESUME', lambda: placeholder2(screen)], ['QUIT', lambda: quit()]) self.menu.changeFont('smb256.ttf', 28) self.menu.position(430, 260) self.menu.defaultColor((0, 0, 0)) self.menu.choiceColor((255, 0, 125)) self.clock = pygame.time.Clock() pygame.display.set_caption('Super Mario Bros. 3') data.play_music('title.wav') event = pygame.event.get() self.menu.create(self.screen) self.menu.choose(event) self.main_loop()
def __init__(self, screen,toon, level=1,lives=3): ######################################### # SET UP SCREEN, FPS MONITOR (CLOCK), AND SPRITES ######################################### self.screen = screen self.clock = pygame.time.Clock() self.sprites = pygame.sprite.OrderedUpdates() self.character = pygame.sprite.OrderedUpdates() self.flags = pygame.sprite.OrderedUpdates() self.death = pygame.sprite.OrderedUpdates() self.platforms = pygame.sprite.OrderedUpdates() self.enemies = pygame.sprite.OrderedUpdates() self.mushrooms = pygame.sprite.OrderedUpdates() self.coins = pygame.sprite.OrderedUpdates() self.questions = pygame.sprite.OrderedUpdates() self.stationary = pygame.sprite.OrderedUpdates() self.traps = pygame.sprite.OrderedUpdates() self.movingplatforms = pygame.sprite.OrderedUpdates() self.cannons = pygame.sprite.OrderedUpdates() self.bases = pygame.sprite.OrderedUpdates() self.coinquestions = pygame.sprite.OrderedUpdates() self.upplat = pygame.sprite.OrderedUpdates() self.brickquestions = pygame.sprite.OrderedUpdates() self.breakable = pygame.sprite.OrderedUpdates() self.powerup = pygame.sprite.OrderedUpdates() self.starquestions = pygame.sprite.OrderedUpdates() self.missles = pygame.sprite.OrderedUpdates() self.fire = pygame.sprite.OrderedUpdates() self.bridges = pygame.sprite.OrderedUpdates() self.switches = pygame.sprite.OrderedUpdates() self.hazards = pygame.sprite.OrderedUpdates() self.flares = pygame.sprite.OrderedUpdates() ######################################### # IMAGES - all images cited in citations.txt ######################################### if toon == 'Mario': Player.move_images = [data.load_image('mario1.png'), data.load_image('mario2.png'), data.load_image('mario3.png'), data.load_image('mario4.png'), data.load_image('mario1.png'), data.load_image('mario5.png')] if toon == 'Luigi': Player.move_images = [data.load_image('luigi1.png',1.435), data.load_image('luigi2.png',1.513), data.load_image('luigi3.png',1.513), data.load_image('luigi4.png',1.47), data.load_image('luigi1.png',1.435), data.load_image('luigi5.png',1.55)] if toon == 'Yoshi': Player.move_images = [data.load_image('yoshi1.png',1.75), data.load_image('yoshi2.png',1.694), data.load_image('yoshi3.png',1.696), data.load_image('yoshi4.png',1.694), data.load_image('yoshi1.png',1.75), data.load_image('yoshirand.png',1.6)] if toon == 'Toad': Player.move_images = [data.load_image('toad1.png'), data.load_image('toad2.png'), data.load_image('toad3.png'), data.load_image('toad4.png'), data.load_image('toad1.png'), data.load_image('toad5.png')] Cloud.image = data.load_image('cloud.png') Question.images = [data.load_image('q%s.png'%image) for image in xrange(0,4)] MushroomQuestion.images = [data.load_image('q%s.png'%image) for image in xrange(0,4)] StarBox.images = [data.load_image('q%s.png'%image) for image in xrange(0,4)] BrickQuestion.images = [data.load_image('q%s.png'%image) for image in xrange(0,4)] CoinQuestion.images = [data.load_image('q%s.png'%image) for image in xrange(0,4)] Coin.images = [data.load_image('coin%s.png'%image) for image in xrange(1,9)] Platform.image = data.load_image('platform-top.png') Brick.image = data.load_image('platform-brick.png') Bush.image = data.load_image('bush-1.png') Goomba.images = [data.load_image('goomba%s.png'%image)for image in xrange(1,4)] JumpPlatform.image = data.load_image('platform-air.png') OneUp.image = data.load_image('1up2.png') Pipe.image = data.load_image('pipe.png') Hill.image = data.load_image('hill.png') Flag.images = [data.load_image('flagpole%s.png' %image) for image in xrange(1,5)] Castle.image = data.load_image('castle.png') VenusFlyTrap.images = [data.load_image('redvenus%s.png' % image) for image in xrange(1,3)] BigPipe.image = data.load_image('bigpipe.png') RedKoopa.images = [data.load_image('redkoopa%s.png'%image) for image in xrange(1,4)] GreenKoopa.images = [data.load_image('greenkoopa%s.png'%image) for image in xrange(1,4)] DoubleCloud.image = data.load_image('doublecloud.png') BigTree.image = data.load_image('bigtree.png') Tree.image = data.load_image('tree.png') Fence.image = data.load_image('fence.png') RedKoopa.images = [data.load_image('redkoopa%s.png'%image) for image in xrange(1,4)] GrassLeft.image = data.load_image('grassleft.png') GrassMiddle.image = data.load_image('grassmiddle.png') GrassRight.image = data.load_image('grassright.png') GrassSupport.images = [data.load_image('grasssupport%s.png'%image) for image in xrange(0,4)] CrossGrass.images = [data.load_image('grass%s.png'%image)for image in xrange(1,4)] Wall.image = data.load_image('wall.png') Moving.image = data.load_image('moving.png') BigMoving.image = data.load_image('bigmoving.png') BigCannon.images = [data.load_image('cannonbig%s.png'%image) for image in xrange(1,3)] SmallCannon.images = [data.load_image('smallcannon%s.png'%image) for image in xrange(1,3)] Cannon.images = [data.load_image('cannon%s.png' % image) for image in xrange(1,3)] GrabCoin.images = [data.load_image('c%s.png' % image) for image in xrange(1,4)] GreenVenusFlyTrap.images = [data.load_image('vblue%s.png'%image)for image in xrange(0,2)] GrabShroom.images = [data.load_image('c%s.png' % image) for image in xrange(1,4)] BrickShroom.image = data.load_image('brickbreaker.png') Star.images = [data.load_image('star%s.png'%image)for image in xrange(0,8)] Bullet.image = data.load_image('bullet.png') CastleBrick.image = data.load_image('cbrick.png') Lava.images = [data.load_image('lava%s.png'%image)for image in xrange(0,2)] if level == 9: Lava.images = [data.load_image('water%s.png'%image)for image in xrange(0,2)] FireBlock.image = data.load_image('qempty.png') Bridge.image = data.load_image('bridge.png') Switch.image = data.load_image('switch.png') Bowser.image = data.load_image('bowser.png') FireBall.images = [data.load_image('fireball%s.png'%image,1.5)for image in xrange(0,6)] GoombaDie.image = data.load_image('goomba3.png') BowserCastle.image = data.load_image('bigcastle.png') Message.image = data.load_image('castleend.png') Spike.image = data.load_image('spike.png') PeachCastle.image = data.load_image('peach.png',1) Flare.images = [data.load_image('flare%s.png'%image)for image in xrange(0,4)] ######################################### # SPRITE GROUPS ######################################### Flare.groups = self.flares, self.sprites PeachCastle.groups = self.sprites BowserCastle.groups = self.sprites Player.groups = self.sprites, self.character,self.death Cloud.groups = self.sprites, Question.groups = self.sprites, self.platforms, self.questions, self.stationary MushroomQuestion.groups = self.sprites, self.platforms, self.questions, self.stationary, self.upplat CoinQuestion.groups = self.sprites, self.platforms, self.questions, self.stationary, self.coinquestions BrickQuestion.groups = self.sprites, self.platforms, self.questions, self.stationary, self.brickquestions StarBox.groups = self.sprites, self.platforms, self.questions, self.stationary, self.starquestions Coin.groups = self.sprites,self.coins, Platform.groups = self.sprites,self.platforms,self.stationary,self.bases CastleBrick.groups = self.sprites,self.platforms,self.stationary Brick.groups = self.sprites, self.platforms, self.stationary, self.breakable Bush.groups = self.sprites Goomba.groups = self.sprites, self.enemies JumpPlatform.groups = self.sprites, self.platforms, self.stationary OneUp.groups = self.sprites, self.mushrooms Pipe.groups = self.sprites, self.platforms, self.stationary Hill.groups = self.sprites Flag.groups = self.sprites, self.flags Castle.groups = self.sprites VenusFlyTrap.groups = self.sprites, self.traps BigPipe.groups = self.sprites, self.platforms, self.stationary RedKoopa.groups = self.sprites, self.enemies GreenKoopa.groups = self.sprites, self.enemies DoubleCloud.groups = self.sprites Tree.groups = self.sprites BigTree.groups = self.sprites Fence.groups = self.sprites RedKoopa.groups = self.sprites, self.enemies GrassLeft.groups = self.sprites, self.platforms, self.stationary GrassMiddle.groups = self.sprites, self.platforms, self.stationary GrassRight.groups = self.sprites, self.platforms, self.stationary GrassSupport.groups = self.sprites, self.platforms, self.stationary CrossGrass.groups = self.sprites Wall.groups = self.sprites Moving.groups = self.sprites, self.platforms, self.movingplatforms BigMoving.groups = self.sprites, self.platforms, self.movingplatforms BigCannon.groups = self.sprites, self.platforms, self.stationary, self.cannons Cannon.groups = self.sprites, self.platforms, self.stationary, self.cannons SmallCannon.groups = self.sprites, self.platforms, self.stationary, self.cannons Death.groups = self.sprites,self.death GrabShroom.groups = self.sprites GrabCoin.groups = self.sprites, GreenVenusFlyTrap.groups = self.sprites, self.traps BrickShroom.groups = self.sprites, self.mushrooms Spike.groups = self.sprites, self.hazards Star.groups = self.sprites, self.powerup Bullet.groups = self.sprites, self.missles Lava.groups = self.sprites FireBlock.groups = self.sprites,self.platforms,self.stationary Bridge.groups = self.sprites,self.platforms,self.stationary,self.bridges Switch.groups = self.sprites,self.platforms,self.stationary,self.switches Bowser.groups = self.sprites,self.enemies FireBall.groups = self.sprites,self.fire GoombaDie.groups = self.sprites GreenKoopaDeath.groups = self.sprites Message.groups = self.sprites VenusDie.groups = self.sprites GreenVenusDie.groups = self.sprites RedKoopaDeath.groups = self.sprites # self.sprites = sprites w/ no interactions # self.character = the player # self.flags = flags @ end of level # self.death = keep track of death pictures # self.platforms = everything that you can stand on # self.enemies = all the enemies # self.mushrooms = powerups etc # self.coins = coins... # self.questions = question blocks # self.stationary = sprites which do not move # self.traps = the plants that eat you # self.movingplatforms = self explanatory # self.cannons = cannons # self.bases = floors for the plants # self.coinquestions = questions that spit coins # self.upplat = questions that spit 1up # self.brickquestions = questions that spit brickbreater /megamushroom # self.breakable = sprites that can be destroyed # self.powerup = ... power ups # self.starquestions = invincibility questions # self.missles = bullet bills # self.fire = bowser fire # self.bridges = bowser bridge # self.switches = bowser switch # self.hazards = bowser spikes ######################################### # SOUNDS ######################################### self.coinsound = data.load_sound('coin.wav',1) self.power = data.load_sound('getshroom.wav',1) self.complete = data.load_sound('flag.wav',1) ######################################### # MENUS ######################################### self.menu = genmenu(['Resume', lambda: self.placeholder()],['Save Game', lambda: self.placeholder1()],['Quit Game',lambda: self.placeholder2(self.screen)]) self.menu.changeFont('Raleway Thin.ttf',28) self.menu.position(320,200) self.menu.defaultColor((255,255,255)) self.menu.choiceColor((0,255,0)) self.menu2 = genmenu(['FILE OPEN', lambda: self.save1(self.toon,self.lvl,self.lives)],['FILE OPEN', lambda: self.save2(self.toon,self.lvl,self.lives)],['FILE OPEN',lambda: self.save3(self.toon,self.lvl,self.lives)]) self.save_menu() self.menu2.changeFont('smb256.ttf',28) self.menu2.position(320,200) self.menu2.defaultColor((0,0,0)) self.menu2.choiceColor((255,0,125)) ######################################### # FONTS ######################################### self.font = pygame.font.Font(data.filepath('smb256.ttf'),20) self.font4 = pygame.font.Font(data.filepath('smb256.ttf'),36) self.font2 = pygame.font.Font(data.filepath('Raleway Thin.ttf'),14) self.font3 = pygame.font.Font(data.filepath('Raleway Thin.ttf'),24) ######################################### # FLAGS / GAME VALUES ######################################### self.start = 1 self.saving = 0 self.diefix = 0 self.paused = 0 self.toon = toon self.score = 000 self.chill = 0 self.record = '' self.flagged = 0 self.lives = lives self.powertracker = 0 self.cheat_enabled = 0 ######################################### # LEVEL CREATION ######################################### self.lvl = level self.bgcolor = get_bg() self.level = Level(self.lvl) self.player = Player((000,00),toon) self.bg = self.bgcolor[self.lvl][0] data.play_music(self.bgcolor[self.lvl][1]) self.camera = Camera(self.player,self.level.width()) ######################################### # LOAD SCORES ######################################### if Savefile('scores.txt').readscore() == None: self.highscore = 0 else: self.highscore = int(Savefile('scores.txt').readscore()) ######################################### # AESTHETIC CHANGES ######################################### self.mworld = 1 + (self.lvl-1)/4 self.stage = (self.lvl-1)%4+1 if level != 9: pygame.display.set_caption('World %s-%s'%(self.mworld,self.stage)) else: pygame.display.set_caption('Princess Peach\'s Castle') ######################################### # INITIALIZE GAME ######################################### self.main_loop()
def __init__(self, screen,toon, level=1,lives=3): ######################################### # SET UP SCREEN, FPS MONITOR (CLOCK), AND SPRITES ######################################### self.screen = screen self.clock = pygame.time.Clock() self.sprites = pygame.sprite.OrderedUpdates() self.character = pygame.sprite.OrderedUpdates() self.flags = pygame.sprite.OrderedUpdates() self.death = pygame.sprite.OrderedUpdates() self.platforms = pygame.sprite.OrderedUpdates() self.enemies = pygame.sprite.OrderedUpdates() self.mushrooms = pygame.sprite.OrderedUpdates() self.coins = pygame.sprite.OrderedUpdates() self.questions = pygame.sprite.OrderedUpdates() self.stationary = pygame.sprite.OrderedUpdates() self.traps = pygame.sprite.OrderedUpdates() self.movingplatforms = pygame.sprite.OrderedUpdates() self.cannons = pygame.sprite.OrderedUpdates() self.bases = pygame.sprite.OrderedUpdates() self.coinquestions = pygame.sprite.OrderedUpdates() self.upplat = pygame.sprite.OrderedUpdates() self.brickquestions = pygame.sprite.OrderedUpdates() self.breakable = pygame.sprite.OrderedUpdates() self.powerup = pygame.sprite.OrderedUpdates() self.starquestions = pygame.sprite.OrderedUpdates() self.missles = pygame.sprite.OrderedUpdates() self.fire = pygame.sprite.OrderedUpdates() self.bridges = pygame.sprite.OrderedUpdates() self.switches = pygame.sprite.OrderedUpdates() self.hazards = pygame.sprite.OrderedUpdates() self.flares = pygame.sprite.OrderedUpdates() ######################################### # IMAGES - all images cited in citations.txt ######################################### if toon == 'Mario': Player.move_images = [data.load_image('mario1.png'), data.load_image('mario2.png'), data.load_image('mario3.png'), data.load_image('mario4.png'), data.load_image('mario1.png'), data.load_image('mario5.png')] if toon == 'Luigi': Player.move_images = [data.load_image('luigi1.png',1.435), data.load_image('luigi2.png',1.513), data.load_image('luigi3.png',1.513), data.load_image('luigi4.png',1.47), data.load_image('luigi1.png',1.435), data.load_image('luigi5.png',1.55)] if toon == 'Yoshi': Player.move_images = [data.load_image('yoshi1.png',1.75), data.load_image('yoshi2.png',1.694), data.load_image('yoshi3.png',1.696), data.load_image('yoshi4.png',1.694), data.load_image('yoshi1.png',1.75), data.load_image('yoshirand.png',1.6)] if toon == 'Toad': Player.move_images = [data.load_image('toad1.png'), data.load_image('toad2.png'), data.load_image('toad3.png'), data.load_image('toad4.png'), data.load_image('toad1.png'), data.load_image('toad5.png')] Cloud.image = data.load_image('cloud.png') Question.images = [data.load_image('q%s.png'%image) for image in xrange(0,4)] MushroomQuestion.images = [data.load_image('q%s.png'%image) for image in xrange(0,4)] StarBox.images = [data.load_image('q%s.png'%image) for image in xrange(0,4)] BrickQuestion.images = [data.load_image('q%s.png'%image) for image in xrange(0,4)] CoinQuestion.images = [data.load_image('q%s.png'%image) for image in xrange(0,4)] Coin.images = [data.load_image('coin%s.png'%image) for image in xrange(1,9)] Platform.image = data.load_image('platform-top.png') Brick.image = data.load_image('platform-brick.png') Bush.image = data.load_image('bush-1.png') Goomba.images = [data.load_image('goomba%s.png'%image)for image in xrange(1,4)] JumpPlatform.image = data.load_image('platform-air.png') OneUp.image = data.load_image('1up2.png') Pipe.image = data.load_image('pipe.png') Hill.image = data.load_image('hill.png') Flag.images = [data.load_image('flagpole%s.png' %image) for image in xrange(1,5)] Castle.image = data.load_image('castle.png') VenusFlyTrap.images = [data.load_image('redvenus%s.png' % image) for image in xrange(1,3)] BigPipe.image = data.load_image('bigpipe.png') RedKoopa.images = [data.load_image('redkoopa%s.png'%image) for image in xrange(1,4)] GreenKoopa.images = [data.load_image('greenkoopa%s.png'%image) for image in xrange(1,4)] DoubleCloud.image = data.load_image('doublecloud.png') BigTree.image = data.load_image('bigtree.png') Tree.image = data.load_image('tree.png') Fence.image = data.load_image('fence.png') RedKoopa.images = [data.load_image('redkoopa%s.png'%image) for image in xrange(1,4)] GrassLeft.image = data.load_image('grassleft.png') GrassMiddle.image = data.load_image('grassmiddle.png') GrassRight.image = data.load_image('grassright.png') GrassSupport.images = [data.load_image('grasssupport%s.png'%image) for image in xrange(0,4)] CrossGrass.images = [data.load_image('grass%s.png'%image)for image in xrange(1,4)] Wall.image = data.load_image('wall.png') Moving.image = data.load_image('moving.png') BigMoving.image = data.load_image('bigmoving.png') BigCannon.images = [data.load_image('cannonbig%s.png'%image) for image in xrange(1,3)] SmallCannon.images = [data.load_image('smallcannon%s.png'%image) for image in xrange(1,3)] Cannon.images = [data.load_image('cannon%s.png' % image) for image in xrange(1,3)] GrabCoin.images = [data.load_image('c%s.png' % image) for image in xrange(1,4)] GreenVenusFlyTrap.images = [data.load_image('vblue%s.png'%image)for image in xrange(0,2)] GrabShroom.images = [data.load_image('c%s.png' % image) for image in xrange(1,4)] BrickShroom.image = data.load_image('brickbreaker.png') Star.images = [data.load_image('star%s.png'%image)for image in xrange(0,8)] Bullet.image = data.load_image('bullet.png') CastleBrick.image = data.load_image('cbrick.png') Lava.images = [data.load_image('lava%s.png'%image)for image in xrange(0,2)] if level == 9: Lava.images = [data.load_image('water%s.png'%image)for image in xrange(0,2)] FireBlock.image = data.load_image('qempty.png') Bridge.image = data.load_image('bridge.png') Switch.image = data.load_image('switch.png') Bowser.image = data.load_image('bowser.png') FireBall.images = [data.load_image('fireball%s.png'%image,1.5)for image in xrange(0,6)] GoombaDie.image = data.load_image('goomba3.png') BowserCastle.image = data.load_image('bigcastle.png') Spike.image = data.load_image('spike.png') PeachCastle.image = data.load_image('peach.png',1) Flare.images = [data.load_image('flare%s.png'%image)for image in xrange(0,4)] ######################################### # SPRITE GROUPS ######################################### Flare.groups = self.flares, self.sprites PeachCastle.groups = self.sprites BowserCastle.groups = self.sprites Player.groups = self.sprites, self.character,self.death Cloud.groups = self.sprites, Question.groups = self.sprites, self.platforms, self.questions, self.stationary MushroomQuestion.groups = self.sprites, self.platforms, self.questions, self.stationary, self.upplat CoinQuestion.groups = self.sprites, self.platforms, self.questions, self.stationary, self.coinquestions BrickQuestion.groups = self.sprites, self.platforms, self.questions, self.stationary, self.brickquestions StarBox.groups = self.sprites, self.platforms, self.questions, self.stationary, self.starquestions Coin.groups = self.sprites,self.coins, Platform.groups = self.sprites,self.platforms,self.stationary,self.bases CastleBrick.groups = self.sprites,self.platforms,self.stationary Brick.groups = self.sprites, self.platforms, self.stationary, self.breakable Bush.groups = self.sprites Goomba.groups = self.sprites, self.enemies JumpPlatform.groups = self.sprites, self.platforms, self.stationary OneUp.groups = self.sprites, self.mushrooms Pipe.groups = self.sprites, self.platforms, self.stationary Hill.groups = self.sprites Flag.groups = self.sprites, self.flags Castle.groups = self.sprites VenusFlyTrap.groups = self.sprites, self.traps BigPipe.groups = self.sprites, self.platforms, self.stationary RedKoopa.groups = self.sprites, self.enemies GreenKoopa.groups = self.sprites, self.enemies DoubleCloud.groups = self.sprites Tree.groups = self.sprites BigTree.groups = self.sprites Fence.groups = self.sprites RedKoopa.groups = self.sprites, self.enemies GrassLeft.groups = self.sprites, self.platforms, self.stationary GrassMiddle.groups = self.sprites, self.platforms, self.stationary GrassRight.groups = self.sprites, self.platforms, self.stationary GrassSupport.groups = self.sprites, self.platforms, self.stationary CrossGrass.groups = self.sprites Wall.groups = self.sprites Moving.groups = self.sprites, self.platforms, self.movingplatforms BigMoving.groups = self.sprites, self.platforms, self.movingplatforms BigCannon.groups = self.sprites, self.platforms, self.stationary, self.cannons Cannon.groups = self.sprites, self.platforms, self.stationary, self.cannons SmallCannon.groups = self.sprites, self.platforms, self.stationary, self.cannons Death.groups = self.sprites,self.death GrabShroom.groups = self.sprites GrabCoin.groups = self.sprites, GreenVenusFlyTrap.groups = self.sprites, self.traps BrickShroom.groups = self.sprites, self.mushrooms Spike.groups = self.sprites, self.hazards Star.groups = self.sprites, self.powerup Bullet.groups = self.sprites, self.missles Lava.groups = self.sprites FireBlock.groups = self.sprites,self.platforms,self.stationary Bridge.groups = self.sprites,self.platforms,self.stationary,self.bridges Switch.groups = self.sprites,self.platforms,self.stationary,self.switches Bowser.groups = self.sprites,self.enemies FireBall.groups = self.sprites,self.fire GoombaDie.groups = self.sprites GreenKoopaDeath.groups = self.sprites Message.groups = self.sprites VenusDie.groups = self.sprites GreenVenusDie.groups = self.sprites RedKoopaDeath.groups = self.sprites # self.sprites = sprites w/ no interactions # self.character = the player # self.flags = flags @ end of level # self.death = keep track of death pictures # self.platforms = everything that you can stand on # self.enemies = all the enemies # self.mushrooms = powerups etc # self.coins = coins... # self.questions = question blocks # self.stationary = sprites which do not move # self.traps = the plants that eat you # self.movingplatforms = self explanatory # self.cannons = cannons # self.bases = floors for the plants # self.coinquestions = questions that spit coins # self.upplat = questions that spit 1up # self.brickquestions = questions that spit brickbreater /megamushroom # self.breakable = sprites that can be destroyed # self.powerup = ... power ups # self.starquestions = invincibility questions # self.missles = bullet bills # self.fire = bowser fire # self.bridges = bowser bridge # self.switches = bowser switch # self.hazards = bowser spikes ######################################### # SOUNDS ######################################### self.coinsound = data.load_sound('coin.wav',1) self.power = data.load_sound('getshroom.wav',1) self.complete = data.load_sound('flag.wav',1) ######################################### # MENUS ######################################### self.menu = genmenu(['Resume', lambda: self.placeholder()],['Save Game', lambda: self.placeholder1()],['Quit Game',lambda: self.placeholder2(self.screen)]) self.menu.changeFont('Raleway Thin.ttf',28) self.menu.position(320,200) self.menu.defaultColor((255,255,255)) self.menu.choiceColor((0,255,0)) self.menu2 = genmenu(['FILE OPEN', lambda: self.save1(self.toon,self.lvl,self.lives)],['FILE OPEN', lambda: self.save2(self.toon,self.lvl,self.lives)],['FILE OPEN',lambda: self.save3(self.toon,self.lvl,self.lives)]) self.save_menu() self.menu2.changeFont('smb256.ttf',28) self.menu2.position(320,200) self.menu2.defaultColor((0,0,0)) self.menu2.choiceColor((255,0,125)) ######################################### # FONTS ######################################### self.font = pygame.font.Font(data.filepath('smb256.ttf'),20) self.font4 = pygame.font.Font(data.filepath('smb256.ttf'),36) self.font2 = pygame.font.Font(data.filepath('Raleway Thin.ttf'),14) self.font3 = pygame.font.Font(data.filepath('Raleway Thin.ttf'),24) ######################################### # FLAGS / GAME VALUES ######################################### self.start = 1 self.saving = 0 self.diefix = 0 self.paused = 0 self.toon = toon self.score = 000 self.chill = 0 self.record = '' self.flagged = 0 self.lives = lives self.powertracker = 0 self.cheat_enabled = 0 ######################################### # LEVEL CREATION ######################################### self.lvl = level self.bgcolor = get_bg() self.level = Level(self.lvl) self.player = Player((000,00),toon) self.bg = self.bgcolor[self.lvl][0] data.play_music(self.bgcolor[self.lvl][1]) self.camera = Camera(self.player,self.level.width()) ######################################### # LOAD SCORES ######################################### if Savefile('scores.txt').readscore() == None: self.highscore = 0 else: self.highscore = int(Savefile('scores.txt').readscore()) ######################################### # AESTHETIC CHANGES ######################################### self.mworld = 1 + (self.lvl-1)/4 self.stage = (self.lvl-1)%4+1 if level != 9: pygame.display.set_caption('World %s-%s'%(self.mworld,self.stage)) else: pygame.display.set_caption('Princess Peach\'s Castle') ######################################### # INITIALIZE GAME ######################################### self.main_loop()