Jump to content

Don`t see text in container


holysheepcoder
 Share

Recommended Posts

let width = this.game.config.width;
let height = this.game.config.height;
       
        let startGameText = this.make.text(findGameButtonText).setOrigin(0.5, 0.5);       
        let startGameButton = this.add.sprite(0, 0, 'ui-spritesheet-blue', 'blue_button00.png');
        let startGameContainer = this.add.container(0, 0, [
            startGameButton,
            startGameText
        ]);      
        startGameContainer.setSize(190, 50).setInteractive();

        let optionsText = this.make.text(menuOptionsButtonText).setOrigin(0.5, 0.5);
        let optionsButton = this.add.sprite(0, 0, 'ui-spritesheet-blue', 'blue_button00.png');
        let optionsContainer = this.add.container(0 + 200, 0, [
            optionsText,
            optionsButton
        ]);
        optionsContainer.setSize(190, 50).setInteractive();   
        let mainMenuButtons = this.add.container(width / 2, height / 2 + 200, [
            startGameContainer,
            optionsContainer
        ]);

        mainMenuButtons.setSize(width, 50);

 

Options for texts

export const menuOptionsButtonText = {
    x: 0,
    y: 0,
    text: 'Options',
    style: {
        fontSize: '16px',
        fontFamily: 'Monospace',
        color: '#ffffff',
        align: 'center',       
        shadow: {
            color: '#000000',
            fill: true,
            offsetX: 2,
            offsetY: 2,
            blur: 8
        }
    }
};
export const findGameButtonText = {
    x: 0,
    y: 0,
    text: 'Start game',
    style: {
        fontSize: '16px',
        fontFamily: 'Monospace',
        color: '#ffffff',
        align: 'center',      
        shadow: {
            color: '#000000',
            fill: true,
            offsetX: 2,
            offsetY: 2,
            blur: 8
        }
    }
}

I can not understand why the text "Options" is not displayed

aaaaaa.png

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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