How to use the level/config.horizon function in level

To help you get started, we’ve selected a few level 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 devyumao / super-ginger / src / level / Stick.js View on Github external
Stick.prototype.update = function () {
        var game = this.game;

        if (this.image) {
            // 销毁废弃, 并将当前置于废弃
            this.trash && this.trash.destroy(false);
            this.trash = this.image;
        }

        // 创建新贴图
        var image = game.add.tileSprite(
            config.currEdgeX, game.height - config.horizon,
            5, 0.001, // 虽然初始无长度, 但仍要设置个小值, 以避免 tileSprite 的渲染问题
            this.texture
        );
        image.anchor.set(0.5, 1);
        this.image = image;
    };
github devyumao / super-ginger / src / level / Stage.js View on Github external
Stage.prototype._createSpot = function (pillar) {
        var spot = this.game.add.image(pillar.width / 2, this.height - config.horizon, 'spot');
        spot.width = this.spotWidth;
        spot.anchor.set(0.5, 0);
        pillar.addChild(spot);

        return spot;
    };
github devyumao / super-ginger / src / level / Hero.js View on Github external
Hero.prototype.setForPlay = function (useTween, cb) {
        var game = this.game;

        var x = config.currEdgeX + this.paddingRight;
        var y = game.height - config.horizon;

        if (useTween) {
            var move = game.add.tween(this.sprite)
                .to({x: x, y: y}, 200, Phaser.Easing.Linear.None);
            move.onComplete.add(
                function () {
                    this.down();
                    cb && cb();
                },
                this
            );
            this._act('walk', true);
            move.start();
        }
        else {
            var sprite = this.sprite;