Changeset 84 for pycodeshooter/trunk
- Timestamp:
- 01/01/11 14:42:26 (14 years ago)
- Location:
- pycodeshooter/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pycodeshooter/trunk/index.html
r83 r84 16 16 17 17 function start(id, list) { 18 var msg = document.getElementById("message"); 18 19 var player = { 19 20 "name": document.getElementById("name").value, … … 31 32 continue; 32 33 if (!player[n] || player[n] < 0) { 33 debugMsgSet("Invalid Input Data");34 setMessage(msg, "Invalid Input Data"); 34 35 return; 35 36 } 37 } 38 39 if (titleIntervalId) { 40 clearInterval(titleIntervalId); 41 titleIntervalId = 0; 36 42 } 37 43 … … 40 46 document.onkeypress = function (ev) { setKeyPress(ev.charCode); }; 41 47 42 initGame(document.getElementById("screen"), id, list[id], player);48 initGame(document.getElementById("screen"), msg, id, list[id], player); 43 49 } 44 50 … … 54 60 55 61 document.getElementById("bossSelection").onchange = function (ev) { 56 if (titleIntervalId) {57 clearInterval(titleIntervalId);58 titleIntervalId = 0;59 }60 62 start(this[this.selectedIndex].value, list); 61 63 }; 62 }63 64 function debugMsgSet(msg) {65 document.getElementById("message").innerHTML = msg;66 }67 68 function debugMsgAdd(msg) {69 document.getElementById("message").innerHTML += msg;70 64 } 71 65 -
pycodeshooter/trunk/shooter/system.js
r81 r84 21 21 "height": 0 22 22 }, 23 "message": null, 23 24 "boss": null, 24 25 "player": null, … … 96 97 } 97 98 99 function setMessage(elem, msg) { 100 if (elem) 101 elem.innerHTML = msg; 102 } 103 104 function addMessage(elem, msg) { 105 if (elem) 106 elem.innerHTML += msg; 107 } 108 98 109 99 110 /* … … 189 200 * Initializer 190 201 */ 191 function initGame(canvas, bossId, bossData, playerData) {202 function initGame(canvas, msg, bossId, bossData, playerData) { 192 203 System.screen.canvas = canvas; 204 System.message = msg; 193 205 System.screen.ctx = System.screen.canvas.getContext("2d"); 194 206 System.screen.width = System.screen.canvas.width; … … 252 264 var brrgs = new Array(); 253 265 254 debugMsgSet("ActionsIdx:");266 setMessage(System.message, "ActionsIdx:"); 255 267 256 268 for (i = 0; i < numAct; i++) { … … 258 270 acts.push(new EnemyActions[idx](new shot())); 259 271 260 debugMsgAdd(String(idx) + ",");261 } 262 263 debugMsgAdd("<br>");272 addMessage(System.message, String(idx) + ","); 273 } 274 275 addMessage(System.message, "<br>"); 264 276 265 277 for (i = 0; i < numBrrg; i++) { … … 267 279 var brrgCls = EnemyBarrages[idx]; 268 280 269 debugMsgAdd("BarragesIdx:" + String(idx) + " / BulletsIdx:"); 281 addMessage(System.message, 282 "BarragesIdx:" + String(idx) + " / BulletsIdx:"); 270 283 271 284 for (k = 0; k < numBlt; k++) { … … 283 296 ); 284 297 285 debugMsgAdd(String(iidx) + ",");298 addMessage(System.message, String(iidx) + ","); 286 299 } 287 300 288 debugMsgAdd("<br>");301 addMessage(System.message, "<br>"); 289 302 } 290 303
Note: See TracChangeset
for help on using the changeset viewer.