all repos — Legends-RPG @ 29279f0d4ae0de678743f8baccb7574024b042e1

A fantasy mini-RPG built with Python and Pygame.

data/main.py (view raw)

 1from data.states.main_menu import main_menu
 2from data.states import shop, levels, battle
 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'
20
21
22def main():
23    """Add states to control here"""
24    run_it = tools.Control(setup.ORIGINAL_CAPTION)
25    state_dict = {MAIN_MENU: main_menu.Menu(),
26                  TOWN: levels.LevelState(TOWN),
27                  CASTLE: levels.LevelState(CASTLE),
28                  HOUSE: levels.LevelState(HOUSE),
29                  OVERWORLD: levels.LevelState(OVERWORLD, True),
30                  BROTHER_HOUSE: levels.LevelState(BROTHER_HOUSE),
31                  INN: shop.Inn(),
32                  ARMOR_SHOP: shop.ArmorShop(),
33                  WEAPON_SHOP: shop.WeaponShop(),
34                  MAGIC_SHOP: shop.MagicShop(),
35                  POTION_SHOP: shop.PotionShop(),
36                  BATTLE: battle.Battle()
37                  }
38
39    run_it.setup_states(state_dict, c.MAIN_MENU)
40    run_it.main()