JavaScript (および一般的なプログラミング) が初めてで、作成中の Web ゲームでさまざまなキャラクターをスポーンさせようとしています。これは、スプライトのさまざまなセクションとして表されます。
どうすればこれを達成できるのだろうと思っていましたか?
スコアが上がるので、少なくとも座標を変更しようとしましたが、クラックできませんでした。
function Enemy(nX, nY) {
this.srcX = nX; //i was trying to sub
this.srcY = nY;
this.width = 172;
this.height = 68;
this.speed = 2;
this.drawX = Math.floor(Math.random() * 1000) + gameWidth;
this.drawY = Math.floor(Math.random() * 360);
this.rewardPoints = 5;
}
これが残り半分
Enemy.prototype.draw = function () {
this.drawX -= this.speed;
ctxEnemy.drawImage(imgSprite,this.srcX,this.srcY,this.width,this.height,this.drawX,this.drawY,this.width,this.height);
this.checkEscaped();
};
ここで全容を見ることができます。http://dev.yeahnah.tv/gina2/ (公正な警告: かなり悪いです。)
乾杯!