• 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ónd016b2129957d940a3549f8a355a436145652e38 (tree)
Tiempo2016-12-12 11:15:47
AutorYu Hayashi <yu011301@teca...>
CommiterYu Hayashi

Log Message

FIX Aliens

Cambiar Resumen

Diferencia incremental

--- a/WebContent/Aiens.html
+++ b/WebContent/Aiens.html
@@ -33,10 +33,10 @@
3333 function Ship() {
3434 this.x = 0;
3535 this.y = 550;
36- this.offfset = 192;
36+ this.offset = 192;
3737 this.moveL = false;
3838 this.moveR = false;
39- this.isEven = function() { return true;}
39+ this.isEven = function() { return true; }
4040 }
4141
4242 var bitmap = {
@@ -107,7 +107,7 @@
107107 }
108108
109109 function alienLoop() {
110- var minX = Infinity.maxX = 0, maxY = 0;
110+ var minX = Infinity, maxX = 0, maxY = 0;
111111
112112 Alien.isEven = !Alien.isEven;
113113
@@ -190,7 +190,7 @@
190190 }
191191
192192 // update bombs and check if it hits the ship
193- bombx.forEach(function (b) {
193+ bombs.forEach(function (b) {
194194 if (b.time < clock) {
195195 var a =aliens[rand(aliens.length)];
196196 b.x = a.x, b.y = a.y + 30;
@@ -201,13 +201,17 @@
201201 }
202202 b.even = !b.even;
203203 if (b.x - 15 < ship.x && ship.x < b.x + 15 && 530 < b.y && b.y < 550) {
204- gameOver();}
204+ gameOver();
205205 }
206206 });
207207
208208 // move the ship
209- if (ship.moveR) {ship.x = Math.min(ship.x + 5, 570); }
210- if (ship.moveL) { ship.x = Math.max(ship.x - 5.0); }
209+ if (ship.moveR) {
210+ ship.x = Math.min(ship.x + 5, 570);
211+ }
212+ if (ship.moveL) {
213+ ship.x = Math.max(ship.x - 5.0);
214+ }
211215
212216 draw();
213217 }
@@ -227,6 +231,11 @@
227231
228232 // draw beam
229233 beam.draw(ctx);
234+
235+ // drow bombs
236+ bombs.forEach(function (b) {
237+ b.draw(ctx);
238+ });
230239
231240 // draw score
232241 ctx.fillStyle = 'rgb(0,255,0)';
@@ -236,7 +245,7 @@
236245 ctx.fillText('STAGE CLEAR', 200, 150);
237246 }
238247 if (isNaN(mainT)) {
239- ctx.fillText("GAME OVER", 220, 250);
248+ ctx.fillText("GAME OVER", 220, 150);
240249 }
241250 }
242251 </script>