Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

flip image on x axis phaser

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

function create ()
{
    //  Default non-flipped image
    this.add.image(250, 164, 'pic');

    //  Flipped via a call to setFlipX
    this.add.image(250, 464, 'pic').setFlipX(true);

    var image = this.add.image(650, 164, 'pic');

    //  Flipped via setting the flipX property
    image.flipX = true;

    var image2 = this.add.image(650, 464, 'pic');

    this.input.on('pointerdown', function () {

        //  Flipped via a call to toggleFlipX
        image2.toggleFlipX();

    });
}
Source by github.com #
 
PREVIOUS NEXT
Tagged: #flip #image #axis #phaser
ADD COMMENT
Topic
Name
4+5 =