1. Create a UI using cocostudio, create a UI, and add a LabelAtlas and a LabelBMFont respectively. Export the project, save it as cocos2d3sampleui_playScene.ExportJson, and add it to the Resource Directory of xcode together with the related Resource files. You may need to pay attention to this. But when adding resources, if no directory is used in the code, select "Create folder reference for any added folders" when adding resources ", in this way, a blue group will be created in the project, rather than a real sub-directory. 2. coding is implemented in HelloWorldScene. h: add the relevant variable declaration, // number of emission int numShootProjectile; UILabelAtlas * shootNumLabelAtlas; UILabelBMFont * scoreLabelbMFont; the variable name must be consistent with the control name set in UIEditor for encoding. In HelloWorldScene. add the following code before returning in init in cpp: UILayer * layer = UILayer: create (); auto widget = dynamic_cast <UIWidget *> (cocostudio: GUIReader :: shareReader ()-> widgetFromJsonFile ("cocos2d3sampleui_playScene.ExportJson"); widget-> setSize (Size (480,320); layer-> addWidget (widget); this-> addChild (layer ); this-> shootNumLabelAtlas = dynamic_cast <UILabelAtlas *> (widget-> getChildByName ("shootNumLabelAtlas"); t His-> shootNumLabelAtlas-> setStringValue ("0"); this-> shootNumLabelAtlas-> setPosition (Point (50, winSize. height-50); this-> scoreLabelbMFont = dynamic_cast <comment *> (widget-> getChildByName ("scoreLabelbMFont"); this-> scoreLabelbMFont-> setPosition (Point (winSize. width-100, winSize. height-50); this-> scoreLabelbMFont-> setText ("Score: 0"); numShootProjectile = 0; after the two controls are loaded, the center is automatically placed in the vertical direction. Why? Take the name of the control and save the reference to the variable. It should be noted that the variables declared in c ++ must be initialized. For example, if numShootProjectile = 0 is not initialized, the variable may be any value. In onTouchesEnded, after launching a dart, add 1 to the number and set a number in the text box. The Code is as follows: numShootProjectile ++; char numShootStr [20]; sprintf (numShootStr, "% d", numShootProjectile); this-> shootNumLabelAtlas-> setStringValue (numShootStr ); in c ++, you can use std: atoi to convert string to int, but in turn, itoa is not supported and provided by all compilers. This function (itoa) is not defined in ANSI-C and is not part of C ++, but is supported by some compilers. in update, add the code for updating the Score: char scoreStr [20]; sprintf (scoreStr, "Score: % d", targetDestroyed ); this-> scoreLabelbMFont-> setText (scoreStr );