0
私はゲームを書き込もうとしていると私は、関数の上映プレーヤーでの問題だ:私は、関数を呼び出したいとき呼び出す機能の悪い引数
showFurry=function(){
this.x = Math.floor(Math.random() * 10);
this.y = Math.floor(Math.random() * 10);
this.board[ this.position(this.furry.x , this.furry.y) ].classList.add('furry');
}
とコンソルで:
function Furry() {
this.board=document.querySelectorAll('#board div');
this.x = 0;
this.y = 0;
this.direction = "right";
}
とを
Uncaught TypeError: Cannot read property 'x' of undefined
https://jsfiddle.net/mdx3w24c/
:私はこれを得ましたこの状態で機能showFurryとshowCoinを呼び出した後、私はこれを受ける必要があります。
この小さな情報で誰もあなたを助けることはできませんどこから/いつ/なぜshowFurryが呼び出されているか、それはもっと大きなものの一部ですか、これはコンテキスト/ this ...などです。plsは完全なコード、jsbin/fiddleも大いに役立つでしょう;) – MarcelD
'this.furry.x'ではなく' this.x'を意味しますか? 'y'と同じ – bansi