上传文件至 /

RPG样例
This commit is contained in:
2025-05-18 11:48:19 +08:00
Unverified
commit 73212e2605
5 changed files with 288 additions and 0 deletions

31
main.py Normal file
View File

@@ -0,0 +1,31 @@
# main.py
import curses
from menus import main_menu, start_game_menu, settings_menu, credits_menu
from world import game_loop, init_objects
from config import init_colors, player, camera
def main(stdscr):
curses.curs_set(0)
init_colors()
h,w=stdscr.getmaxyx()
height, width = h-1, w
player["x"],player["y"]=0,0
camera["x"],camera["y"] = player["x"]-width//2, player["y"]-height//2
init_objects(width, height)
while True:
choice=main_menu(stdscr)
if choice==-1: break
elif choice==0:
mode=start_game_menu(stdscr)
if mode in (0,1): game_loop(stdscr, width, height)
elif choice==1: settings_menu(stdscr)
elif choice==2: credits_menu(stdscr)
elif choice==3: break
if __name__=="__main__":
curses.wrapper(main)