rSilva28 Posted March 23, 2020 Share Posted March 23, 2020 I am trying to make a toggle button. So I made a spriteSheet with the two frames with the positions that the button can have. this.load.spritesheet('buttontog', 'assets/tbspr.png', {frameWidth: 160, frameHeight: 47}); It works when I click it once, toggling it. this.buttontog = this.add.sprite(660,420, 'buttontog', this.frame = 0) .setInteractive({useHandCursor: true}) .on('pointerup', () => {if (this.frame == 0) this.buttontog.setFrame(1); if(this.frame == 1) this.buttontog.setFrame(0);}); What I can't do is to "untoggle" it, and is why I am here, so I can ask for your help. since I am new to this framework. This is the spriteSheet: Link to comment Share on other sites More sharing options...
Recommended Posts