if ($("#canvas").css('background-image') == 'url(images/endOfGame.jpg)') {
動作しません。しかし、これは:
var element = document.getElementById('canvas');
var style = window.getComputedStyle(element);
var imagex = style.getPropertyValue('background-image');
console.log(imagex);
if (imagex === "url(file:///C:/Users/Jack/Documents/myGames/Pong/images/endOfGame.jpg)") {
これはしません:
var element = document.getElementById('canvas');
var style = window.getComputedStyle(element);
var imagex = style.getPropertyValue('background-image');
console.log(imagex);
if (imagex === "url(images/endOfGame.jpg)") {
なぜ?ゲームを実行するすべてのコンピューターの完全なファイル パス コードを変更する必要があります。良くない。
ありがとう。