game.rml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <rml>
  2. <head>
  3. <title>game</title>
  4. <link type="text/template" href="window.rml" />
  5. <style>
  6. body
  7. {
  8. padding: 0px;
  9. margin: 0px;
  10. width: 100%;
  11. height: 100%;
  12. z-index: -1;
  13. }
  14. game
  15. {
  16. display: block;
  17. width: 100%;
  18. height: 100%;
  19. }
  20. div
  21. {
  22. height: 47px;
  23. padding: 8px 0px 0px 65px;
  24. margin: 0px 20px;
  25. font-size: 20px;
  26. decorator: tiled-horizontal( huditem-l, huditem-c, huditem-r );
  27. }
  28. div#score_div
  29. {
  30. float: left;
  31. width: 155px;
  32. }
  33. div#hiscore_div
  34. {
  35. float: left;
  36. width: 205px;
  37. }
  38. div#waves_div
  39. {
  40. float: right;
  41. width: 95px;
  42. }
  43. div#lives_div
  44. {
  45. float: right;
  46. width: 80px;
  47. }
  48. icon
  49. {
  50. display: block;
  51. position: absolute;
  52. left: 14px;
  53. top: 3px;
  54. width: 51px;
  55. height: 39px;
  56. }
  57. div#score_div icon
  58. {
  59. decorator: image( icon-score );
  60. }
  61. div#hiscore_div icon
  62. {
  63. decorator: image( icon-hiscore );
  64. }
  65. div#waves_div icon
  66. {
  67. decorator: image( icon-waves );
  68. }
  69. div#lives_div icon
  70. {
  71. decorator: image( icon-lives );
  72. }
  73. </style>
  74. <script>
  75. Game = Game or {} --namespace for functions
  76. function Game.OnKeyDown(event, document)
  77. if event.parameters['key_identifier'] == rmlui.key_identifier.ESCAPE then
  78. document.context:LoadDocument('luainvaders/data/pause.rml'):Show()
  79. end
  80. end
  81. </script>
  82. </head>
  83. <body id="game_window" onkeydown="Game.OnKeyDown(event, document)" ongameover="Window.LoadMenu('high_score',document)">
  84. <game id="game">
  85. <div id="score_div">
  86. <icon />
  87. score: <span id="score" />
  88. </div>
  89. <div id="hiscore_div">
  90. <icon />
  91. high score: <span id="hiscore" />
  92. </div>
  93. <div id="lives_div">
  94. <icon />
  95. lives: <span id="lives" />
  96. </div>
  97. <div id="waves_div">
  98. <icon />
  99. wave: <span id="waves" />
  100. </div>
  101. </game>
  102. </body>
  103. </rml>