all repos — Legends-RPG @ c57c1c05921f6ba261246fdfa0f1c7a48b8127c5

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