test.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <html>
  2. <head>
  3. <style>
  4. body {
  5. background-color: black;
  6. margin: 0;
  7. padding: 0;
  8. }
  9. .container {
  10. position: relative;
  11. width: 1000px;
  12. height: 500px;
  13. left: 50%;
  14. margin-left: -500px;
  15. }
  16. .scribble-canvas {
  17. z-index: 500;
  18. position: absolute;
  19. left: 0px;
  20. top: 0px;
  21. }
  22. .backing {
  23. background-color:white;
  24. width:1000px;
  25. height: 500px;
  26. position:absolute;
  27. left:0px;
  28. top:0px;
  29. }
  30. #controls {
  31. position: fixed;
  32. top: 10px;
  33. left: 10px;
  34. z-index: 999;
  35. }
  36. #controls button {
  37. float: left;
  38. background-color: gray;
  39. }
  40. #controls button.active {
  41. background-color: orange;
  42. }
  43. .overlay {
  44. position:absolute;
  45. left: 0px;
  46. top: 0px;
  47. width: 1000px;
  48. height: 500px;
  49. z-index: 600;
  50. /* font-size: 50px; */
  51. /* color: red; */
  52. /* text-align: center; */
  53. /* margin-top: 200px; */
  54. }
  55. /* loading screen */
  56. .loadscreen {
  57. width: 1000px;
  58. display: block;
  59. margin: 0 auto;
  60. }
  61. .shading1 {
  62. width: 450px;
  63. height: 500px;
  64. background: linear-gradient(to right, rgba(0,0,0,1), rgba(0,0,0,0));
  65. position: absolute;
  66. top: 0;
  67. left: 0;
  68. }
  69. .shading2 {
  70. width: 350px;
  71. height: 500px;
  72. background: linear-gradient(to left, rgba(0,0,0,1), rgba(0,0,0,0));
  73. position: absolute;
  74. right: 0;
  75. top: 0;
  76. }
  77. .instructions {
  78. width: 300px;
  79. position: absolute;
  80. top: 200px;
  81. left: 50%;
  82. text-align: center;
  83. font-size: 20px;
  84. font-family: sans-serif;
  85. color: rgb(92, 30, 10);
  86. margin-left: -155px;
  87. }
  88. .instructions > h2 {
  89. font-size: 19pt;
  90. }
  91. .loading, .play {
  92. font-family: sans-serif;
  93. position: absolute;
  94. top: 430px;
  95. width: 100%;
  96. font-size: 20px;
  97. text-align: center;
  98. }
  99. .loadbar {
  100. width: 250px;
  101. height: 15px;
  102. border: 2px solid white;
  103. background-color: white;
  104. position: absolute;
  105. top: 460px;
  106. left: 50%;
  107. margin-left: -125px;
  108. border-radius: 4px;
  109. }
  110. .loading-progress {
  111. width: 1%;
  112. height: 100%;
  113. background-color: blue;
  114. }
  115. .winImage {
  116. position: absolute;
  117. top: -115px;
  118. }
  119. .winnerbox {
  120. width: 400px;
  121. height: 200px;
  122. background-color: lightblue;
  123. position: absolute;
  124. top: 150px;
  125. left: 300px;
  126. border-radius: 0 0 10px 10px;
  127. font-family: sans-serif;
  128. padding-top: 30px;
  129. }
  130. h1 {
  131. text-align: center;
  132. font-size: 30pt;
  133. color: brown;
  134. margin: 40px;
  135. }
  136. .winnerbox .instructions {
  137. top: 100px;
  138. }
  139. .winnerbox .instructions2 {
  140. top: 100px;
  141. width: 400px;
  142. text-align: center;
  143. font-size: 20px;
  144. font-family: sans-serif;
  145. color: rgb(92, 30, 10);
  146. position: absolute;
  147. }
  148. .winnerbox .play {
  149. top: 150px;
  150. }
  151. .shadow {
  152. background-color: #000000;
  153. opacity: .5;
  154. }
  155. </style>
  156. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
  157. <script>
  158. function pt(x,y) {
  159. return {x: x, y: y};
  160. }
  161. function ptc(p) {
  162. return {x: p.x, y: p.y};
  163. }
  164. function rect(top, bottom, left, right) {
  165. return {t: top, b: bottom, l: left, r: right};
  166. }
  167. function rectc(r) {
  168. return {t: r.t, b: r.b, l: r.l, r: r.r};
  169. }
  170. </script>
  171. <script src="splash.js"></script>
  172. <script src="waves.js"></script>
  173. <script src="mud.js"></script>
  174. <script src="otter.js"></script>
  175. <script src="kelp.js"></script>
  176. <script src="sea_urchn_animal.js"></script>
  177. <script src="seaweed.js"></script>
  178. <script src="collisions.js"></script>
  179. <script src="hud.js"></script>
  180. <script src="emitter.js"></script>
  181. <script src="urchinator.js"></script>
  182. <script>
  183. var waitingOnUser = false;
  184. var game_lvl = 1;
  185. $(function() {
  186. $('.again').click(function(e) {
  187. e.preventDefault();
  188. $('.overlay').hide();
  189. game(game_lvl);
  190. });
  191. $('.intro').show();
  192. $(document).keyup(function(e) {
  193. if(e.altKey && e.which == 78) {
  194. console.log('new game: ' + (game_lvl+1));
  195. newgame(++game_lvl);
  196. }
  197. else if(e.which == 27) { // escape
  198. // pause/unpause
  199. }
  200. else if(waitingOnUser && e.which == 13) { // enter
  201. // next level
  202. waitingOnUser = false;
  203. $('.overlay').hide();
  204. game(game_lvl);
  205. }
  206. });
  207. });
  208. </script>
  209. </head>
  210. <body>
  211. <div class="container">
  212. <div class="backing">
  213. <canvas width="1000" height="500" class="scribble-canvas"></canvas>
  214. </div>
  215. <div class="overlay victory defeat shadow"></div>
  216. <div class="overlay victory" style="display:none">
  217. <div class="winnerbox">
  218. <img class="winImage" src="art/you-win.png" />
  219. <div class="instructions">You Win! The pups are safe!</div>
  220. <div class="play" >Press Enter to Continue!</div>
  221. </div>
  222. </div>
  223. <div class="overlay defeat" style="display:none">
  224. <div class="winnerbox">
  225. <img class="winImage" src="art/you-lose.png" />
  226. <div class="instructions2">You Lose! Sharks will eat your pups!</div>
  227. <div class="play" >Press Enter to Try Again!</div>
  228. </div>
  229. </div>
  230. <div class="overlay intro" style="display:none">
  231. <img class="loadscreen" src="art/Loading-Screen.jpg" />
  232. <div class="shading1"> </div>
  233. <div class="shading2"> </div>
  234. <div class="instructions"><h2>How to Play:</h2>Eat the sea urchins before they eat the kelp. Use the arrow keys to move. Return to the surface and press space repeatedly to eat an urchin.</div>
  235. <div class="loading">Loading</div>
  236. <div class="play" style="display:none;">Press Enter to Play!</div>
  237. <div class="loadbar"><div class="loading-progress"></div></div>
  238. </div>
  239. </div>
  240. </body>