cocoscreator大转盘

@ccclass
export default class NewClass extends cc.Component {

@property(cc.Node)
Point:cc.Node = null;

start () {

}

PointClick()
{
  //大转盘转动的角度数组
  let randoms: number[] = [360,396,432,468,504,540,576,612,648,684] ;
  //随机数组下标 保证指针转动的角度都是36的倍数
  var action = cc.rotateBy(4,randoms[Math.floor(Math.random()*10)]);
  cc.log(randoms[Math.floor(Math.random()*10)]);
  this.Point.runAction(action);
}

// update (dt) {}

}

image.png

你可能感兴趣的:(cocoscreator大转盘)