それで、私は自分のゲーム エンジンでスクロール シューティング ゲームの例を作ろうとしてきましたが、奇妙なことに遭遇しました。描こうとしている特定の画像が表示されません。Chrome のリソースに表示されるため、パスの問題ではありません。また、表示しようとしている他のすべての画像も表示されます。誰かが私を助けることができれば、それはありがたいです。=)
参照用リンク:
http://pandamochi.x10.bz/scrollingshooter.html
描画用コード:
ctx.save();
if (this.sprite != ""){
ctx.translate(Math.round(this.x-ds_view.x), Math.round(this.y-ds_view.y));
ctx.scale(this.scaleX,this.scaleY);
ctx.rotate(this.rotateZ);
ctx.translate(-this.width/2,-this.height/2);
ctx.drawImage(this.sprite, this.width*this.sprite_index, 0, this.width, this.height, 0, 0, this.width, this.height);
}
ctx.restore();
私が設定するために使用したコード:
enemy.setSprite("images/ship.png",1,4,10);