Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Handle button hover in Phaser 3?


eddieone
 Share

Recommended Posts

var button;

function preload()
{

this.load.spritesheet( 'btn' , 'assets/playgame.png' ,{frameWidth:256,frameHeight:64});
}


function create ()
{

button=this.add.sprite(400,300,'btn').setInteractive();

button.on('pointerover',function(pointer){
    button.setFrame(1);
})

button.on('pointerout',function(pointer){
    button.setFrame(0);
})
}

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...