获取不了屏幕的宽度

我是新手,按着教程来做,做到星星的那一步时,发出星星的坐标不对,之后逐步查,发出得不到屏幕的宽~求助!

getNewStarPosition:function(){
var randX = 0;
var randY = this.groundY+cc.random0To1()*this.player.getComponent(‘Player’).jumpHeight +200;

    var maxX = this.node.width/2;
    randX = cc.randomMinus1To1() * maxX;
    console.log(randX+"  &   "+randY);
    
    console.log(this.node.width);
    return cc.p(randX,randY);

this.node.width 这一句输出为0

你看这个node的大小呢

node大小可以看一下,默认值是不是变成0了,这个大小和图片大小也不一定匹配的

怎么解决的?我也遇到了