[81] | 1 | <!-- $Id$ --> |
---|
| 2 | |
---|
| 3 | <!DOCTYPE html> |
---|
| 4 | <html lang="ja"> |
---|
| 5 | <head> |
---|
| 6 | <meta charset="UTF-8"></meta> |
---|
| 7 | <title>PyCodeShooter β</title> |
---|
| 8 | <link rel="stylesheet" href="/tdiary.css" type="text/css" media="all" /> |
---|
| 9 | <script type="text/javascript" charset="UTF-8" src="shooter/bullet.js"></script> |
---|
| 10 | <script type="text/javascript" charset="UTF-8" src="shooter/barrage.js"></script> |
---|
| 11 | <script type="text/javascript" charset="UTF-8" src="shooter/action.js"></script> |
---|
| 12 | <script type="text/javascript" charset="UTF-8" src="shooter/trooper.js"></script> |
---|
| 13 | <script type="text/javascript" charset="UTF-8" src="shooter/system.js"></script> |
---|
| 14 | <script type="text/javascript"> |
---|
[110] | 15 | window.onload = function () { |
---|
| 16 | var req = new XMLHttpRequest(); |
---|
| 17 | req.open("GET", document.getElementById("api").value, false); |
---|
| 18 | req.send(null); |
---|
[81] | 19 | |
---|
[127] | 20 | var enemyList = JSON.parse(req.responseText).result; |
---|
| 21 | var msg = document.getElementById("message"); |
---|
| 22 | var screen = document.getElementById("screen"); |
---|
| 23 | var ctx = screen.getContext("2d"); |
---|
[81] | 24 | |
---|
[122] | 25 | setMessage(msg, "<br />"); |
---|
| 26 | |
---|
[127] | 27 | // register enemy images to system |
---|
| 28 | var imgs = document.getElementsByTagName("img"); |
---|
| 29 | for (var i = 0; i < imgs.length; i++) { |
---|
| 30 | if (imgs[i].getAttribute("id").match(/^e_img/)) { |
---|
| 31 | addEnemyImage(imgs[i]); |
---|
| 32 | } |
---|
| 33 | } |
---|
| 34 | |
---|
[122] | 35 | // register sounds to system |
---|
[119] | 36 | registerSound("bgm_title", document.getElementById("bgm_title")); |
---|
| 37 | registerSound("bgm_stage1", document.getElementById("bgm_stage1")); |
---|
[122] | 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")); |
---|
[119] | 42 | registerSound("se_start", document.getElementById("se_start")); |
---|
| 43 | registerSound("se_encounter", document.getElementById("se_encounter")); |
---|
| 44 | registerSound("se_damage_enemy", document.getElementById("se_damage_enemy")); |
---|
| 45 | registerSound("se_damage_player", document.getElementById("se_damage_player")); |
---|
| 46 | registerSound("se_bomb", document.getElementById("se_bomb")); |
---|
| 47 | registerSound("se_destroy", document.getElementById("se_destroy")); |
---|
[81] | 48 | |
---|
[122] | 49 | // sound on/off (default off) |
---|
[127] | 50 | var soundCheck = document.getElementById("sound"); |
---|
[119] | 51 | soundCheck.onclick = function() { |
---|
| 52 | toggleSound(soundCheck.checked); |
---|
| 53 | }; |
---|
| 54 | soundCheck.click(); |
---|
[122] | 55 | playSound("bgm_title"); |
---|
[119] | 56 | |
---|
[110] | 57 | // title screen set |
---|
[127] | 58 | var logoimg = document.getElementById("logoimg"); |
---|
| 59 | var x = (screen.width - logoimg.width) / 2; |
---|
| 60 | var y = -1 - logoimg.height; |
---|
| 61 | var titlePos = screen.height / 2 - logoimg.height / 2; |
---|
| 62 | var titleIntervalId = setInterval(function() { |
---|
[81] | 63 | drawScreen(ctx, "source-over", "rgba(8,8,8,0.5)", screen.width, screen.height); |
---|
| 64 | updateBackground(ctx, screen.width, screen.height, 1, "#AAF", 10); |
---|
| 65 | ctx.drawImage(logoimg, x, y); |
---|
| 66 | |
---|
| 67 | if (++y > titlePos) |
---|
| 68 | y = titlePos; |
---|
[110] | 69 | |
---|
| 70 | drawString( |
---|
| 71 | ctx, "source-over", |
---|
[126] | 72 | "CLICK SCREEN TO START GAME", |
---|
| 73 | 10, 20, "#ACF", "9pt monospace", "left" |
---|
[110] | 74 | ); |
---|
[81] | 75 | }, 20); |
---|
| 76 | |
---|
[110] | 77 | // start game |
---|
| 78 | screen.onclick = function() { |
---|
| 79 | if (!titleIntervalId) { |
---|
| 80 | return; |
---|
| 81 | } |
---|
[81] | 82 | |
---|
[127] | 83 | var player = { |
---|
| 84 | "name": document.getElementById("name").value, |
---|
| 85 | "image": document.getElementById("p_img0"), |
---|
| 86 | "size": parseInt(document.getElementById("size").value), |
---|
| 87 | "hitsize": parseInt(document.getElementById("hitsize").value), |
---|
| 88 | "speed": parseInt(document.getElementById("speed").value), |
---|
| 89 | "hitpoint": parseInt(document.getElementById("hitpoint").value), |
---|
| 90 | "shotsize": parseInt(document.getElementById("shotsize").value), |
---|
| 91 | "shotinterval": parseInt(document.getElementById("shotinterval").value), |
---|
| 92 | "shotspeed": parseInt(document.getElementById("shotspeed").value), |
---|
| 93 | "shotlevel": parseInt(document.getElementById("shotlevel").value), |
---|
| 94 | "numbombs": parseInt(document.getElementById("numbombs").value) |
---|
| 95 | }; |
---|
| 96 | |
---|
| 97 | for (var n in player) { |
---|
| 98 | if (n == "name" || n == "image") |
---|
| 99 | continue; |
---|
| 100 | if (!player[n] || player[n] < 1) { |
---|
| 101 | setMessage(msg, "Invalid Input Data"); |
---|
| 102 | return; |
---|
| 103 | } |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | setMessage(msg, "<br />"); |
---|
[122] | 107 | clearInterval(titleIntervalId); |
---|
| 108 | titleIntervalId = 0; |
---|
| 109 | |
---|
| 110 | pauseSound("bgm_title", true) |
---|
[119] | 111 | playSound("se_start"); |
---|
[110] | 112 | |
---|
[119] | 113 | setTimeout(function() { |
---|
| 114 | initGame(document.getElementById("screen"), msg, player); |
---|
[110] | 115 | |
---|
[122] | 116 | // auto enemy encounter |
---|
[119] | 117 | var enemyIntervalId = setInterval(function() { |
---|
[126] | 118 | if (getEnemiesOnScreen() < getStageNumber()) { |
---|
[119] | 119 | var ids = Object.keys(enemyList); |
---|
| 120 | var id = ids[Math.floor(Math.random() * ids.length)]; |
---|
| 121 | playSound("se_encounter"); |
---|
| 122 | addEnemy(enemyList[id]); |
---|
| 123 | } |
---|
| 124 | }, 1500); |
---|
[122] | 125 | }, 1500); |
---|
[110] | 126 | }; |
---|
[81] | 127 | }; |
---|
| 128 | </script> |
---|
| 129 | </head> |
---|
| 130 | |
---|
| 131 | <body> |
---|
| 132 | <h1 class="title">PyCodeShooter β</h1> |
---|
| 133 | |
---|
| 134 | <div class="main"> |
---|
| 135 | <div style="margin-left: 5em; margin-right: 5em; font-style: italic;"> |
---|
| 136 | <p>Pythonista éã®ææŠã«ïŒ</p> |
---|
| 137 | <p style="text-align: right;">åã¯ïŒèããããã...</p> |
---|
| 138 | </div> |
---|
| 139 | |
---|
| 140 | <div class="day"> |
---|
| 141 | <h2><span class="title">PyCodeShooter β</span></h2> |
---|
| 142 | <div class="body"> |
---|
| 143 | <div class="section"> |
---|
| 144 | <form> |
---|
| 145 | <h3><span class="sanchor">â </span> ææŠãã!</h3> |
---|
| 146 | <p> |
---|
[126] | 147 | åå: <input type="text" value="PLAYER" size="8" id="name" /> |
---|
[108] | 148 | èä¹
æ§: <input type="text" value="5" size="3" id="hitpoint" /> |
---|
[92] | 149 | ãã æ°: <input type="text" value="2" size="3" id="numbombs" /> |
---|
[126] | 150 | é³: <input type="checkbox" checked="checked" id="sound" /> |
---|
[81] | 151 | <br /> |
---|
| 152 | <canvas id="screen" width="320" height="480"></canvas> |
---|
[109] | 153 | <input type="hidden" value="20" id="size" /> |
---|
[97] | 154 | <input type="hidden" value="1" id="hitsize" /> |
---|
[81] | 155 | <input type="hidden" value="5" id="speed" /> |
---|
| 156 | <input type="hidden" value="7" id="shotsize" /> |
---|
| 157 | <input type="hidden" value="5" id="shotspeed" /> |
---|
[106] | 158 | <input type="hidden" value="5" id="shotinterval" /> |
---|
[81] | 159 | <input type="hidden" value="3" id="shotlevel" /> |
---|
| 160 | <input type="hidden" value="/etc/pycodebattler/?mode=json" id="api" /> |
---|
[109] | 161 | <img src="images/logo.png" style="visibility: hidden;" id="logoimg" /> |
---|
| 162 | |
---|
[128] | 163 | <audio src="sounds/bgm_sht_a01.ogg", id="bgm_title" loop="true" preload="auto" /> |
---|
| 164 | <audio src="sounds/bgm_sht_a02.ogg", id="bgm_stage1" loop="true" preload="auto" /> |
---|
| 165 | <audio src="sounds/bgm_sht_a03.ogg", id="bgm_stage2" loop="true" preload="auto" /> |
---|
| 166 | <audio src="sounds/bgm_sht_a04.ogg", id="bgm_stage3" loop="true" preload="auto" /> |
---|
| 167 | <audio src="sounds/bgm_sht_a05.ogg", id="bgm_stage4" loop="true" preload="auto" /> |
---|
| 168 | <audio src="sounds/bgm_sht_a06.ogg", id="bgm_stage5" loop="true" preload="auto" /> |
---|
| 169 | <audio src="sounds/se_coinin_1.ogg", id="se_start" preload="auto" /> |
---|
| 170 | <audio src="sounds/se_denshion_1.ogg", id="se_encounter" preload="auto" /> |
---|
| 171 | <audio src="sounds/se_pyuun.ogg", id="se_damage_player" preload="auto" /> |
---|
| 172 | <audio src="sounds/se_click_2.ogg", id="se_damage_enemy" preload="auto" /> |
---|
| 173 | <audio src="sounds/se_zusyunzusyun.ogg", id="se_bomb" preload="auto" /> |
---|
| 174 | <audio src="sounds/se_zugan.ogg", id="se_destroy" preload="auto" /> |
---|
[119] | 175 | |
---|
[109] | 176 | <img src="images/ma1s.gif" style="visibility: hidden;" id="p_img0" /> |
---|
| 177 | <img src="images/ma2s.gif" style="visibility: hidden;" id="p_img1" /> |
---|
| 178 | <img src="images/ma5s.gif" style="visibility: hidden;" id="e_img0" /> |
---|
| 179 | <img src="images/ma6s.gif" style="visibility: hidden;" id="e_img1" /> |
---|
| 180 | <img src="images/ma7s.gif" style="visibility: hidden;" id="e_img2" /> |
---|
| 181 | <img src="images/man1s.gif" style="visibility: hidden;" id="e_img3" /> |
---|
| 182 | <img src="images/man2s.gif" style="visibility: hidden;" id="e_img4" /> |
---|
| 183 | <img src="images/man3s.gif" style="visibility: hidden;" id="e_img5" /> |
---|
| 184 | <img src="images/man4s.gif" style="visibility: hidden;" id="e_img6" /> |
---|
| 185 | <img src="images/man5s.gif" style="visibility: hidden;" id="e_img7" /> |
---|
| 186 | <img src="images/man6s.gif" style="visibility: hidden;" id="e_img8" /> |
---|
| 187 | <img src="images/man7s.gif" style="visibility: hidden;" id="e_img9" /> |
---|
| 188 | <img src="images/man8s.gif" style="visibility: hidden;" id="e_img10" /> |
---|
| 189 | <img src="images/man9s.gif" style="visibility: hidden;" id="e_img11" /> |
---|
| 190 | <img src="images/pin9s.gif" style="visibility: hidden;" id="e_img12" /> |
---|
| 191 | <img src="images/so1s.gif" style="visibility: hidden;" id="e_img13" /> |
---|
| 192 | <img src="images/so2s.gif" style="visibility: hidden;" id="e_img14" /> |
---|
| 193 | <img src="images/so3s.gif" style="visibility: hidden;" id="e_img15" /> |
---|
| 194 | <img src="images/so4s.gif" style="visibility: hidden;" id="e_img16" /> |
---|
| 195 | <img src="images/so8s.gif" style="visibility: hidden;" id="e_img17" /> |
---|
| 196 | <img src="images/so9s.gif" style="visibility: hidden;" id="e_img18" /> |
---|
[81] | 197 | </p> |
---|
| 198 | </form> |
---|
| 199 | </div> |
---|
| 200 | </div> |
---|
| 201 | </div> |
---|
| 202 | </div> |
---|
| 203 | |
---|
| 204 | <div class="sidebar"> |
---|
| 205 | <div style="margin: 1em;"> |
---|
| 206 | <p>ããã¯äœ?</p> |
---|
| 207 | <ul style="font-size: small;"> |
---|
| 208 | <li><a href="/etc/pycodebattler/">PyCodeBattler</a> ã«ç»é²ããã Python ã³ãŒããšæŠããŸã</li> |
---|
| 209 | </ul> |
---|
| 210 | |
---|
| 211 | <p>æäœ</p> |
---|
| 212 | <dl style="font-size: small;"> |
---|
| 213 | <dt>â ã·ã§ãã:</dt> |
---|
| 214 | <dd>z</dd> |
---|
[92] | 215 | <dt>â ãã :</dt> |
---|
| 216 | <dd>a</dd> |
---|
[81] | 217 | <dt>â 移åé床é
延:</dt> |
---|
| 218 | <dd>x</dd> |
---|
| 219 | <dt>â 匟åæ¿:</dt> |
---|
| 220 | <dd>c</dd> |
---|
| 221 | <dt>â 巊移å:</dt> |
---|
| 222 | <dd>â or h</dd> |
---|
| 223 | <dt>â äžç§»å:</dt> |
---|
| 224 | <dd>â or j</dd> |
---|
| 225 | <dt>â äžç§»å:</dt> |
---|
| 226 | <dd>â or k</dd> |
---|
| 227 | <dt>â å³ç§»å:</dt> |
---|
| 228 | <dd>â or l</dd> |
---|
| 229 | </dl> |
---|
| 230 | |
---|
| 231 | <p>ã·ã¹ãã ã¡ãã»ãŒãž</p> |
---|
[110] | 232 | <span id="message" style="font-size: small;">Now loading...</span> |
---|
[81] | 233 | |
---|
| 234 | <p>泚æ</p> |
---|
| 235 | <ul style="font-size: small;"> |
---|
| 236 | <li>ãã©ã¡ãŒã¿ç調æŽäžã«ã€ãïŒãã£ã©ã®åŒ·ãã匟å¹çãå€ãã£ããããå¯èœæ§ããããŸã</li> |
---|
| 237 | <li>Chrome æšå¥šã§ãïŒFirefox ã ãšéãïŒIE ã ãšå€ååããŸãã</li> |
---|
| 238 | </ul> |
---|
| 239 | |
---|
| 240 | <p>TODO</p> |
---|
| 241 | <ul style="font-size: small;"> |
---|
| 242 | <li>åäœãã¿ãŒã³ãå¢ãã</li> |
---|
| 243 | <li>匟å¹ãã¿ãŒã³ãå¢ãã</li> |
---|
| 244 | <li>ãã¯ãŒã¢ããã¢ã€ãã </li> |
---|
[112] | 245 | <li>åäœãåã</li> |
---|
[81] | 246 | </ul> |
---|
| 247 | |
---|
| 248 | <p>ãœãŒã¹ã³ãŒã</p> |
---|
| 249 | <ul style="font-size: small;"> |
---|
| 250 | <li><a href="http://trac.atzm.org/index.cgi/browser/pycodeshooter">pycodeshooter</a></li> |
---|
| 251 | </ul> |
---|
[109] | 252 | |
---|
| 253 | <p>å©çšçŽ æç</p> |
---|
| 254 | <ul style="font-size: small;"> |
---|
| 255 | <li><a href="http://www.civillink.net/">ããªãŒçŽ æã®æ¥å€¢æ¥äºº</a></li> |
---|
[119] | 256 | <li><a href="http://www.skipmore.com/sound/">ãŠãŠã©ã8bitãµãŠã³ãå·¥æ¿</a></li> |
---|
[109] | 257 | </ul> |
---|
[81] | 258 | </div> |
---|
| 259 | </div> |
---|
| 260 | </body> |
---|
| 261 | </html> |
---|