Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

phaser 60 fps animation test

 preload ()
    {
        this.load.atlas('walker', 'assets/animations/walker.png', 'assets/animations/walker.json');
        this.load.image('sky', 'assets/skies/ms3-sky.png');
        this.load.image('trees', 'assets/skies/ms3-trees.png');
    }

    create ()
    {
        this.bg = this.add.tileSprite(0, 38, 800, 296, 'sky')
            .setOrigin(0, 0);
        this.trees = this.add.tileSprite(0, 280, 800, 320, 'trees')
            .setOrigin(0, 0);

        const animConfig = {
            key: 'walk',
            frames: 'walker',
            frameRate: 60,
            repeat: -1
        };
        this.anims.create(animConfig);

        const sprite = this.add.sprite(400, 484, 'walker', 'frame_0000');
        sprite.play('walk');
    }

    update ()
    {
        this.bg.tilePositionX -= 2;
        this.trees.tilePositionX -= 6;
    }
Comment

PREVIOUS NEXT
Code Example
Javascript :: phaser animation get progress 
Javascript :: phaser create animation from texture atlas 
Javascript :: phaser generate frame names 
Javascript :: phaser animation on update event 
Javascript :: phaser sprite animation event 
Javascript :: append input using js 
Javascript :: como usar variables en selector jquery 
Javascript :: core.mjs:4057 JIT compilation failed for NgModule class AppModule 
Javascript :: scan token deploy js 
Javascript :: Expresion regular para validar contraseñas 
Javascript :: show json preformatted 
Javascript :: membuat validasi form dengan javascript 
Javascript :: Return characters in a string in alphabetic order 
Javascript :: javascript show alert if browser is not google chrome 
Javascript :: this javascript 
Javascript :: delete parent js 
Javascript :: javascript filter example 
Javascript :: js date 
Javascript :: nextjs app 
Javascript :: anti aliasing 
Javascript :: underscore.js 
Javascript :: remove duplicates array javascript 
Javascript :: javascript make do while loop 
Javascript :: react portal example 
Javascript :: javascript pass array by value 
Javascript :: api integration for web pages in next js 
Javascript :: login js 
Javascript :: how to build a string javascript es6 
Javascript :: discord.js add role command 
Javascript :: initiate node js app 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =