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