Changeset 112 for pycodeshooter/trunk/shooter
- Timestamp:
- 01/18/12 19:22:25 (13 years ago)
- Location:
- pycodeshooter/trunk/shooter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pycodeshooter/trunk/shooter/system.js
r111 r112 25 25 "enemies": new Array(), 26 26 "players": new Array(), 27 "score": {}, 27 28 "backgroundObject": new Array(), 28 29 "deathPieces": new Array(), … … 185 186 [6, 8, 10], ["#55F", "#AAF"], 3, 8 186 187 ); 188 189 if (System.score[trooper.name] !== undefined) { 190 System.score[trooper.name] += enemy.maxLife * 100; 191 } 187 192 } 188 193 else { … … 291 296 1, "#CAF", 10 292 297 ); 298 299 // draw score 300 var scoreNames = Object.keys(System.score).sort(); 301 for (var i = 0; i < scoreNames.length; i++) { 302 var name = scoreNames[i]; 303 drawString( 304 System.screen.ctx, 305 "source-over", 306 name + " score " + System.score[name], 307 (System.screen.width - 10), 308 i * 16 + 15, 309 "#ACF", "9pt monospace", "right" 310 ); 311 } 293 312 294 313 // update/draw troopers … … 422 441 )); 423 442 443 for (var i = 0; i < System.players.length; i++) { 444 System.score[System.players[i].name] = 0; 445 } 446 424 447 System.backgroundObject = new Array(); 425 448 System.mainIntervalId = setInterval(mainLoop, 20); -
pycodeshooter/trunk/shooter/trooper.js
r109 r112 88 88 this.h = h; 89 89 this.life = life; 90 this.maxLife = life; 90 91 this.speed = speed; 91 92 this.numBombs = numBombs;
Note: See TracChangeset
for help on using the changeset viewer.