[]获取Sprite位置问题
class Plant extends Laya.Sprite
{
public body :Laya.Animation;
constructor(){
super();
this.body = new Laya.Animation();
Laya.Animation.createFrames(["res/war/hero_fly1.png","res/war/hero_fly2.png"],"fly");
this.addChild(this.body);
this.body.play(0,true,"fly");
//获取动画大小区域
var bound:Laya.Rectangle = this.body.getBounds();
//this.pos(100,0);
console.log(-bound.width/2 + " --- "+ -bound.height/2);
}
onPlayComplete():void{
}
}
请问为啥bound.width bound.heigh这是0?
{
public body :Laya.Animation;
constructor(){
super();
this.body = new Laya.Animation();
Laya.Animation.createFrames(["res/war/hero_fly1.png","res/war/hero_fly2.png"],"fly");
this.addChild(this.body);
this.body.play(0,true,"fly");
//获取动画大小区域
var bound:Laya.Rectangle = this.body.getBounds();
//this.pos(100,0);
console.log(-bound.width/2 + " --- "+ -bound.height/2);
}
onPlayComplete():void{
}
}
请问为啥bound.width bound.heigh这是0?
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
Laya_XSN
赞同来自: 流星win