@property({type : SpriteComponent})
public plane : SpriteComponent|null = null;
private score = 0;
update(deltaTime: number) {
let lblScore = this.node.getComponent(Label);
**if(this.plane.position.x > 113 && this.plane.position.x < 130)**
{
this.score += 1;
lblScore.string = "Score : " + this.score;
}
}
}
In the above code when ‘plane’ spritecomponent reaches certain position i want to update the score value. but “this.plane.position.x” doesn’t seem to work!!
what is the reason ? how do i get its position?