The display of special symbols of cocos2d JS WordArt

Source: Internet
Author: User

This.setsocreation (score, This.tfmoneylist[index],mun); To pass in fractions and objects, call the following function



Setsocreation:function (Num,artnumwidget) {


num = parseint (num);//Convert to int
var number = num;
if (num==0) return; Judgment is 0 direct return, do not execute the following code


if (num<0) {
num = "/" + num;
}else
num = "" + num;

var artnumsign = artnumwidget.getchildbyname ("artnumsign");//Gets the sub-object in the object, regardless of this, get the object can
Artnumsign.setpositionpercent (CC.P (0.5, 0.5));//Set Anchor point
var artnumresult = artnumsign.getchildbyname ("Artnumresult");
Determine the size of the digital jump display, two resources, less than 0 is red, negative points; greater than 0 is green, positive points (as shown)
if (number < 0) {
The first argument is the special symbol for the WordArt, the second argument is the path, the third to fourth is the width and height of the character, and the last is the first character of the resource, as shown in the first picture below
        Artnumsign.setproperty ("/", "Res/newimages/sign_02.png", 72, 72, ".");
Artnumresult.setproperty ("" + num, "Res/newimages/shuzi_02.png", 54, 91, "0");
} else {
Artnumsign.setproperty (".", "Res/newimages/sign_01.png", 72, 72, ".");
Artnumresult.setproperty ("" + num, "Res/newimages/shuzi_01.png", 54, 92, "0");
}

Artnumsign.setvisible (TRUE);

var act = cc.spawn (Cc.moveby (1,CC.P (0,ARTNUMSIGN.HEIGHT/2)));
var duration = 0.6;
Artnumsign.runaction (Cc.sequence (Cc.moveby (DURATION,CC.P (0,ARTNUMSIGN.HEIGHT/2)), Cc.callfunc (function () {// Perform an action to let the score jump display
Artnumwidget.setstring (BER);
}), Cc.delaytime (duration), Cc.callfunc (function () {
Artnumsign.setvisible (FALSE);
})));

},

Of course, you need to set up resources, to get objects in the project, to write examples can be

The effect of the implementation:

The display of special symbols of cocos2d JS WordArt

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.