all repos — Legends-RPG @ a452513181f1eef80107430ce479b678dc2fa21c

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'
24
25
26def main():
27    """Add states to control here"""
28    run_it = tools.Control(setup.ORIGINAL_CAPTION)
29    state_dict = {MAIN_MENU: main_menu.Menu(),
30                  TOWN: levels.LevelState(TOWN),
31                  CASTLE: levels.LevelState(CASTLE),
32                  HOUSE: levels.LevelState(HOUSE),
33                  OVERWORLD: levels.LevelState(OVERWORLD, True),
34                  BROTHER_HOUSE: levels.LevelState(BROTHER_HOUSE),
35                  INN: shop.Inn(),
36                  ARMOR_SHOP: shop.ArmorShop(),
37                  WEAPON_SHOP: shop.WeaponShop(),
38                  MAGIC_SHOP: shop.MagicShop(),
39                  POTION_SHOP: shop.PotionShop(),
40                  BATTLE: battle.Battle(),
41                  DUNGEON: levels.LevelState(DUNGEON, True),
42                  DUNGEON2: levels.LevelState(DUNGEON2, True),
43                  DUNGEON3: levels.LevelState(DUNGEON3, True),
44                  DUNGEON4: levels.LevelState(DUNGEON4, True),
45                  DUNGEON5: levels.LevelState(DUNGEON5, True)
46                  }
47
48    run_it.setup_states(state_dict, c.MAIN_MENU)
49    run_it.main()