[[Explore Space|Explore Space 1]]<div class="gameScreen"> <% var _vars = window.setup.variables; %> <% _vars.fuel-- %> <% _vars.numberOfJumpsLeft-- %> [[ Hyperjump |Explore Space 2]] <div id="HUD"> <%= window.story.render("HUD") %> </div> <%= window.story.render("Generate System") %> <div id="display"></div> <%= window.story.render("Display System") %> <%= window.story.render("Check Status") %> </div><div class="gameScreen"> <% var _vars = window.setup.variables; %> <% _vars.fuel-- %> <% _vars.numberOfJumpsLeft-- %> [[ Hyperjump |Explore Space 1]] <div id="HUD"> <%= window.story.render("HUD") %> </div> <%= window.story.render("Generate System") %> <div id="display"></div> <%= window.story.render("Display System") %> <%= window.story.render("Check Status") %> </div><script> var _vars = window.setup.variables; var planets =_.random(1, 4); _vars.system = new Array(planets); for(var i = 0; i < _vars.system.length; i++) { _vars.system[i] = _.sample(["RED", "GREEN"]); } </script><script> var _vars = window.setup.variables; // Wipe out current contents $("#display").html(""); for(var i = 0; i < _vars.system.length; i++) { if(_vars.system[i] == "RED") { var link = $("<a href='#'>RED</a>") .click(function(e) { $( this ) .replaceWith( window.story.render("Show Outcome - Red") ); return false; }); $("#display").append( link ); $("#display").append( "<br>" ); } if(_vars.system[i] == "GREEN") { var link = $("<a href='#'>GREEN</a>") .click(function(e) { $( this ) .replaceWith( window.story.render("Show Outcome - Green") ); return false; }); $("#display").append( link ); $("#display").append( "<br>" ); } } </script><%= window.setup.functions.redOutcome() %> <% $("#HUD").html(window.story.render("HUD")) %> <%= window.story.render("Check Status") %><%= window.setup.functions.greenOutcome() %> <% $("#HUD").html(window.story.render("HUD")) %> <%= window.story.render("Check Status") %>Health: <%= window.setup.variables.health %> <br> Fuel: <%= window.setup.variables.fuel %> <br> Number of Jumps Left: <%= setup.variables.numberOfJumpsLeft %> <br>The ship exploded in flight. <h3>Game Over</h3>Without fuel, the ship tumbled and spun in the endless black. <h3>Game Over</h3>After 10 hyperjumps, the ship left the hazardous area and called for help. <h3>Success!</h3><script> var _vars = window.setup.variables; var status = ""; if(_vars.health <= 0) { status = window.story.render("Destroyed"); } if(_vars.fuel <= 0) { status = window.story.render("Lost in space"); } if(_vars.numberOfJumpsLeft <= 0) { status = window.story.render("Safe"); } if(status != "") { $(".gameScreen").html(status); } </script>