Finger-guessing game:1 Scene Building

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.