Jump to content

How to make a close button for menu


Recommended Posts

I recently made a pop-up menu for my game which pops up after pushing a button. The problem is now that I need to figure out how to make a function that closes the menu. Here is the code:

this.input.keyboard.once("keydown_D", event => {
	var StoreWindow = this.add.image(0, 0, 'StoreWindow').setOrigin(0);
    var backbutton = this.add.image(32, 34, 'backbutton', 0).setOrigin(0).setInteractive();
    var testButton = this.add.image(64, 110, 'testButton', 0).setOrigin(0).setInteractive();

    var storeContainer = this.add.container(32, 70, [ StoreWindow, backbutton, testButton]);

    storeContainer.setInteractive(new Phaser.Geom.Rectangle(0, 0, StoreWindow.width, StoreWindow.height), Phaser.Geom.Rectangle.Contains);


    storeContainer.on('drag', function (pointer, dragX, dragY) {

        this.x = dragX;
        this.y = dragY;

    backbutton.on('pointerup', function (storeContainer) {


    }, this);



Link to comment
Share on other sites


  • Recently Browsing   0 members

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