Esempio n. 1
0
def newmain(debug=True,hero_ini_pos1=(0,0),mappa='betatest.tmx',inizia_con_menu=True):
    oggetto=Motore(resolution=(800,600),miodebug=debug,hero_ini_pos=hero_ini_pos1,mappa=mappa,inizia_con_menu=True)
    iconimg=".\immagini\\icona2.gif"
    if sys.platform=='linux2':
        iconimg=iconimg.replace('\\', '/');
    icon=pygame.image.load(iconimg)
    pygame.display.set_icon(icon)
    gummworld2.run(oggetto)
    return oggetto
Esempio n. 2
0
def miomain(debug=True,hero_ini_pos1=(0,0)):
    oggetto=Motore(resolution=(800,600),miodebug=debug,hero_ini_pos=hero_ini_pos1,mappa='casa_gioco.tmx')
    iconimg=".\immagini\\icona2.gif"
    if sys.platform=='linux2':
        iconimg=iconimg.replace('\\', '/');
    icon=pygame.image.load(iconimg)
    #icon=pygame.image.load(".\immagini\\icona2.gif")
    pygame.display.set_icon(icon)
    gummworld2.run(oggetto)
    return oggetto
 def run(self):
    self.gameSounds.playmenu(True,1.0)
    scr_menu = main_menu.main_menu(self.parameters)
    scr_menu.setScreen(self.screen,30)
    scr_menu.constructScene()
    ret = 0
    while True:
       if(ret == 0):
          ret = scr_menu.run()
       if(ret == 1):
          self.gameSounds.playmenu(False,1.0)
          print("LET'S PLAY FMM!!")  
          scr_game = game_engine.gameEngine(self.parameters,self.gameSounds)
          print('in game!!')
          gummworld2.run(scr_game)
          print('out of game!!')
          ret = 0
          self.gameSounds.playmenu(True,1.0)

       else:
          self.gameSounds.playmenu(False,1.0)
          print("EXITING FMM!!")
          pygame.quit()
          sys.exit()		
Esempio n. 4
0
        avatar = camera.target
        camera.surface.blit(avatar.image, avatar.screen_position)
    
    def set_fog(self, n):
        self.fog = self.fogs[n%len(self.fogs)]
        self.fog_rect = self.fog.get_rect(center=State.screen.center)
        return n
    
    def on_mouse_button_down(self, pos, button):
        self.mouse_down = True
    
    def on_mouse_button_up(self, pos, button):
        self.mouse_down = False
    
    def on_key_down(self, unicode, key, mod):
        # Turn on key-presses.
        if key == K_SPACE:
            self.fogn = self.set_fog(self.fogn+1)
        elif key == K_ESCAPE:
            context.pop()
    
    def on_quit(self):
        context.pop()
        
    # App.on_quit


if __name__ == '__main__':
    app = App()
    gummworld2.run(app)
def main():
    app = App()
    gummworld2.run(app)
 def run_it():
     gummworld2.run(app)
Esempio n. 7
0
def start_context():
    gummworld2.run(terrain.TerrainLoader(*settings.map_size))
    quit()
Esempio n. 8
0
 def run (self):
     gummworld2.run(self.oggetto)
Esempio n. 9
0
        State.camera.update(dt)
        self.visible_objects = toolkit.get_object_array()
    
    def draw(self, interp):
        State.screen.clear()
        toolkit.draw_object_array(self.visible_objects)
        State.screen.flip()

    def on_key_down(self, unicode, key, mod):
        if key == K_DOWN: self.movey += State.speed
        elif key == K_UP: self.movey += -State.speed
        elif key == K_RIGHT: self.movex += State.speed
        elif key == K_LEFT: self.movex += -State.speed
        elif key == K_ESCAPE: context.pop()
    
    def on_key_up(self, key, mod):
        if key == K_DOWN: self.movey -= State.speed
        elif key == K_UP: self.movey -= -State.speed
        elif key == K_RIGHT: self.movex -= State.speed
        elif key == K_LEFT: self.movex -= -State.speed
    
    def on_quit(self):
        ## Pop the top context, which is self. This exits the program because it
        ## is the last context on the stack.
        context.pop()


if __name__ == '__main__':
    menu = MainMenu()
    gummworld2.run(menu)