How to use the globals.commonInfo function in globals

To help you get started, we’ve selected a few globals examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yl1033669613 / game_with_cocosCreater / assets / script / aircraft_war_js / hero.js View on Github external
onLoad() {
        const manager = cc.director.getCollisionManager();
        manager.enabled = true;
        this.curState = Gdt.commonInfo.gameState.none;
        this.currX = 0;
        this.currY = 0;
        this.onDrag();
        //setting hero pos
        this.node.x = 0;
        this.node.y = -(this.node.parent.height / 2) + (this.node.height / 2) + 12;
        this.setHeroHpPregress();
    },
    onDrag() {
github yl1033669613 / game_with_cocosCreater / assets / script / aircraft_war_js / enemy.js View on Github external
update(dt) {
        if (this.enemyGroup.curState != Gdt.commonInfo.gameState.start) return;
        if (this.hP == 0) return;
        let ndX = this.node.x;
        ndX += dt * this.xSpeed;
        if (ndX <= -(this.node.parent.width - this.node.width) / 2) {
            ndX = (this.node.parent.width - this.node.width) / 2;
            this.xSpeed = -this.xSpeed;
        } else if (ndX >= (this.node.parent.width - this.node.width) / 2) {
            ndX = (this.node.parent.width - this.node.width) / 2;
            this.xSpeed = -this.xSpeed;
        } else {
            this.node.x = ndX;
        };
        let scores = this.enemyGroup.getScore();
        if (this.enemyType == 1) {
            if (scores <= 500000) {
                this.node.y += dt * this.ySpeed;
github yl1033669613 / game_with_cocosCreater / assets / script / aircraft_war_js / bullet_group.js View on Github external
onLoad() {
        this.curState = Gdt.commonInfo.gameState.none;
        this.isDeadBullet = false;
        //初始化无限子弹组
        Gdt.common.initObjPool(this, this.bulletInfinite);
        //初始化有限子弹组
        Gdt.common.batchInitObjPool(this, this.bulletFiniteG);
    },
github yl1033669613 / game_with_cocosCreater / assets / script / aircraft_war_js / enemy_group.js View on Github external
startAction() {
        this.curState = Gdt.commonInfo.gameState.start;
        //定时生成敌机
        for (let i = 0; i < this.enemyG.length; ++i) {
            let freqTime = this.enemyG[i].freqTime;
            let fName = 'callback_' + i;
            this[fName] = function(e) { this.getNewEnemy(this.enemyG[e]) }.bind(this, i);
            this.schedule(this[fName], freqTime);
        }
    },
    //重新开始
github yl1033669613 / game_with_cocosCreater / assets / script / aircraft_war_js / scroll_bg.js View on Github external
update(dt) {
        if (this.main.curState == Gdt.commonInfo.gameState.start) {
            this.bgMove(dt)
        }
    }
})
github yl1033669613 / game_with_cocosCreater / assets / script / aircraft_war_js / main.js View on Github external
onLoad() {
        this.score = 0;
        this.bombNo = 0;
        this.isGameOver = false;
        this.scoreDisplay.string = this.score;
        this.bombNoDisplay.string = this.bombNo;
        this.curState = Gdt.commonInfo.gameState.start;
        this.bestScore = Utils.GD.userGameInfo.aircraftWarBestScore || 0;
        this.maskBestScore.string = 'Best Score: ' + this.bestScore;

        this.bulletGroup.startAction();
        this.enemyGroup.startAction();
        this.bomb.on(cc.Node.EventType.TOUCH_START, this.bombOnclick, this);
    },
    bombOnclick() {
github yl1033669613 / game_with_cocosCreater / assets / script / aircraft_war_js / enemy_group.js View on Github external
onLoad() {
        //初始化敌机组
        this.curState = Gdt.commonInfo.gameState.none;
        Gdt.common.batchInitObjPool(this, this.enemyG);
    },
    startAction() {
github yl1033669613 / game_with_cocosCreater / assets / script / aircraft_war_js / bullet.js View on Github external
update(dt) {
        if (this.bulletGroup.curState != Gdt.commonInfo.gameState.start) return;
        this.node.x += dt * this.xSpeed;
        this.node.y += dt * this.ySpeed;
        if (this.node.y > this.node.parent.height / 2) this.bulletGroup.bulletDied(this.node);
    }
})
github yl1033669613 / game_with_cocosCreater / assets / script / aircraft_war_js / enemy_bullet_group.js View on Github external
pauseAction() {
        this.enabled = false;
        this.curState = Gdt.commonInfo.gameState.pause;
    },
    resumeAction() {
github yl1033669613 / game_with_cocosCreater / assets / script / aircraft_war_js / buff_group.js View on Github external
resumeAction() {
        this.enabled = true;
        this.curState = Gdt.commonInfo.gameState.start;
    },
    //暂停