Changeset 108 for pycodeshooter/trunk/index.html
- Timestamp:
- 01/17/12 01:34:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pycodeshooter/trunk/index.html
r106 r108 15 15 var titleIntervalId = 0; 16 16 17 function start (id, list) {17 function startGame() { 18 18 var msg = document.getElementById("message"); 19 19 var player = { … … 39 39 } 40 40 41 if (titleIntervalId) {42 clearInterval(titleIntervalId);43 titleIntervalId = 0;44 }45 46 41 document.onkeydown = function (ev) { setKeyDown(ev.keyCode); }; 47 42 document.onkeyup = function (ev) { setKeyUp(ev.keyCode); }; 48 43 document.onkeypress = function (ev) { setKeyPress(ev.charCode); }; 49 44 50 initGame(document.getElementById("screen"), msg, id, list[id],player);45 initGame(document.getElementById("screen"), msg, player); 51 46 } 52 47 53 48 function initControlPanel(list) { 54 49 var cp = document.getElementById("controlpanel"); 55 var sel = "<select id=\" bossSelection\">";50 var sel = "<select id=\"enemySelection\">"; 56 51 57 52 for (var id in list) { … … 61 56 cp.innerHTML = sel + "</select>"; 62 57 63 document.getElementById("bossSelection").onchange = function (ev) { 64 start(this[this.selectedIndex].value, list); 58 document.getElementById("enemySelection").onchange = function (ev) { 59 if (titleIntervalId) { 60 clearInterval(titleIntervalId); 61 titleIntervalId = 0; 62 startGame(); 63 } 64 addEnemy(list[this[this.selectedIndex].value]); 65 65 }; 66 66 } … … 71 71 var logoimg = document.getElementById("logoimg"); 72 72 73 var x = (screen.width - logoimg.width) / 2; 74 var y = -1 - logoimg.height; 75 var titlePos = screen.height / 2 - logoimg.height / 2; 73 var x = (screen.width - logoimg.width) / 2; 74 var y = -1 - logoimg.height; 75 var titlePos = screen.height / 2 - logoimg.height / 2; 76 76 77 titleIntervalId = setInterval(function() { 77 78 drawScreen(ctx, "source-over", "rgba(8,8,8,0.5)", screen.width, screen.height); … … 111 112 åå: <input type="text" value="Player" size="8" id="name" /> 112 113 èä¹ 113 æ§: <input type="text" value=" 15" size="3" id="hitpoint" />114 æ§: <input type="text" value="5" size="3" id="hitpoint" /> 114 115 ãã æ°: <input type="text" value="2" size="3" id="numbombs" /> 115 116 <br />
Note: See TracChangeset
for help on using the changeset viewer.