• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Révision755aa619f6519a1a4db4174569a45284f7dedf93 (tree)
l'heure2016-12-16 21:38:41
AuteurYu Hayashi <yu011301@teca...>
CommiterYu Hayashi

Message de Log

600x600

Change Summary

Modification

--- a/WebContent/Asteroid.html
+++ b/WebContent/Asteroid.html
@@ -30,8 +30,8 @@
3030 }
3131
3232 function Ship() {
33- this.cx = 400;
34- this.cy = 400;
33+ this.cx = 300;
34+ this.cy = 300;
3535 this.w = 90;
3636 this.h = 60;
3737 this.dx = 0;
@@ -52,13 +52,18 @@
5252 getX: function() { return (this.cx - this.w / 2); },
5353 getY: function() { return (this.cy - this.h / 2); },
5454 isHit: function(o) {
55- return !(((o.getX() + o.w) < this.getX()) || ((this.getX() + this.w) < o.getX()) || ((o.getY() + o.h) < this.getY()) || ((this.getY() + this.h) < o.getY()));
55+ return !(((o.getX() + o.w) < this.getX())
56+ || ((this.getX() + this.w) < o.getX())
57+ || ((o.getY() + o.h) < this.getY())
58+ || ((this.getY() + this.h) < o.getY()));
5659 },
5760 update: function() {
58- this.cx = (this.cx + this.dx + 800) % 800;
59- this.cy = (this.cy + this.dy + 800) % 800;
61+ this.cx = (this.cx + this.dx + 600) % 600;
62+ this.cy = (this.cy + this.dy + 600) % 600;
6063 }
6164 }
65+
66+ function rand(r) { return Math.floor(Math.random() *r) }
6267
6368 function init() {
6469 ctx = document.getElementById('canvas').getContext('2d');
@@ -103,7 +108,7 @@
103108
104109 // 岩の初期化
105110 for (var i=0; i < level; i++) {
106- var x = rand(800), y = rand(800);
111+ var x = rand(600), y = rand(600);
107112 while(true) {
108113 var r = new Rock(x, y, 64);
109114 if (!r.isHit(ship)) {
@@ -138,8 +143,8 @@
138143 ship.dy = Math.sin(ship.rotate) * ship.poower;
139144 ship.update();
140145
141- bgX = (bgX + ship.dx / 2 + 1600) % 800;
142- bgY = (bgY + ship.dy / 2 + 1600) % 800;
146+ bgX = (bgX + ship.dx / 2 + 1200) % 600;
147+ bgY = (bgY + ship.dy / 2 + 1200) % 600;
143148
144149 // 弾丸の位置を更新
145150 var fire = false;
@@ -204,7 +209,8 @@
204209
205210 function draw() {
206211 // 背景を描画
207- ctx.drawImage(bg, bgX, bgY, 400, 400, 0, 0, 800, 800);
212+ var bg = document.getElementById("bg");
213+ ctx.drawImage(bg, bgX, bgY, 300, 300, 0, 0, 600, 600);
208214
209215 // 弾丸の描画
210216 ctx.fillStyle = 'rgb(0,255,255)';
@@ -241,9 +247,9 @@
241247 }
242248 </script>
243249 </head>
244- <body onload="iniit()">
250+ <body onload="init()">
245251 <div>
246- <canvas id="canvas" width="800" height="800"></canvas>
252+ <canvas id="canvas" width="600" height="600"></canvas>
247253 </div>
248254 <img id="ship" src="ship90x60.png" style="display:none" />
249255 <img id="bg" src="bg.png" style="display:none" />