A room might check scene settings like this:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enumerate start = 1 step * 2 | |
{ | |
START, JOURNEY, EXPLODED_DYNAMITE, END | |
} | |
room start_room "Start Room" | |
{ | |
long_desc | |
{ | |
if Seen(EXPLODED_DYNAMITE) | |
"This place is in shambles now that you exploded all that dynamite!" | |
else | |
"Wow, this place is pristine." | |
} | |
} |
And here is the actual scene routines and code:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! example linear game scenes | |
!enumerate start = 1 | |
!{ | |
! FIRST_SCENE, SECOND_SCENE, THIRD_SCENE, FINALE | |
!} | |
! example unordered scene game (must also #set UNORDERED_SCENES) | |
!enumerate start = 1 step * 2 | |
!{ | |
! START, PATH1, PATH2, PATH3, PATH4, END | |
!} | |
#set SCENE_MANAGER | |
#set UNORDERED_SCENES | |
#ifset SCENE_MANAGER | |
#ifset UNORDERED_SCENES | |
global current_scene | |
#endif | |
global scene | |
routine Seen(obj) ! returns true if the given scene has been "seen" yet | |
{ | |
#ifset UNORDERED_SCENES | |
if (scene & obj) | |
return true | |
#else | |
if scene => obj | |
return true | |
#endif | |
} | |
routine CurrentScene ! returns the value of current_scene or the scene variables | |
{ | |
#ifset UNORDERED_SCENES | |
return current_scene | |
#else | |
return scene | |
#endif | |
} | |
routine SetScene(obj) ! changes the scene (or current_scene if using UNORDERED_SCENES) variable to obj | |
{ | |
#ifset UNORDERED_SCENES | |
current_scene = obj | |
scene = scene | obj | |
#else | |
scene = obj | |
#endif | |
} | |
#endif ! ifset SCENE_MANAGER |
Anyhow, not sure how useful this will be to most people so I probably won't add it to Roodylib, but there it is!
No comments:
Post a Comment