cc.Class({ extends: cc.Component, properties: { }, setPercentage(percentage) { let newHeight = this.castPercentageToHeight(percentage); this.node.setPosition(this.node.position.x,newHeight); }, castPercentageToHeight(percentage) { return this.node.height/100*percentage; }, });