game.rml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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: 9px 0px 0px 65px;
  24. margin: 0px 20px;
  25. font-size: 20px;
  26. background-decorator: tiled-horizontal;
  27. background-left-image: ../../assets/invader.tga 147px 55px 229px 0px;
  28. background-center-image: ../../assets/invader.tga stretch 229px 55px 230px 0px;
  29. background-right-image: ../../assets/invader.tga 231px 55px 246px 0px;
  30. }
  31. div#score_div
  32. {
  33. float: left;
  34. width: 155px;
  35. }
  36. div#hiscore_div
  37. {
  38. float: left;
  39. width: 205px;
  40. }
  41. div#waves_div
  42. {
  43. float: right;
  44. width: 95px;
  45. }
  46. div#lives_div
  47. {
  48. float: right;
  49. width: 80px;
  50. }
  51. icon
  52. {
  53. display: block;
  54. position: absolute;
  55. left: 14px;
  56. top: 3px;
  57. width: 51px;
  58. height: 39px;
  59. icon-decorator: image;
  60. icon-image-src: ../../assets/invader.tga;
  61. icon-image-t: 152px 191px;
  62. }
  63. div#score_div icon
  64. {
  65. icon-image-s: 434px 485px;
  66. }
  67. div#hiscore_div icon
  68. {
  69. icon-image-s: 281px 332px;
  70. }
  71. div#waves_div icon
  72. {
  73. icon-image-s: 332px 383px;
  74. }
  75. div#lives_div icon
  76. {
  77. icon-image-s: 383px 434px;
  78. }
  79. </style>
  80. <script>
  81. Game = Game or {} --namespace for functions
  82. function Game.OnKeyDown(event, document)
  83. if event.parameters['key_identifier'] == rmlui.key_identifier.ESCAPE then
  84. document.context:LoadDocument('luainvaders/data/pause.rml'):Show()
  85. end
  86. end
  87. </script>
  88. </head>
  89. <body id="game_window" onkeydown="Game.OnKeyDown(event, document)" ongameover="Window.LoadMenu('high_score',document)">
  90. <game id="game">
  91. <div id="score_div">
  92. <icon />
  93. score: <span id="score" />
  94. </div>
  95. <div id="hiscore_div">
  96. <icon />
  97. high score: <span id="hiscore" />
  98. </div>
  99. <div id="lives_div">
  100. <icon />
  101. lives: <span id="lives" />
  102. </div>
  103. <div id="waves_div">
  104. <icon />
  105. wave: <span id="waves" />
  106. </div>
  107. </game>
  108. </body>
  109. </rml>