Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

set position 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);

    //  Images are positioned at x,y based on the center of the image

    var x = 320;
    var y = 100;

    this.add.image(x, y, 'atari');

    //  You can also use the x and y properties:

    var image2 = this.add.image(0, 0, 'atari');

    image2.x = 640;
    image2.y = 200;

    //  Or the setPosition method, which allows for chaining:

    this.add.image(0, 0, 'atari').setPosition(320, 320);
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: change xy scale phaser 
Javascript :: maximum product of word lengths leetcode solution 
Javascript :: Alternate capitalization 
Javascript :: how to generate random 6 digit charecter in js for coupon 
Javascript :: phaser place on triangle 
Javascript :: phaser spread 
Javascript :: phaser create animation from sprite config.js 
Javascript :: phaser play animation after repeat 
Javascript :: javascript multiplication without operator 
Javascript :: swr vs axios 
Javascript :: JAVASCRIPT CHEATSHEET 1 
Javascript :: js undici fetch data async 
Javascript :: show json preformatted 
Javascript :: condition rendering using if-else 
Javascript :: the document has mutated since the result was returned 
Javascript :: usestate access previous state 
Javascript :: shallow copy and deep copy in javascript 
Javascript :: filter 
Javascript :: javascript basic programs 
Javascript :: vuejs 
Javascript :: setimmediate node example 
Javascript :: tofixed in javascript 
Javascript :: how to use the javascript console 
Javascript :: js date minus 18 years 
Javascript :: how do you pass props between components 
Javascript :: autofocus is not working in react native 
Javascript :: create responsive navbar without javascript 
Javascript :: Liquid shopify 
Javascript :: calculate days between two dates in javascript 
Javascript :: change string with string js 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =