How to use it - Ryue/RedEyesDungeonCrawlerEngine GitHub Wiki
How to use the dungeon crawler engine
Important notes
- The downloadable project comes with options.rpy, screens.rpy and script.rpy if you want to have your original screens options and script files after integrating the crawler into your project, make sure that these 3 files of the crawler are deleted before you integrate it into your project (as described below).
Integration of the dungeon crawler
-
Download the sourcecode and then unpack or copy it so that it's root lies in your game folder. As example if you have a game named myGame which is located in C:\games then the root folder of the dungeon crawler engine should be in c:\games\myGame\game
-
If you use your original files for option.rpy, .... instead of the ones in this project make sure that the following lines are in options.rpy:
config.screen_width = 1366
config.screen_height = 768
This makes sure that the dungeon crawler is displayed correctly, as it is designed for this screen resolution (even though it SHOULD work for lesser resolutions that is so far not tested).
Starting the engine
The engine can be started from your script whenever you wish to. You can always "end" it by just jumping outside of the code that runs the engine.
For the engine to be started just add the following code below wherever you wish:
init:
screen crawlMove: # This defines a small interface for movement
# Sets up the numpad controls to move the player when pressed
key "K_KP8" action Return(value='F')
key "K_KP6" action Return(value='R')
key "K_KP2" action Return(value='B')
key "K_KP4" action Return(value='L')
fixed:
# Displays the arrow buttons to move the player when clicked
textbutton "↑" action Return(value='F') xcenter .5 ycenter .34
textbutton "→" action Return(value='R') xcenter .57 ycenter .47
textbutton "↓" action Return(value='B') xcenter .5 ycenter .6
textbutton "←" action Return(value='L') xcenter .43 ycenter .47
label startEngine:
python:
# Instantiate the Dungeon Crawl 3D engine
dungeonCrawl3DEngine = ClsDungeonCrawl3DEngine()
# Load the specified map file from "Data/Maps/"
dungeonCrawl3DEngine.viewCurrentMap = "mytest"
# Initialize the starting coordinates and direction
crawlMoveCommand = 0
dungeonCrawl3DEngine.viewX = 4
dungeonCrawl3DEngine.viewY = 2
dungeonCrawl3DEngine.viewDir = 0
# Loop forever
while (1):
python:
# Render the scene using the Dungeon Crawl 3D Engine
renpy.scene()
dungeonCrawl3DEngine.RenderView()
# Check for user input, and move accordingly
crawlMoveCommand = renpy.call_screen("crawlMove")
if (crawlMoveCommand == 'F'):
dungeonCrawl3DEngine.MoveForward()
elif (crawlMoveCommand == 'B'):
dungeonCrawl3DEngine.MoveBackward()
elif (crawlMoveCommand == 'L'):
dungeonCrawl3DEngine.MoveTurnLeft()
elif (crawlMoveCommand == 'R'):
dungeonCrawl3DEngine.MoveTurnRight()
Editing the content of the crawler
The content of the crawler can be edited with ease. The different sections below describe how each part can be edited.