Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

phaser increment x layers

create ()
    {
        this.groupA = this.add.group();
        this.groupB = this.add.group();

        for (var i = 0; i < 1000; i++)
        {
            this.groupA.create(100 + Math.random() * 600, 100 + Math.random() * 400, 'atlas', 'veg0' + Math.floor(1 + Math.random() * 9));
        }

        for (var i = 0; i < 1000; i++)
        {
            this.groupB.create(100 + Math.random() * 600, 100 + Math.random() * 400, 'atlas', 'veg0' + Math.floor(1 + Math.random() * 9));
        }
    }

    update ()
    {
        Phaser.Actions.IncX(this.groupA.getChildren(), Math.cos(this.move));
        Phaser.Actions.IncY(this.groupA.getChildren(), Math.sin(this.move));
        Phaser.Actions.Rotate(this.groupA.getChildren(), -0.01);

        Phaser.Actions.IncX(this.groupB.getChildren(), -Math.cos(this.move));
        Phaser.Actions.IncY(this.groupB.getChildren(), -Math.sin(this.move));
        Phaser.Actions.Rotate(this.groupB.getChildren(), 0.01);

        this.move += 0.01;
    }
Comment

PREVIOUS NEXT
Code Example
Javascript :: phaser place on ellipse 
Javascript :: phaser place on triangle 
Javascript :: phaser rotate around x y point 
Javascript :: phaser 60 fps animation test 
Javascript :: phaser create animation without frame names 
Javascript :: phaser animation on stop event 
Javascript :: phaser tween timescale 
Javascript :: iterate cy.get(') elements 
Javascript :: Exercice âge JavaScript 
Javascript :: how to invoke a function in a class 
Javascript :: how to map elements from 1st object react js 
Javascript :: show json preformatted 
Javascript :: function Tom(a, b) { return a + b; } 
Javascript :: vue mount modal to body 
Javascript :: decimal to hex 
Javascript :: format numbers js 
Javascript :: regex capture group example 
Javascript :: function generator js 
Javascript :: if else javascript 
Javascript :: react native smart splash screen 
Javascript :: how to turn a string into an array javascript 
Javascript :: click function in js 
Javascript :: javascript remove the last element from array 
Javascript :: install tailwind css with next js 
Javascript :: get the max value from array js 
Javascript :: js flatten 
Javascript :: ajax form submit 
Javascript :: mdn react 
Javascript :: find the length and the last character of string in js 
Javascript :: how to break from map in javascript 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =