PageRenderTime 59ms CodeModel.GetById 37ms RepoModel.GetById 1ms app.codeStats 0ms

/index.html

https://github.com/triptych/Foobar-The-Bazbarian
HTML | 279 lines | 78 code | 3 blank | 198 comment | 0 complexity | 265fbe799acf3d4a03b7b17f00010209 MD5 | raw file
  1. <HTML>
  2. <HEAD>
  3. <TITLE>FOOBAR! The Bazbarian</TITLE>
  4. </HEAD>
  5. <BODY BGCOLOR="#FFFFFF" onLoad="initgame()">
  6. <script language="JavaScript">
  7. <!-- The Engine
  8. //variable declarations
  9. var mylocation="0"
  10. var locDesc= new StringArray(16)
  11. var zero=0
  12. var bonus="10"
  13. locDesc[0]='You are standing at the edge of a small island. Palm trees sprout everywhere and obscure your view to the East and South. The beach is bordered on the North and West'
  14. locDesc[1]='The beach is to the West. You see the remains of your wrecked ship here. The forest is to the East and the beach goes North and South.'
  15. locDesc[2]='The beach is West of you. At the edge of the forest stands a silver cage with a beautiful princess who becons for you to unlock the cage.'
  16. locDesc[3]='The beach laps at you from the West and South. The palm trees to the North and East sway in the wind. You hear screaming to the North.'
  17. locDesc[4]='The ocean borders the North. On the beach you see empty coke cans and various other washed up trash. '
  18. locDesc[5]='You are surrounded by palm trees. A monkey waves a you. You hear screaming to the South.'
  19. locDesc[6]='In a clearing, you see a golden cage with a georgeous princess waving at you. She begs you to find the key and let her free.'
  20. locDesc[7]='The beach borders to the South. There are graves here with names of other warriors like yourself who failed...'
  21. locDesc[8]='The beach borders the North end of the island. The wind blows fiercer here.'
  22. locDesc[9]='You are in the midst of palms. Footprints dot the sand in all directions.'
  23. locDesc[10]='A woman screams to the West. Sharp rocks hurt your bare feet as you wander...'
  24. locDesc[11]='The beach borders the Southern end of the island. You hear a strange sound to the East, like a storm in the distance.'
  25. locDesc[12]='You see a chest full of gold, jewels and many other things. Your search reveals....'
  26. locDesc[13]='The beach stops you short to East. There are the remains of a campfire here.'
  27. locDesc[14]='Bones litter the beach to the East. They look human. You hear a sound like rushing wind to the South. Palms trees obscure your view.'
  28. locDesc[15]='A large green Dragon turns to look at you as you enter the clearing. Its growl is like a Mac Truck stuck in high gear.'
  29. // functions
  30. function StringArray (n) {
  31. this.length = n;
  32. for (var i = 1; i <= n; i++) {
  33. this[i] = ''
  34. }
  35. return this
  36. }
  37. function initgame(){
  38. var intro = "Welcome to Foobar the Bazbarian! \r\nClick on buttons to navigate\r\nClick RESET to start over\r"
  39. document.forms[0].dialogbox.value=intro+locDesc[0]
  40. document.forms[5].score.value=zero
  41. document.forms[5].itemhere.value="None"
  42. document.forms[5].your1.value="Empty"
  43. document.forms[5].your2.value="Empty"
  44. document.forms[5].your3.value="Empty"
  45. document.forms[5].your4.value="Empty"
  46. mylocation=0
  47. }
  48. function upscore(addscore){
  49. oldscore=document.forms[5].score.value;
  50. num1=parseFloat(addscore);
  51. num2=parseFloat(oldscore);
  52. newscore=num1 + num2;
  53. document.forms[5].score.value=newscore
  54. }
  55. function changeLocation(index){
  56. force=parseFloat(mylocation) + parseFloat(index);
  57. mylocation=force;
  58. if (mylocation==0){
  59. document.forms[0].dialogbox.value=locDesc[0];
  60. document.forms[5].itemhere.value="None";
  61. }
  62. if (mylocation==1){
  63. document.forms[0].dialogbox.value=locDesc[1];
  64. document.forms[5].itemhere.value="None";
  65. }
  66. if (mylocation==2){
  67. document.forms[0].dialogbox.value=locDesc[2];
  68. document.forms[5].itemhere.value="None";
  69. }
  70. if (mylocation==3){
  71. document.forms[0].dialogbox.value=locDesc[3];
  72. document.forms[5].itemhere.value="None";
  73. }
  74. if (mylocation==10){
  75. document.forms[0].dialogbox.value=locDesc[4];
  76. document.forms[5].itemhere.value="None";
  77. }
  78. if (mylocation==11){
  79. document.forms[0].dialogbox.value=locDesc[5];
  80. document.forms[5].itemhere.value="None";
  81. }
  82. if (mylocation==12){
  83. document.forms[0].dialogbox.value=locDesc[6];
  84. document.forms[5].itemhere.value="None";
  85. }
  86. if (mylocation==13){
  87. document.forms[0].dialogbox.value=locDesc[7];
  88. document.forms[5].itemhere.value="None";
  89. }
  90. if (mylocation==20){
  91. document.forms[0].dialogbox.value=locDesc[8];
  92. document.forms[5].itemhere.value="None";
  93. }
  94. if (mylocation==21){
  95. document.forms[0].dialogbox.value=locDesc[9];
  96. document.forms[5].itemhere.value="None";
  97. }
  98. if (mylocation==22){
  99. document.forms[0].dialogbox.value=locDesc[10];
  100. document.forms[5].itemhere.value="None";
  101. }
  102. if (mylocation==23){
  103. document.forms[0].dialogbox.value=locDesc[11];
  104. document.forms[5].itemhere.value="None";
  105. }
  106. if (mylocation==30){
  107. document.forms[0].dialogbox.value=locDesc[12];
  108. document.forms[5].itemhere.value="Key";
  109. }
  110. if (mylocation==31){
  111. document.forms[0].dialogbox.value=locDesc[13];
  112. document.forms[5].itemhere.value="None";
  113. }
  114. if (mylocation==32){
  115. document.forms[0].dialogbox.value=locDesc[14];
  116. document.forms[5].itemhere.value="None";
  117. }
  118. if (mylocation==33){
  119. document.forms[0].dialogbox.value=locDesc[15];
  120. document.forms[5].itemhere.value="None";
  121. pit();
  122. }
  123. if (mylocation != 0 && mylocation != 1 && mylocation != 2 && mylocation != 3 &&
  124. mylocation !=10 && mylocation !=11 && mylocation !=12 && mylocation !=13 &&
  125. mylocation !=20 && mylocation !=21 && mylocation !=22 && mylocation !=23 &&
  126. mylocation !=30 && mylocation !=31 && mylocation !=32 && mylocation !=33 )
  127. {
  128. alert ("You cant go there! The water blocks your way.");
  129. mylocation=parseFloat(mylocation) - parseFloat(index);
  130. }
  131. //alert(force + " and location" + location);
  132. }
  133. function takeItem(){
  134. if (document.forms[5].itemhere.value != "None") {
  135. document.forms[5].your1.value=document.forms[5].itemhere.value;
  136. upscore(bonus);
  137. document.forms[5].itemhere.value = "None";
  138. }
  139. else {
  140. alert("There's nothing here!")
  141. }
  142. }
  143. function useItem(itemtouse) {
  144. if (itemtouse == "Key" && mylocation == 2) {
  145. document.forms[0].dialogbox.value="You Win! The Princess gives you a big Kiss, and Hillary reluctantly returns you to the land of Bat....\rYAY!"
  146. upscore(1000);
  147. }
  148. else {
  149. if (itemtouse == "Key" && mylocation == 12) {
  150. document.forms[0].dialogbox.value="You picked the wrong Princess. The Witch cackles as she shoots a bolt of flame at your head. You Die!"
  151. document.forms[5].score.value=zero
  152. }
  153. else{
  154. alert ("I cannot use that here");
  155. }}
  156. }
  157. function pit() {
  158. document.forms[0].dialogbox.value=document.forms[0].dialogbox.value + "\rDid I forget to mention the Dragon? Oops. This huge monster thunders up and takes a big bite out of your face. You die."
  159. document.forms[5].score.value=zero
  160. }
  161. // end Functions
  162. // end The Engine -->
  163. </script>
  164. <h1 align=center>Foobar the Bazbarian! v0.02a</h1>
  165. <table border align=left>
  166. <tr>
  167. <td colspan=2>
  168. <form>
  169. <!-- form 0 -->
  170. <textarea rows="15" cols="50" name="dialogbox" wrap="virtual">
  171. </textarea>
  172. </form>
  173. <tr>
  174. <td>
  175. <h4 align="center">Movement</h4>
  176. <table border >
  177. <tr>
  178. <td></td>
  179. <td>
  180. <form>
  181. <!-- form 1 -->
  182. <input type="button" Value="North" Name="GoNorth" onClick="changeLocation(-1)">
  183. </form>
  184. </td>
  185. <td></td>
  186. <tr>
  187. <td>
  188. <form>
  189. <!-- form 2 -->
  190. <input type="button" Value="West" Name="GoWest" onClick="changeLocation(-10)">
  191. </form>
  192. </td>
  193. <td align=center><B>GO</B></td>
  194. <td>
  195. <form>
  196. <!-- form 3 -->
  197. <input type="button" Value="East" Name="GoEast" onClick="changeLocation(10)">
  198. </form>
  199. </td>
  200. <tr>
  201. <td>
  202. <tr>
  203. <td></td>
  204. <td>
  205. <form>
  206. <!-- form 4 -->
  207. <input type="button" Value="South" Name="GoSouth" onClick="changeLocation(1)">
  208. </form>
  209. </td>
  210. <td></td>
  211. </table>
  212. <td valign=top>
  213. <form>
  214. <!-- form 5 -->
  215. Your Score: <input type="text" name="score"><br>
  216. Items Here: <input type="text" name="itemhere"><br>
  217. Your Items:<br>
  218. <input type="text" name="your1"><input type="button" Value="USE" Name="use1" onClick="useItem(document.forms[5].your1.value)"><br>
  219. <input type="text" name="your2"><input type="button" Value="USE" Name="use2" onClick="useItem(document.forms[5].your2.value)"><br>
  220. <input type="text" name="your3"><input type="button" Value="USE" Name="use3" onClick="useItem(document.forms[5].your3.value)"><br>
  221. <input type="text" name="your4"><input type="button" Value="USE" Name="use4" onClick="useItem(document.forms[5].your4.value)"><br>
  222. <input type="button" Value="TAKE ITEM" name="takeme" onClick="takeItem()">
  223. <input type="button" Value="QUIT" name="quitme" onClick="history.go(-1)">
  224. <input type="button" Value="RESET" name="resetme" onClick="initgame()">
  225. </form>
  226. </table>
  227. <p>
  228. <font size="-1">Created and copyright Andrew Wooldridge(andrew@andrewwooldridge.com)</font><p>
  229. <hr align="50%">
  230. You are FOOBAR, the Bazbarian from the land of Bat.
  231. You and the Princess of Zfoeps have been kidnapped by the Wicked
  232. Witch Hillary. As a challenge, Hillary has imprisoned herself
  233. and the Princess in two cages.
  234. You must search this small island to free the Princess!
  235. Search around and find the key to unlock her cage.
  236. If you let out the wrong girl you die! If you
  237. free the Princess you win!
  238. Click RESET to Start. <br clear=left>
  239. </BODY>
  240. </HTML>