Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

set rotation and origin phaser

function preload ()
{
    this.load.image('grid', 'assets/pics/debug-grid-1920x1920.png');
    this.load.image('atari', 'assets/sprites/atari130xe.png');
}

function create ()
{
    this.add.image(0, 0, 'grid').setOrigin(0);

    image1 = this.add.image(200, 320, 'atari'); // default origin is 0.5 = the center
    image2 = this.add.image(400, 320, 'atari').setOrigin(0);
    image3 = this.add.image(600, 320, 'atari').setOrigin(0.25, 0.75);
    image4 = this.add.image(800, 320, 'atari').setOrigin(1);
}

function update ()
{
    image1.rotation += 0.01;
    image2.rotation += 0.01;
    image3.rotation += 0.01;
    image4.rotation += 0.01;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: change y scale phaser 
Javascript :: regex tunisian phone number 
Javascript :: Disemvowel Trolls 
Javascript :: phaser grid align 
Javascript :: phaser random circle 
Javascript :: phaser wrap in camera bounds 
Javascript :: phaser enable pixel art 
Javascript :: phaser play animation with config.js 
Javascript :: append input using js 
Javascript :: Is he gonna survive 
Javascript :: js interview questions 
Javascript :: js undici fetch stream data 
Javascript :: declare 2 d vector js 
Javascript :: add filter category to react native flatslit 
Javascript :: moment js with nodejs 
Javascript :: javascript array includes 
Javascript :: what are array methods in javascript 
Javascript :: how to make a string in javascript 
Javascript :: js print 
Javascript :: change value in array react 
Javascript :: vue sidebar 
Javascript :: JavaScript HTML DOM Event 
Javascript :: python json replace string 
Javascript :: var function js 
Javascript :: react portal example 
Javascript :: react native fast image webp ios 
Javascript :: add role to channel discord.js 
Javascript :: show password using javascript 
Javascript :: twitter javascript api 
Javascript :: double bang js 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =