CocosCreator of KUOKUO do with you using the Mask interesting loading map

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/kuokuo666/article/details/98988590
engine

CocosCreator v2.x

Mask

Mask for defining renderable range child node, the node will use the assembly with a Mask the node's bounding box (i.e. range Size property inspector Node predetermined assembly) to create a rendering mask, all the child nodes node will be tailored according to the mask, the mask will not be rendered outside the range.

Levels

Here Insert Picture Description

We look shield assembly here, pay attention to the node size Size
the Shape of any of the pictures you can do will make a variety of effects.
Here Insert Picture Description
Pictures given:
(bad eyes can not see, I did the shape upload pictures)
Here Insert Picture Description

script

Rotating script is simple, turn the parent node, child node reverse turn, ensures the child node does not move.

cc.Class({
    extends: cc.Component,

    properties: {
        mask: cc.Node
    },

    onLoad () {
        this.rotation = 0;
        this.speed = 100;
    },

    update (dt) {
        this.rotation += this.speed * dt;
        if (this.rotation > 360) this.rotation = 0;
        this.mask.rotation = this.rotation;
        this.mask.children[0].rotation = -this.rotation;
    },
});

effect

Here Insert Picture Description

O (∩_∩) O ~~

How kind, simple!

Add my blog :( QQ group inside the project, the group has a file oh)

706176551

we study together!

Guess you like

Origin blog.csdn.net/kuokuo666/article/details/98988590