Changeset 130
- Timestamp:
- 05/02/12 20:56:24 (13 years ago)
- Location:
- pycodeshooter/trunk
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pycodeshooter/trunk/index.html
r129 r130 34 34 35 35 // register sounds to system 36 registerSound("bgm_title", document.getElementById("bgm_title")); 37 registerSound("bgm_stage1", document.getElementById("bgm_stage1")); 38 registerSound("bgm_stage2", document.getElementById("bgm_stage2")); 39 registerSound("bgm_stage3", document.getElementById("bgm_stage3")); 40 registerSound("bgm_stage4", document.getElementById("bgm_stage4")); 41 registerSound("bgm_stage5", document.getElementById("bgm_stage5")); 42 registerSound("se_start", document.getElementById("se_start")); 43 registerSound("se_encounter", document.getElementById("se_encounter")); 44 registerSound("se_damage", document.getElementById("se_damage")); 45 registerSound("se_bomb", document.getElementById("se_bomb")); 46 registerSound("se_destroy", document.getElementById("se_destroy")); 36 var audios = document.getElementsByTagName("audio"); 37 for (var i = 0; i < audios.length; i++) 38 registerSound(audios[i].id, audios[i]); 47 39 48 40 // sound on/off (default off) … … 157 149 <input type="hidden" value="5" id="shotspeed" /> 158 150 <input type="hidden" value="5" id="shotinterval" /> 159 <input type="hidden" value=" 3" id="shotlevel" />151 <input type="hidden" value="1" id="shotlevel" /> 160 152 <input type="hidden" value="/etc/pycodebattler/?mode=json" id="api" /> 161 153 <img src="images/logo.png" style="visibility: hidden;" id="logoimg" /> … … 172 164 <audio src="sounds/se_zusyunzusyun.ogg", id="se_bomb" preload="auto" /> 173 165 <audio src="sounds/se_zugan.ogg", id="se_destroy" preload="auto" /> 166 <audio src="sounds/se_breakout_2.ogg", id="se_item_score" preload="auto" /> 167 <audio src="sounds/se_coinget_1.ogg", id="se_item_shot" preload="auto" /> 168 <audio src="sounds/se_coinget_1.ogg", id="se_item_bomb" preload="auto" /> 169 <audio src="sounds/se_byuin.ogg", id="se_item_life" preload="auto" /> 174 170 175 171 <img src="images/ma1s.gif" style="visibility: hidden;" id="p_img0" /> … … 240 236 <p>TODO</p> 241 237 <ul style="font-size: small;"> 238 <li>å®è£ 239 ããã£ã€ããããã®ã§æžãçŽã</li> 242 240 <li>åäœãã¿ãŒã³ãå¢ãã</li> 243 241 <li>匟å¹ãã¿ãŒã³ãå¢ãã</li> 244 <li>ãã¯ãŒã¢ããã¢ã€ãã </li>245 242 <li>åäœãåã</li> 246 243 </ul> -
pycodeshooter/trunk/shooter/bullet.js
r115 r130 39 39 return (width < this.x || height < this.y || this.x < 0 || this.y < 0); 40 40 }; 41 this.draw = function(ctx ) {41 this.draw = function(ctx, func) { 42 42 if (this.frame) { 43 43 var pos = this.calcNext(); … … 61 61 62 62 ctx.beginPath(); 63 ctx.fillStyle = this.getColor(); 64 ctx.arc(this.x, this.y, this.getSize(), 0, Math.PI * 2.0, true); 65 ctx.fill(); 63 if (func) { 64 func(this, ctx); 65 } 66 else { 67 ctx.fillStyle = this.getColor(); 68 ctx.arc(this.x, this.y, this.getSize(), 0, Math.PI * 2.0, true); 69 ctx.fill(); 70 } 66 71 ctx.closePath(); 67 72 }; -
pycodeshooter/trunk/shooter/system.js
r129 r130 30 30 "backgroundObject": new Array(), 31 31 "deathPieces": new Array(), 32 "items": new Array(), 32 33 "mainIntervalId": 0 33 34 }; … … 95 96 96 97 System.deathPieces = newObjs; 98 } 99 100 101 /* 102 * Item Utilities 103 */ 104 function addItem(x, y, angle, size, color, speed, attrs) { 105 var frame = {"style": "rect", "color": attrs.color, "width": size * 2, "height": size * 2}; 106 var item = new YExtendBullet(size, color, frame, 107 System.screen.width, System.screen.height, 108 x, y, angle * Math.PI, speed); 109 item.attrs = attrs; 110 System.items.push(item); 111 } 112 113 function updateItems(ctx, width, height, troopers) { 114 var newObjs = new Array(); 115 116 ITEMLOOP: 117 for (var i = 0; i < System.items.length; i++) { 118 var item = System.items[i]; 119 120 item.next(); 121 item.draw(ctx, function(bullet, ctx) { 122 drawString( 123 ctx, "source-over", item.attrs.symbol, 124 bullet.x, bullet.y, 125 item.attrs.color, item.size + "pt monospace", "center" 126 ); 127 }); 128 129 for (var j = 0; j < troopers.length; j++) { 130 var trooper = troopers[j]; 131 132 if (touch(trooper.x, trooper.y, trooper.size, item.x, item.y, item.size)) { 133 switch (item.attrs.type) { 134 case "score": 135 playSound("se_item_score"); 136 if (System.score[trooper.name] !== undefined) 137 System.score[trooper.name] += item.attrs.quantity; 138 break; 139 case "shot": 140 playSound("se_item_shot"); 141 for (var k = 0; k < trooper.barrages.length; k++) { 142 trooper.barrages[k].way += item.attrs.quantity; 143 if (trooper.barrages[k].way >= 10) 144 trooper.barrages[k].way = 10; 145 } 146 break; 147 case "bomb": 148 playSound("se_item_bomb"); 149 trooper.numBombs += item.attrs.quantity; 150 break; 151 case "life": 152 playSound("se_item_life"); 153 trooper.life += item.attrs.quantity; 154 break; 155 } 156 157 continue ITEMLOOP; 158 } 159 } 160 161 if (!item.vanished(width, height)) 162 newObjs.push(item); 163 } 164 165 System.items = newObjs; 97 166 } 98 167 … … 355 424 [6, 8, 10], ["#F55", "#FAA"], 3, 8 356 425 ); 426 427 var itemAttr; 428 var itemRand = Math.floor(Math.random() * 100); 429 if (itemRand < 40) { 430 // nothing 431 } 432 else if (itemRand < 75) { 433 itemAttr = {"color": "#AAF", "symbol": "S", "type": "score", "quantity": enemy.maxLife * 200}; 434 } 435 else if (itemRand < 95) { 436 itemAttr = {"color": "#FAA", "symbol": "P", "type": "shot", "quantity": 1}; 437 } 438 else if (itemRand < 98) { 439 itemAttr = {"color": "#FFA", "symbol": "B", "type": "bomb", "quantity": 1}; 440 } 441 else { 442 itemAttr = {"color": "#AFA", "symbol": "L", "type": "life", "quantity": 1}; 443 } 444 445 if (itemAttr) 446 addItem(enemy.x, enemy.y, 0.5, 5, "#AFA", 1, itemAttr); 357 447 } 358 448 else { … … 396 486 "STAGE " + getStageNumber(), 397 487 System.screen.width - 10, 398 System.screen.height -15,488 15, 399 489 "#ACF", "9pt monospace", "right" 400 490 ); … … 409 499 name + " SCORE " + System.score[name], 410 500 (System.screen.width - 10), 411 i * 16 + 15,501 i * 16 + 30, 412 502 "#ACF", "9pt monospace", "right" 413 503 ); 414 504 } 505 506 // update/draw items 507 updateItems(System.screen.ctx, 508 System.screen.width, 509 System.screen.height, 510 System.players); 415 511 416 512 // update/draw troopers … … 436 532 (System.screen.height - 23) - (i * 33), 437 533 "#ACF", "9pt monospace", "left" 534 ); 535 536 drawString( 537 System.screen.ctx, 538 "source-over", 539 "BOMB " + player.numBombs, 540 (System.screen.width - 10), 541 (System.screen.height - 23) - (i * 33), 542 "#ACF", "9pt monospace", "right" 438 543 ); 439 544 } … … 522 627 playerData.shotlevel, 523 628 -0.5), 524 new LinerBarrage( YExtendBullet,629 new LinerBarrage(LinerBullet, 525 630 playerData.shotsize, 526 631 "rgba(64,64,128,0.7)", … … 529 634 playerData.shotspeed, 530 635 playerData.shotlevel, 531 0.5),532 new CircularBarrage(LinerBullet,533 playerData.shotsize,534 "rgba(64,64,128,0.7)",535 null,536 playerData.shotinterval,537 playerData.shotspeed,538 playerData.shotlevel + 2,539 636 -0.5)] 540 637 ); … … 554 651 trooper.x = System.screen.width / 2; 555 652 trooper.y = System.screen.height - System.screen.height / 7; 653 trooper.numBombs = playerData.numbombs; 654 trooper.barrages = [ 655 new LinerBarrage(YExtendBullet, 656 playerData.shotsize, 657 "rgba(64,64,128,0.7)", 658 null, 659 playerData.shotinterval, 660 playerData.shotspeed, 661 playerData.shotlevel, 662 -0.5), 663 new LinerBarrage(LinerBullet, 664 playerData.shotsize, 665 "rgba(64,64,128,0.7)", 666 null, 667 playerData.shotinterval, 668 playerData.shotspeed, 669 playerData.shotlevel, 670 -0.5) 671 ]; 556 672 }); 557 673
Note: See TracChangeset
for help on using the changeset viewer.