[寄了个鸡]已放在壁纸引擎创意工坊

小黑子,漏出鸡脚了吧!

小鸡仔,漏出黑脚了吧

ikun不请自来,, :rofl: :rofl: :rofl:

Ikun粉没你不行 :joy: :joy: :joy:

鸡冠头,背带裤,我是ikun你记住

微信审核人员没有iKun吗,这游戏居然过审了 :2:

露出了鸡脚

我靠,IKUN无处不在,已经蔓延到cocos街区了

不知为啥,看到这个image 头像都能联想到蔡徐坤 :sweat_smile:

1赞

这音乐、音效、人物、、、给人的感觉太震撼了、、、哈哈 :sweat_smile: :sweat_smile: :sweat_smile: :sweat_smile:

哈哈哈,牛逼!

这也能认出来

什么是天王巨星啊, 搞个cocos 都有 ikun

image

小黑子越来越多了,或者说人人都是小黑子

十年ikun,不请自来

楼主您好,能求一下源码吗。帖子里说的算法已经付费了,还想了解下鸡场这个是咋搞的,刚接触cocos,比较小白

楼主说了啊,甚至楼主还专门@了小白程序员 (手动滑稽)

嗯嗯,谢谢提醒,我看到了呢,也已经付费购买了。但是那个只有关卡部分的算法,没有楼主这个鸡场一群鸡的实现,主要想向楼主请教下这个哈

一群鸡…其实就是画圆三个圆,加个tween动画…最后鸡群根据Y轴排个序…

我发代码吧…
“chicken_circle.ts”

import { _decorator, Component, Node, Vec2, Vec3, tween } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('yang_circle')
export class yang_circle extends Component {

    @property({
        type: Node,
        tooltip: "鸡群父节点"
    })
    chicken_parent: Node = null;

    @property({
        tooltip: "鸡群中心点"
    })
    center_v2: Vec2 = new Vec2(0, 0);

    @property({
        tooltip: "鸡群间隔角度"
    })
    chicken_angular: number = 5;

    start() {
        this.show_chicken_circle();
    }

    update(deltaTime: number) {
    }

    /** 显示 鸡圈 */
    show_chicken_circle() {
        this.chicken_parent.children.forEach((element: Node, index: number) => {
            if (index < 6) {
                this.set_point_on_circle(index * (360 / 6), element, 0.2, 100);
            } else if (index < 18) {
                this.set_point_on_circle(index * (360 / 12), element, 0.4, 200);
            } else if (index < 36) {
                this.set_point_on_circle(index * (360 / 18), element, 0.6, 300);
            }
        });
        // 排序渲染层级
        this.sort_children();
    }

    /**
     * 排列子节点
     * @param jiaodu   角度
     * @param _node     节点
     * @param _delay_time   等待时间
     * @param _ani_radius   半径
     */
    set_point_on_circle(jiaodu: number, _node: Node, _delay_time: number = 0, _ani_radius: number = 0) {
        // 根据时间,计算角度,的弧度值  弧度 = 角度* (2 * Math.PI / 360);
        var new_hudu = jiaodu * (2 * Math.PI / 360);
        // 根据弧度(角度),半径,计算坐标点
        var _x = Math.sin(new_hudu) * _ani_radius;
        var _y = Math.cos(new_hudu) * _ani_radius;
        // 将节点设置在该位置
        _node.setPosition(new Vec3(_x, _y, 0));
        // 播放动画,从小变大
        _node.setScale(new Vec3(0, 0, 1));
        tween()
            .target(_node)
            .delay(_delay_time)
            .to(0.1, { scale: new Vec3(1, 1, 1) })
            .to(0.1, { scale: new Vec3(0.9, 0.9, 1) })
            .start()
    }

    /**
     * 根据Y值设置zindex
     */
    sort_children() {
        var _ch: Node[] = [].concat(this.chicken_parent.children);
        _ch.sort(function (a, b) {
            if (a.position.y < b.position.y) {
                return 1
            } else {
                return -1
            }
        });
        _ch.forEach((element, index) => {
            element.setSiblingIndex(index);
        });
    }
}