Scene Setup
//initializing the legend componentInit ("Div_caiquan", 800, 400, main);//define the game layer//Game background layer, result display layer, click LayervarBacklayer, Resultlayer, Clicklayer;//Initialize the callback functionfunctionMain () {Gameinit ();};//Game initialization FunctionfunctionGameinit () {//Game Background Layer initializationInitbacklayer (); //result display layer initializationInitresultlayer (); //initialization of the operation layerInitclicklayer ();};functionInitbacklayer () {//Create a game background layer objectBacklayer =NewLsprite (); //Add to CanvasAddChild (Backlayer); //draw the game interface background, use the sprite's graphic drawingBackLayer.graphics.drawRect, ' #008800 ', [0, 0, Lglobal.width, Lglobal.height],true, ' #000000 ');};functionInitresultlayer () {//Create a result display Layer objectResultlayer =NewLsprite (); //Draw the result display layer, using the graphic drawing of the spriteResultLayer.graphics.drawRect (4, ' #ff8800 ', [0, 0, 150, 110],true, ' #ffffff '); //Set the result display layer positionResultlayer.x = 10; Resultlayer.y= 100; //add to Game background layerBacklayer.addchild (Resultlayer);};functionInitclicklayer () {//create an action-level objectClicklayer =NewLsprite (); //draw the operation layer, using the graphic drawing of the spriteClickLayer.graphics.drawRect (4, ' #ff8800 ', [0, 0, 300, 110],true, ' #ffffff '); //set the operation layer Display coordinatesClicklayer.x = 250; Clicklayer.y= 275; //add to Game background layerAddChild (Clicklayer);};
Finger-guessing game:1 Scene Building