all repos — Legends-RPG @ c666912709c1be04f7a58a227cd1f51be896ddb9

A fantasy mini-RPG built with Python and Pygame.

data/main.py (view raw)

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