Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

phaser place on rectangle shift

preload ()
    {
        this.load.spritesheet('balls', 'assets/sprites/balls.png', { frameWidth: 17, frameHeight: 17 });
    }

    create ()
    {
        this.rect = new Phaser.Geom.Rectangle(64, 32, 100, 512);

        this.group = this.add.group({ key: 'balls', frame: [0,1,2,3,4,5], frameQuantity: 10 });
        this.tweens.add({
            targets: this.rect,
            x: 200,
            y: 200,
            width: 512,
            height: 100,
            delay: 2000,
            duration: 3000,
            ease: 'Sine.easeInOut',
            repeat: -1,
            yoyo: true
        });
    }

    update ()
    {
        Phaser.Actions.PlaceOnRectangle(this.group.getChildren(), this.rect, this.i);

        this.i++;
        if (this.i === this.group.length)
        {
            this.i = 0;
        }
    }
Comment

PREVIOUS NEXT
Code Example
Javascript :: phaser random ellipse 
Javascript :: phaser rotate around x y point 
Javascript :: phaser wrap in camera bounds 
Javascript :: phaser chained animation 
Javascript :: phaser mixed animation 
Javascript :: phaser animation random delay 
Javascript :: How to call the API when the search value changes 
Javascript :: refresh secounds 
Javascript :: permissions in chrome extension javascript 
Javascript :: nodejs where multiple condition findAll 
Javascript :: hook use effect with class 
Javascript :: filter text js 
Javascript :: javascript change IFormFile to base64string 
Javascript :: get elements by class name wildcard 
Javascript :: javascript array includes 
Javascript :: javascript every nested array 
Javascript :: sort function explained javascript 
Javascript :: comentar en javascript 
Javascript :: kafkajs 
Javascript :: printing in javascript 
Javascript :: type js 
Javascript :: find function in javascript 
Javascript :: js array split 
Javascript :: reach last array js 
Javascript :: for loop in react native 
Javascript :: react native loop in render 
Javascript :: add 7 days in date using jquery 
Javascript :: how to display message in javascript 
Javascript :: how to add space between words in javascript 
Javascript :: setting up a react environment 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =