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