all repos — Legends-RPG @ 03e23956af527301293a4f59072dddf0e341df8b

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