Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

set image size phaser


function preload ()
{
    this.load.image('frame', 'assets/pics/scrollframe.png');
    this.load.image('pic', 'assets/pics/cougar-face-of-nature.png');
}

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

    //  setDisplaySize will adjust the scale of an image to make it fit the given pixel dimensions:

    this.add.image(32, 32, 'pic').setOrigin(0).setDisplaySize(352, 240);
}
Source by github.com #
 
PREVIOUS NEXT
Tagged: #set #image #size #phaser
ADD COMMENT
Topic
Name
1+2 =