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