def __init__(self, logic):
           super().__init__()

           self.logic = logic

           self.create_menu([MenuItem("START WAVE", self.start_stage)],
                         activated_effect=None,
                         selected_effect=ScaleBy(2, duration = 0.5),
                         unselected_effect=Reverse(ScaleBy(2, duration = 0.5)),
                         layout_strategy=fixedPositionMenuLayout([(800, 110)]))
 def __init__( self ):
     super( MainMenu, self ).__init__("TITLE" )
     items = [
         ( MenuItem('Item 1', self.on_quit ) ), 
         ( MenuItem('Item 2', self.on_quit ) ),
         ( MenuItem('Item 3', self.on_quit ) ),
         ( MenuItem('Item 4', self.on_quit ) ),
     ]
     self.create_menu( items, selected_effect=shake(),
                       unselected_effect=shake_back(),
                       layout_strategy=fixedPositionMenuLayout(
                         [(450, 300), (130, 200), (200, 100), (400, 50)]))
Exemplo n.º 3
0
 def __init__(self):
     """
     """
     super(SkillMenu, self).__init__('Skills')
     # Change font size for different menu items.
     self.font_title['font_size']          = 16
     self.font_item['font_size']           = 8
     self.font_item_selected['font_size']  = 10
     items = [(MenuItem('Axe', self.on_quit)), (MenuItem('Bow', self.on_quit)), ]
     self.create_menu(items,
                      selected_effect=shake(),
                      unselected_effect=shake_back(),
                      layout_strategy=fixedPositionMenuLayout([(250, 460), (250, 430)], ))
Exemplo n.º 4
0
    def __init__( self ):
        super( MainMenu, self ).__init__("TITLE" )
        item1 = MenuItem('Item 1', self.on_quit )
        item2 = MenuItem('Item 2', self.on_quit )
        item3 = MenuItem('Item 3', self.on_quit )
        item4 = MenuItem('Item 4', self.on_quit )

        item1.rotation = 45
        item2.rotation = 90
        item3.scale = 2
        item4.scale= 1.5
        item4.rotation = 90

        items = [ item1, item2, item3, item4, ]
        self.create_menu( items,
                          layout_strategy=fixedPositionMenuLayout(
                            [(450, 300), (130, 200), (200, 100), (400, 50)]))
    def __init__(self, logic):
        super().__init__()
        self.logic = logic
        positions = []
        houses = []
        self.cds = []
        
        ############   goblin house    ###################
        house_goblin = ImageMenuItem("resources/goblin_quarters.png",
                                     self.spawn, "goblin", 0)
        house_goblin.scale = house_scale
        houses.append(house_goblin)
        positions.append(spawn_place.get("goblin"))
        self.cds.append(False)

        ############  hobgoblin house  ###################

        house_hobgoblin = ImageMenuItem("resources/hobgoblin_quarters.png",
                                        self.spawn, "hobgoblin", 1)
        house_hobgoblin.scale = house_scale
        houses.append(house_hobgoblin)
        positions.append(spawn_place.get("hobgoblin"))
        cd_hobgoblin = False
        self.cds.append(False)

        ############     orc  house    ###################

        house_orc = ImageMenuItem("resources/orc_quarters.png",
                                  self.spawn, "orc", 2)
        house_orc.scale = house_scale
        houses.append(house_orc)
        positions.append(spawn_place.get("orc"))
        cd_orc = False
        self.cds.append(False)

        ############  madgnome house   ##################

        house_madgnome = ImageMenuItem("resources/madgnome_quarters.png",
                                       self.spawn, "madgnome", 3)
        house_madgnome.scale = house_scale
        houses.append(house_madgnome)
        positions.append(spawn_place.get("madgnome"))
        cd_madgnome = False
        self.cds.append(False)

        ############ necromancer house ###################

        house_necromancer = ImageMenuItem("resources/necromancer_quarters.png",
                                          self.spawn, "necromancer", 4)
        house_necromancer.scale = house_scale
        houses.append(house_necromancer)
        positions.append(spawn_place.get("necromancer"))
        cd_necromancer = False
        self.cds.append(False)

        ############  gatherer  house  ###################

        house_gatherer = ImageMenuItem("resources/gatherer_quarters.png",
                                       self.spawn, "gatherer", 5)
        house_gatherer.scale = house_scale
        houses.append(house_gatherer)
        positions.append(spawn_place.get("gatherer"))
        cd_gatherer = False
        self.cds.append(False)

        ############   miner   house   ###################

        house_miner = ImageMenuItem("resources/miner_quarters.png",
                                     self.spawn, "miner", 6)
        house_miner.scale = house_scale
        houses.append(house_miner)
        positions.append(spawn_place.get("miner"))
        cd_miner = False
        self.cds.append(False)

        ###########   minion    help   ###################
        minion_help = ImageMenuItem("resources/minion_help.png",
                                    director.push, Scene(SoldiersLayer()))
        minion_help.scale = 4
        houses.append(minion_help)
        positions.append((1500, 810))

        ###########   hero    help     ###################
        hero_help = ImageMenuItem("resources/hero_help.png",
                                    director.push, Scene(HuntersLayer()))
        hero_help.scale = 3.5
        houses.append(hero_help)
        positions.append((1350, 820))

        ############    create menu    ###################

        self.create_menu(houses,
                         activated_effect=self.shake(),
                         selected_effect=None,
                         unselected_effect=None,
                         layout_strategy=fixedPositionMenuLayout(positions))
Exemplo n.º 6
0
    def __init__(self):
        from cocos.director import director
        from cocos.menu import ImageMenuItem, fixedPositionMenuLayout
        from math import floor
        from pyglet.resource import location
        
        super(InventoryMenu, self).__init__('Inventory')
        #self.select_sound = soundex.load('move.mp3')
        
        width, height = director.window.get_size()
        
        self.rows = 8
        self.columns = 10
        self.item_width = width / self.columns
        self.item_height = height / self.rows

        # you can override the font that will be used for the title and the items
        self.font_title['font_name'] = 'Times New Roman'
        self.font_title['font_size'] = 32
        self.font_title['color'] = (204,164,164,255)

        self.font_item['font_name'] = 'Times New Roman'
        self.font_item['color'] = (128,128,128,255)
        self.font_item['font_size'] = 32
        self.font_item_selected['font_name'] = 'Times New Roman'
        self.font_item_selected['color'] = (255,255,255,255)
        self.font_item_selected['font_size'] = 32

        # you can also override the font size and the colors. see menu.py for
        # more info

        # example: menus can be vertical aligned and horizontal aligned
        self.menu_anchor_y = 'center'
        self.menu_anchor_x = 'center'
        
        items = ['colt_45.png'] * 70
        menu_items = []
        item_positions = []
        
        for index, item in enumerate(items):
            menu_items.append(ImageMenuItem(item, self.new_game))
            print(((index % self.columns) * self.item_width) + (self.item_width / 2), height - ((floor(index / self.rows) + 1) * self.item_height) - (self.item_height / 2))
            item_positions.append((
                ((index % self.columns) * self.item_width) + (self.item_width / 2),
                height - ((floor(index / self.columns) + 1) * self.item_height) - (self.item_height / 2),
            ))
        
        print(menu_items)
        print(item_positions)
        
        

        #self.volumes = ['Mute','10','20','30','40','50','60','70','80','90','100']

        #items.append( MultipleMenuItem(
                        #'SFX volume: ', 
                        #self.on_sfx_volume,
                        #self.volumes,
                        #int(soundex.sound_vol * 10) )
                    #)
        #items.append( MultipleMenuItem(
                        #'Music volume: ', 
                        #self.on_music_volume,
                        #self.volumes,
                        #int(soundex.music_player.volume * 10) )
                    #)
        #items.append( ToggleMenuItem('Show FPS:', self.on_show_fps, director.show_FPS) )
        #items.append( MenuItem('Fullscreen', self.on_fullscreen) )
        #items.append( MenuItem('Back', self.on_quit) )
        self.create_menu(menu_items, shake(), shake_back(),
                         layout_strategy=fixedPositionMenuLayout(item_positions))