Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

phaser shift position

preload ()
    {
        this.load.image('sky', 'assets/skies/deepblue.png');
        this.load.image('ball', 'assets/demoscene/ball-tlb.png');
    }

    create ()
    {
        this.add.image(0, 0, 'sky')
            .setOrigin(0);
        this.group = this.add.group({ key: 'ball', frameQuantity: 128 });

        this.input.on('pointermove', function (pointer) {
            this.x = pointer.x;
            this.y = pointer.y;
        }, this);
    }

    update (time, delta)
    {
        this.move += delta;
        if (this.move > 6)
        {
            Phaser.Actions.ShiftPosition(this.group.getChildren(), this.x, this.y);
            this.move = 0;
        }
    }
Source by github.com #
 
PREVIOUS NEXT
Tagged: #phaser #shift #position
ADD COMMENT
Topic
Name
7+1 =