Esempio n. 1
0
    def update(self):

        evman = eventmanager.get()

        if evman.MOUSE1CLICK != False:
            event = evman.MOUSE1CLICK
            clickpoint = event.pos
            #clickpoint = (camera.window.left+clickpoint[0],camera.window.top+clickpoint[1])

            if self.volume_button.get_rect().collidepoint(clickpoint):
                self.vol = not self.vol
                if self.vol:
                    sound.set_bgm_vol(self.bgm_vol)
                    sound.set_sfx_vol(self.sfx_vol)
                else:
                    #update the volume before muting
                    self.bgm_vol = sound.get_bgm_vol()
                    self.sfx_vol = sound.get_sfx_vol()
                    sound.set_bgm_vol(0)
                    sound.set_sfx_vol(0)

#            else
#                self.playing = True
                  
            if self.plot_skip_button.get_rect().collidepoint(clickpoint):
                self.plotOver = True
            elif self.plot_next_button.get_rect().collidepoint(clickpoint) and self.currentPlot < self.maxPlot:
                self.currentPlot = self.currentPlot + 1
            elif self.plot_back_button.get_rect().collidepoint(clickpoint) and self.currentPlot > 1:
                self.currentPlot = self.currentPlot - 1
            elif self.plot_back_button.get_rect().collidepoint(clickpoint) and self.currentPlot == 1:
                pass
            elif self.plot_next_button.get_rect().collidepoint(clickpoint) and self.currentPlot == self.maxPlot:
                self.plotOver = True
Esempio n. 2
0
    def draw(self, camera):

        if not self.show_instructions and not self.show_options and not self.show_level:
            self.splash_bg.draw(camera)
            self.newgame_button.draw(camera)
            self.loadgame_button.draw(camera)
            self.instructions_button.draw(camera)
            self.options_button.draw(camera)
            self.quit_button.draw(camera)

        elif self.show_instructions:
            self.instructions_bg.draw(camera)
            self.back_button.draw(camera)

        elif self.show_options:
            #Options Screen
            self.options_bg.draw(camera)
            self.volup_button.draw(camera)
            self.voldown_button.draw(camera)
            self.volupFX_button.draw(camera)
            self.voldownFX_button.draw(camera)
            self.gammaUp_button.draw(camera)
            self.gammaDown_button.draw(camera)
            self.options_back_button.draw(camera)
            #bgm volume bar
            for i in range(0, sound.get_bgm_vol()):
                self.menublock.rect.topleft = (133 +
                                               i * self.menublock.rect.width,
                                               265)
                self.menublock.draw(camera)
            #sfx volume bar
            for i in range(0, sound.get_sfx_vol()):
                self.menublock.rect.topleft = (133 +
                                               i * self.menublock.rect.width,
                                               395)
                self.menublock.draw(camera)

        elif self.show_level:
            #Level Select Screen
            self.lvl_bg.draw(camera)
            self.lvltut.draw(camera)
            self.lvl1.draw(camera)
            self.lvl2.draw(camera)
            self.lvl3.draw(camera)
            self.lvl4.draw(camera)
            self.lvl5.draw(camera)
Esempio n. 3
0
    def update(self):
        evman = eventmanager.get()
        if evman.MOUSE1CLICK != False:
            event = evman.MOUSE1CLICK
            clickpoint = event.pos

            if self.volume_button.get_rect().collidepoint(clickpoint):
                self.vol = not self.vol
                if self.vol:
                    sound.set_bgm_vol(self.bgm_vol)
                    sound.set_sfx_vol(self.sfx_vol)
                else:
                    #update the volume before muting
                    self.bgm_vol = sound.get_bgm_vol()
                    self.sfx_vol = sound.get_sfx_vol()
                    sound.set_bgm_vol(0)
                    sound.set_sfx_vol(0)
Esempio n. 4
0
    def update(self):
        evman = eventmanager.get()
        if evman.MOUSE1CLICK != False:
            event = evman.MOUSE1CLICK
            clickpoint = event.pos

            if self.volume_button.get_rect().collidepoint(clickpoint):
                self.vol = not self.vol
                if self.vol:
                    sound.set_bgm_vol(self.bgm_vol)
                    sound.set_sfx_vol(self.sfx_vol)
                else:
                    #update the volume before muting
                    self.bgm_vol = sound.get_bgm_vol()
                    self.sfx_vol = sound.get_sfx_vol()
                    sound.set_bgm_vol(0)
                    sound.set_sfx_vol(0)
Esempio n. 5
0
    def __init__(self,currLevel):
        self.currentLevel = 0
        self.plotfolder = "tut"
        self.maxPlot = 1
        
        #only set the level during init, doesn't have to update every time
        if currLevel == 1:    #Super Mario World
            self.plotfolder = "smw"
            self.maxPlot = 15
        elif currLevel == 2:  #Sonic World
            self.plotfolder = "sonic"
            self.maxPlot = 1
        elif currLevel == 3:  #Megaman World
            self.plotfolder = "megaman"
            self.maxPlot = 2
        elif currLevel == 4:  #Metroid World
            self.plotfolder = "metroid"
            self.maxPlot = 2
        elif currLevel == 5:  #Castlevania World
            self.plotfolder = "castlevania"
            self.maxPlot = 2    
        
        self.currentPlot = 1

        self.plotOver = False
        #self.camera = None

        #plot page
        self.plot_back_button    = StaticImage( "images/menusprites/back.png",904, 490 )
        self.plot_next_button    = StaticImage( "images/menusprites/next.png",900, 530 )
        self.plot_skip_button    = StaticImage( "images/menusprites/skip.png",900, 450 )
        self.plot_bg             = StaticImage( "images/plot/smw/1.jpg",0,0)

        #self.bgm = 'sounds/SureShot.wav'
        
        #Mute button
        self.vol = True
        #Remember where the volume was after un-muting
        self.bgm_vol = sound.get_bgm_vol()
        self.sfx_vol = sound.get_sfx_vol()
        
        self.volume_button = StaticImage("images/menusprites/volume.png",960,10)
        self.mute_button   = StaticImage("images/menusprites/mute.png",960,10)
Esempio n. 6
0
    def draw(self,camera):

        if not self.show_instructions and not self.show_options and not self.show_level:
            self.splash_bg.draw(camera)
            self.newgame_button.draw(camera)
            self.loadgame_button.draw(camera)
            self.instructions_button.draw(camera)
            self.options_button.draw(camera)
            self.quit_button.draw(camera)

        elif self.show_instructions:
            self.instructions_bg.draw(camera)
            self.back_button.draw(camera)

        elif self.show_options:
            #Options Screen
            self.options_bg.draw(camera)
            self.volup_button.draw(camera)
            self.voldown_button.draw(camera)
            self.volupFX_button.draw(camera)
            self.voldownFX_button.draw(camera)
            self.gammaUp_button.draw(camera)
            self.gammaDown_button.draw(camera)
            self.options_back_button.draw(camera)
            #bgm volume bar
            for i in range(0, sound.get_bgm_vol()):
                self.menublock.rect.topleft = ( 133 + i*self.menublock.rect.width,265 )
                self.menublock.draw(camera)
            #sfx volume bar
            for i in range(0, sound.get_sfx_vol()):
                self.menublock.rect.topleft = ( 133 + i*self.menublock.rect.width,395 )
                self.menublock.draw(camera)
                
        elif self.show_level:
            #Level Select Screen
            self.lvl_bg.draw(camera)
            self.lvltut.draw(camera)
            self.lvl1.draw(camera)
            self.lvl2.draw(camera)
            self.lvl3.draw(camera)
            self.lvl4.draw(camera)
            self.lvl5.draw(camera)
Esempio n. 7
0
    def __init__(self):
        self.vol = True
        
        #Remember where the volume was after un-muting
        self.bgm_vol = sound.get_bgm_vol()
        self.sfx_vol = sound.get_sfx_vol()
        
        self.time = 0
        self.timeString = "000"
        
        self.scoreString = "0"

        self.volume_button = StaticImage( "images/menusprites/volume.png", 0, 0 )
        self.mute_button = StaticImage( "images/menusprites/mute.png", 0, 0 )

        self.heart = StaticImage( "images/heart.png", 0, 0 )
        self.sattackbar = StaticImage( "images/sattackbar.png", 0, 0 )
        self.sattackblock = StaticImage( "images/sattackblock.png", 0, 0 )
        
        self.score_title = StaticImage( "images/hudsprites/score.png", 0, 0 )
        self.time_title = StaticImage( "images/hudsprites/time.png", 0, 0 )
        self.digit = StaticImage( "images/hudsprites/0.png", 0, 0 )
Esempio n. 8
0
    def __init__(self):
        self.vol = True

        #Remember where the volume was after un-muting
        self.bgm_vol = sound.get_bgm_vol()
        self.sfx_vol = sound.get_sfx_vol()

        self.time = 0
        self.timeString = "000"

        self.scoreString = "0"

        self.volume_button = StaticImage("images/menusprites/volume.png", 0, 0)
        self.mute_button = StaticImage("images/menusprites/mute.png", 0, 0)

        self.heart = StaticImage("images/heart.png", 0, 0)
        self.sattackbar = StaticImage("images/sattackbar.png", 0, 0)
        self.sattackblock = StaticImage("images/sattackblock.png", 0, 0)

        self.score_title = StaticImage("images/hudsprites/score.png", 0, 0)
        self.time_title = StaticImage("images/hudsprites/time.png", 0, 0)
        self.digit = StaticImage("images/hudsprites/0.png", 0, 0)
Esempio n. 9
0
    def update(self):

        evman = eventmanager.get()

        if evman.MOUSE1CLICK != False:
            event = evman.MOUSE1CLICK
            clickpoint = event.pos

            #StartMenu
            if not self.show_instructions and not self.show_options and not self.show_level:
                #new game
                if self.newgame_button.get_rect().collidepoint(clickpoint):
                    #self.currentLevel = 0
                    self.show_level = True
                #load game
                elif self.loadgame_button.get_rect().collidepoint(clickpoint):
                    if os.path.isfile('save'):
                        self.loadLevel = True

                #options
                elif self.options_button.get_rect().collidepoint(clickpoint):
                    self.show_instructions = False
                    self.show_options = True
                #exit
                elif self.quit_button.get_rect().collidepoint(clickpoint):
                    print("Exiting....")
                    sys.exit(0)

                #isntructions
                elif self.instructions_button.get_rect().collidepoint(clickpoint):
                    self.show_options = False
                    self.show_instructions = True

            #Options Menu
            elif self.show_options:
                if self.volup_button.get_rect().collidepoint(clickpoint):
                    #clicked bgm vol up
                    sound.set_bgm_vol(sound.get_bgm_vol() + 10)
                    sys.stdout.write('BGM vol: %s\n' % (sound.get_bgm_vol()))
                elif self.voldown_button.get_rect().collidepoint(clickpoint):
                    #clicked bgm vol down
                    sound.set_bgm_vol(sound.get_bgm_vol() - 10)
                    sys.stdout.write('BGM vol: %s\n' % (sound.get_bgm_vol()))
                elif self.volupFX_button.get_rect().collidepoint(clickpoint):
                    #clicked sfx vol up
                    sound.set_sfx_vol(sound.get_sfx_vol() + 10)
                    sound.play_sfx('sounds/sfx/punch.wav')
                    sys.stdout.write('SFX vol: %s\n' % (sound.get_sfx_vol()))
                elif self.voldownFX_button.get_rect().collidepoint(clickpoint):
                    #clicked sfx vol down
                    sound.set_sfx_vol(sound.get_sfx_vol() - 10)
                    sound.play_sfx('sounds/sfx/punch.wav')
                    sys.stdout.write('SFX vol: %s\n' % (sound.get_sfx_vol()))
                elif self.gammaUp_button.get_rect().collidepoint(clickpoint):
                    #clicked gamma up
                    if self.gamma < 2.5:
                        self.gamma = self.gamma + .1
                    pygame.display.set_gamma(self.gamma)
                    sys.stdout.write('Gamma: %s\n' % (self.gamma))
                elif self.gammaDown_button.get_rect().collidepoint(clickpoint):
                    #clicked gamma down
                    if self.gamma > 0.2:
                        self.gamma = self.gamma - .1
                    pygame.display.set_gamma(self.gamma)
                    sys.stdout.write('Gamma: %s\n' % (self.gamma))
                elif self.options_back_button.get_rect().collidepoint(clickpoint):
                    #clicked back
                    self.show_options = False
            #Options Menu
            elif self.show_level:
                if self.lvltut.get_rect().collidepoint(clickpoint):
                    self.setLevel(0)
                elif self.lvl1.get_rect().collidepoint(clickpoint):
                    self.setLevel(1)
                elif self.lvl2.get_rect().collidepoint(clickpoint):
                    self.setLevel(2)
                elif self.lvl3.get_rect().collidepoint(clickpoint):
                    self.setLevel(3)
                elif self.lvl4.get_rect().collidepoint(clickpoint):
                    self.setLevel(4)
                elif self.lvl5.get_rect().collidepoint(clickpoint):
                    self.setLevel(5)
                
            #if on instructions go back to StartMenu
            else:
                if self.back_button.get_rect().collidepoint(clickpoint):
                    if self.show_instructions:
                        self.show_instructions = False
                    elif self.show_options:
                        self.show_options = False
Esempio n. 10
0
    def update(self):

        evman = eventmanager.get()

        if evman.MOUSE1CLICK != False:
            event = evman.MOUSE1CLICK
            clickpoint = event.pos

            #StartMenu
            if not self.show_instructions and not self.show_options and not self.show_level:
                #new game
                if self.newgame_button.get_rect().collidepoint(clickpoint):
                    #self.currentLevel = 0
                    self.show_level = True
                #load game
                elif self.loadgame_button.get_rect().collidepoint(clickpoint):
                    if os.path.isfile('save'):
                        self.loadLevel = True

                #options
                elif self.options_button.get_rect().collidepoint(clickpoint):
                    self.show_instructions = False
                    self.show_options = True
                #exit
                elif self.quit_button.get_rect().collidepoint(clickpoint):
                    print("Exiting....")
                    sys.exit(0)

                #isntructions
                elif self.instructions_button.get_rect().collidepoint(
                        clickpoint):
                    self.show_options = False
                    self.show_instructions = True

            #Options Menu
            elif self.show_options:
                if self.volup_button.get_rect().collidepoint(clickpoint):
                    #clicked bgm vol up
                    sound.set_bgm_vol(sound.get_bgm_vol() + 10)
                    sys.stdout.write('BGM vol: %s\n' % (sound.get_bgm_vol()))
                elif self.voldown_button.get_rect().collidepoint(clickpoint):
                    #clicked bgm vol down
                    sound.set_bgm_vol(sound.get_bgm_vol() - 10)
                    sys.stdout.write('BGM vol: %s\n' % (sound.get_bgm_vol()))
                elif self.volupFX_button.get_rect().collidepoint(clickpoint):
                    #clicked sfx vol up
                    sound.set_sfx_vol(sound.get_sfx_vol() + 10)
                    sound.play_sfx('sounds/sfx/punch.wav')
                    sys.stdout.write('SFX vol: %s\n' % (sound.get_sfx_vol()))
                elif self.voldownFX_button.get_rect().collidepoint(clickpoint):
                    #clicked sfx vol down
                    sound.set_sfx_vol(sound.get_sfx_vol() - 10)
                    sound.play_sfx('sounds/sfx/punch.wav')
                    sys.stdout.write('SFX vol: %s\n' % (sound.get_sfx_vol()))
                elif self.gammaUp_button.get_rect().collidepoint(clickpoint):
                    #clicked gamma up
                    if self.gamma < 2.5:
                        self.gamma = self.gamma + .1
                    pygame.display.set_gamma(self.gamma)
                    sys.stdout.write('Gamma: %s\n' % (self.gamma))
                elif self.gammaDown_button.get_rect().collidepoint(clickpoint):
                    #clicked gamma down
                    if self.gamma > 0.2:
                        self.gamma = self.gamma - .1
                    pygame.display.set_gamma(self.gamma)
                    sys.stdout.write('Gamma: %s\n' % (self.gamma))
                elif self.options_back_button.get_rect().collidepoint(
                        clickpoint):
                    #clicked back
                    self.show_options = False
            #Options Menu
            elif self.show_level:
                if self.lvltut.get_rect().collidepoint(clickpoint):
                    self.setLevel(0)
                elif self.lvl1.get_rect().collidepoint(clickpoint):
                    self.setLevel(1)
                elif self.lvl2.get_rect().collidepoint(clickpoint):
                    self.setLevel(2)
                elif self.lvl3.get_rect().collidepoint(clickpoint):
                    self.setLevel(3)
                elif self.lvl4.get_rect().collidepoint(clickpoint):
                    self.setLevel(4)
                elif self.lvl5.get_rect().collidepoint(clickpoint):
                    self.setLevel(5)

            #if on instructions go back to StartMenu
            else:
                if self.back_button.get_rect().collidepoint(clickpoint):
                    if self.show_instructions:
                        self.show_instructions = False
                    elif self.show_options:
                        self.show_options = False