问答详情
源自:1-4 身体变白

baby.js:104 Uncaught TypeError: Cannot read property 'width' of undefined

源码是这样的:

var babyBodyCount = this.babyBodyCount;

ctx1.drawImage(babyBoby[babyBodyCount], -babyBoby[babyBodyCount].width * 0.5+23, -babyBoby[babyBodyCount].height * 0.5);

报错如下:

baby.js:104 Uncaught TypeError: Cannot read property 'width' of undefined

    at babyObj.draw (baby.js:104)

    at gameloop (main.js:111)

    at game (main.js:37)


提问者:时研冰 2020-01-18 05:12

个回答

  • 精慕门3520885
    2020-02-17 00:49:41

    是不是main.js文件里用来存放图片的数组babyBody没有定义,或者定义错了?