View Full Version : adventure game
01-20-2009, 07:25 AM
You are standing on a large rock overlooking a huge mountain range in northern Georgia. The ground below, in front of you, is 500 feet down.
2) Reconsider your "plans"
3) sit down and meditate
and if you select 2) it'll say:
"Good grief, what were you thinking, considering jumping off that rock! Of course you don't want to do that... but now what do you want to do?"
Oh, I'll also need to save items, but I figure I can do that with if/else and variables... by saving items I mean, you get a key and when you are standing in front of a locked door, it gives you the option to use the key, when when you don't have the key, and you're standing in front of the same door, it doesn't show you that option.
thanks if anyone doesn't mind giving me a few pointers.
01-20-2009, 08:04 AM
You should be able to get the basic commands/concepts from this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
case "jump" :
msg = "Good grief, what were you thinking, considering jumping off that rock! Of course you don\'t want to do that... but now what do you want to do?";
case "reconsider" :
msg = "That might be a good idea...";
case "meditate" :
msg = "You don\'t have nearly enough time for that!";
<h3>You are standing on a large rock overlooking a huge mountain range in northern Georgia. The ground below, in front of you, is 500 feet down.</h3>
<input class="act_btn" type="button" value="jump" onclick="take_action('jump')" /><br />
<input class="act_btn" type="button" value="reconsider your plans" onclick="take_action('reconsider')" /><br />
<input class="act_btn" type="button" value="sit down and meditate" onclick="take_action('meditate')" /><br />
01-20-2009, 03:00 PM
Thanks! This is simple enough for me to understand, but what if I wanted to update the text on that page instead of showing it in alert messages? Like this: http://geocities.com/stalepie/game1.htm. The first one, "jump," takes you to a different page. The effect is right, but I didn't want to do my game like this, on many different pages. (The reason I'm not just doing it in HTML is because it needs to have item management).
That's much more complicated than what I'm doing however. It's more like Zork.
01-20-2009, 03:24 PM
'itsallkizza's code should be easy enough to modify to write an 'document.getElementById('ScreenMessage').innerHTML=msg'
to some <DIV id="ScreenMessage"> or <SPAN id="ScreenMessage"> area on the screen to replace the alerts.
I have a confusion point on this statement:
The first one, "jump," takes you to a different page. The effect is right, but I didn't want to do my game like this, on many different pages. (The reason I'm not just doing it in HTML is because it needs to have item management).
How do you expect to 'jump' to a different page when you don't want to do it "on many different pages" in HTML? :eek:
Seem like "What we have here is a failure to communicate." (Strother Martin to Paul Newman in "Cool Hand Luke") :)
01-20-2009, 03:38 PM
Oh, I do want to keep it all on one page. I meant that, if I weren't having to deal with items in the game, like keys, objects you pick up and use, etc., then I would just write everything in HTML, either doing multiple pages, or a maze of html anchors (jumping you up and down a single page).
01-20-2009, 03:49 PM
You need to
b) framework your site on paper before getting down and dirty with the code
I wish you luck in your game creation :)
01-20-2009, 04:16 PM