Changeset 119 for pycodeshooter/trunk/shooter/system.js
- Timestamp:
- 01/22/12 03:41:27 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pycodeshooter/trunk/shooter/system.js
r117 r119 21 21 "height": 0 22 22 }, 23 "sound": {}, 23 24 "message": null, 24 25 "enemyImages": new Array(), … … 186 187 187 188 if (enemy.isDead()) { 189 playSound("se_destroy"); 190 188 191 addDeathPieces( 189 192 enemy.x, enemy.y, … … 202 205 203 206 trooper.draw(System.screen.ctx); 207 } 208 209 function toggleSound(val) { 210 for (var name in System.sound) 211 System.sound[name].muted = !val; 212 } 213 214 function registerSound(name, audio) { 215 System.sound[name] = audio; 216 } 217 218 function playSound(name) { 219 if (System.sound[name]) 220 System.sound[name].play(); 204 221 } 205 222 … … 287 304 brrgs 288 305 ); 306 enemy.registerCallback("damaged", function() {playSound("se_damage_enemy")}); 289 307 290 308 System.enemies.push(enemy); … … 415 433 ); 416 434 417 System.players.push(new Trooper(435 var trooper = new Trooper( 418 436 playerData.name, 419 437 new ActionList([new ManualAction(new ManualShot())]), … … 455 473 playerData.shotlevel + 2, 456 474 -0.5)] 457 )); 475 ); 476 trooper.registerCallback("addBomb", function() {playSound("se_bomb")}); 477 trooper.registerCallback("damaged", function() {playSound("se_damage_player")}); 478 479 System.players.push(trooper); 458 480 459 481 for (var i = 0; i < System.players.length; i++) {
Note: See TracChangeset
for help on using the changeset viewer.