Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

flip image on y 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 setFlipY
    this.add.image(250, 464, 'pic').setFlipY(true);

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

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

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

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

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

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