游戏的基本玩法:从"红色","黄色","绿色","蓝色","紫色","黑色",中随机选出一个字,然后将字的颜色设置成与文字不同的颜色,如:文字是红色,字体的颜色是黄色,然后让玩家选择字体的颜色,测试反应时间。
代码如下:
<span style="font-family:Courier New;">var MainLayer = cc.LayerColor.extend({
init:function()
{
//初始化界面
//0:点击开始界面 1:表示等待界面,2:表示在点击界面 3:结果界面 4:Too soon界面
this.flag = 0;
this._super();
this.size = cc.Director.getInstance().getWinSize();
this.setColor(cc.c4(180,170,160,255));
this.showToStart();
//可触摸
this.setTouchEnabled(true);
//一些常量
this.redColor = new Array(255, 0, 0);
this.yellowColor = new Array(255, 255, 0);
this.greenColor = new Array(0, 255, 0);
this.blueColor = new Array(0, 0, 255 );
this.purpleColor = new Array(139, 0, 255);
this.blackColor = new Array(0,0,0);
this.allColor = new Array(this.redColor,this.yellowColor,this.greenCol