all repos — Legends-RPG @ 2ded5c74f1c07582e76cc562f5d3027c49637745

A fantasy mini-RPG built with Python and Pygame.

data/main.py (view raw)

 1from data.states import shop, levels, battle, main_menu
 2from . import setup, tools
 3from . import constants as c
 4
 5
 6TOWN = 'town'
 7MAIN_MENU = 'main menu'
 8CASTLE = 'castle'
 9HOUSE = 'house'
10INN = 'Inn'
11ARMOR_SHOP = 'armor shop'
12WEAPON_SHOP = 'weapon shop'
13MAGIC_SHOP = 'magic shop'
14POTION_SHOP = 'potion shop'
15PLAYER_MENU = 'player menu'
16OVERWORLD = 'overworld'
17BROTHER_HOUSE = 'brotherhouse'
18BATTLE = 'battle'
19DUNGEON = 'dungeon'
20DUNGEON2 = 'dungeon2'
21DUNGEON3 = 'dungeon3'
22DUNGEON4 = 'dungeon4'
23DUNGEON5 = 'dungeon5'
24INSTRUCTIONS = 'instructions'
25
26
27def main():
28    """Add states to control here"""
29    run_it = tools.Control(setup.ORIGINAL_CAPTION)
30    state_dict = {MAIN_MENU: main_menu.Menu(),
31                  TOWN: levels.LevelState(TOWN),
32                  CASTLE: levels.LevelState(CASTLE),
33                  HOUSE: levels.LevelState(HOUSE),
34                  OVERWORLD: levels.LevelState(OVERWORLD, True),
35                  BROTHER_HOUSE: levels.LevelState(BROTHER_HOUSE),
36                  INN: shop.Inn(),
37                  ARMOR_SHOP: shop.ArmorShop(),
38                  WEAPON_SHOP: shop.WeaponShop(),
39                  MAGIC_SHOP: shop.MagicShop(),
40                  POTION_SHOP: shop.PotionShop(),
41                  BATTLE: battle.Battle(),
42                  DUNGEON: levels.LevelState(DUNGEON, True),
43                  DUNGEON2: levels.LevelState(DUNGEON2, True),
44                  DUNGEON3: levels.LevelState(DUNGEON3, True),
45                  DUNGEON4: levels.LevelState(DUNGEON4, True),
46                  DUNGEON5: levels.LevelState(DUNGEON5, True),
47                  INSTRUCTIONS: main_menu.Instructions()
48                  }
49
50    run_it.setup_states(state_dict, c.MAIN_MENU)
51    run_it.main()