• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqtwindows誰得cocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Commit MetaInfo

Revisión4bbd83f4ad6ad85537bfd943d8016dc7d98bab4d (tree)
Tiempo2016-12-13 21:33:32
AutorYu Hayashi <yu011301@teca...>
CommiterYu Hayashi

Log Message

FIX: Bombs

Cambiar Resumen

Diferencia incremental

--- a/WebContent/Bombs.html
+++ b/WebContent/Bombs.html
@@ -15,6 +15,7 @@
1515 function Missile() {
1616 this.maxCount = 500;
1717 this.interval = 1000;
18+
1819 this.reload = function() {
1920 this.sX = rand(800);
2021 this.eX = rand(800);
@@ -26,14 +27,14 @@
2627 };
2728
2829 this.draw = function(ctx) {
29- ctx.strokeStyle = ctx.fillStyle = rgb(0,255,255);
30+ ctx.strokeStyle = ctx.fillStyle = 'rgb(0,255,255)';
3031
3132 // 軌跡の描画
3233 line(ctx, this.sX, 0, this.x, this.y);
3334
3435 // 爆発
3536 if (this.r > 0) {
36- circle(ctx, this.x, this.y, this.r < 50 ? this.r : (100 - this.r));
37+ circle(ctx, this.x, this.y, (this.r < 50 ? this.r : (100 - this.r)));
3738 }
3839 };
3940
@@ -51,14 +52,15 @@
5152 this.shotR = 0;
5253 this.fire = false;
5354 this.draw = function (ctx) {
54- ctx.strokeStyle = ctx.fillStyle = rgb(0,255,0);
55+ ctx.strokeStyle = ctx.fillStyle = 'rgb(0,255,0)';
5556
5657 // 照準器の描画
57- ctx.drawImage(this.image, this.scopeX - this.scopeW / 2, this.scopeY - thisscopeW / 2);
58+ ctx.drawImage(this.image, this.scopeX - this.scopeW / 2, this.scopeY - this.scopeW / 2);
5859 if (!this.fire) {
5960 return;
6061 }
61- if (this.shotR == 0 && this.count < 100) {
62+
63+ if ((this.shotR == 0) && (this.count < 100)) {
6264 // 軌跡の描画
6365 var ratio = this.count / 100;
6466 var y = 600 - (600 - this.shotY) * ratio;
@@ -77,11 +79,11 @@
7779 }
7880
7981 function rand(r) {
80- return Math.floor(Math.random() * r)
82+ return Math.floor(Math.random() * r);
8183 }
8284
8385 function explodeSound() {
84- documeent.getElementById('explode').play();
86+ document.getElementById('explode').play();
8587 }
8688
8789 function line(ctx, x0, y0, x1, y1) {
@@ -96,15 +98,15 @@
9698 if (r <= 0) {
9799 return;
98100 }
99- ctx.biginPath();
101+ ctx.beginPath();
100102 ctx.arc(x, y, r, 0, Math.PI * 2, true);
101103 ctx.fill();
102104 }
103105
104106 function init() {
105- shoot = new shoot();
107+ shoot = new Shoot();
106108 var canvas = document.getElementById('canvas');
107- ctx. = canvas.getContext('2d');
109+ ctx = canvas.getContext('2d');
108110 ctx.font = "20pt Arial";
109111 canvas.addEventListener('mousemove', mousemove);
110112 canvas.addEventListener('mousedown', mousedown);
@@ -133,19 +135,19 @@
133135 if (shoot.fire) {
134136 shoot.count++;
135137
136- if (100 <= shoot.count && shoot.count < 200) {
138+ if ((100 <= shoot.count) && (shoot.count < 200)) {
137139 shoot.shotR++;
138140 }
139- else if (200 <= shoot.count && shoot.count < 300) {
141+ else if ((200 <= shoot.count) && (shoot.count < 300)) {
140142 shoot.shotR--;
141143 }
142- else if (300 <= shot.count) {
144+ else if (300 <= shoot.count) {
143145 shoot.fire = false;
144146 }
145147 }
146148
147149 // ミサイルの状態を更新
148- missile.forEach(function(m) {
150+ missiles.forEach(function(m) {
149151 var c = count - m.firetime;
150152 if (c < 0) {
151153 return;
@@ -158,7 +160,7 @@
158160 }
159161 else {
160162 // ミサイルの場所更新
161- m.x = (m.eX - x.sX) * c / m.maxCount + m.sX;
163+ m.x = (m.eX - m.sX) * c / m.maxCount + m.sX;
162164 m.y = 600 * c / m.maxCount;
163165
164166 // 自分の迎撃ミサイルとの衝突判定
@@ -182,9 +184,7 @@
182184 }
183185 });
184186
185- if (houses.every(function(house) {
186- return house.hit;
187- })) {
187+ if (houses.every(function(house) { return house.hit; })) {
188188 clearInterval(timer);
189189 timer = NaN;
190190 }
@@ -204,7 +204,7 @@
204204 }
205205
206206 function mousedown(e) {
207- if (shot.fire == false) {
207+ if (shoot.fire == false) {
208208 shoot.shotX = e.clientX;
209209 shoot.shotY = e.clientY;
210210 shoot.shotR = 0;
@@ -213,7 +213,7 @@
213213 }
214214 }
215215
216- function dwaw() {
216+ function draw() {
217217 // 背景を塗りつぶし
218218 ctx.fillStyle = 'rgb(0,0,0)';
219219 ctx.fillRect(0, 0, 800, 600);
@@ -244,8 +244,8 @@
244244 </head>
245245 <body onload="init();">
246246 <canvas id="canvas" width="800" height="600"></canvas>
247- <img id="strip" src="strip.png" style="display:none;" />
248- <img id="scope" src="scope.png" style="display:none;" />
247+ <img id="strip" src="house.png" style="display:none;" />
248+ <img id="scope" src="scope.png" style="display:none;" />
249249 <audio id="explode" src="bomb.mp3"></audio>
250250 </body>
251251 </html>
\ No newline at end of file
Binary files /dev/null and b/WebContent/bomb.mp3 differ
Binary files a/WebContent/house.png and b/WebContent/house.png differ
Binary files a/WebContent/scope.png and b/WebContent/scope.png differ