HTML moving phaser into container div

后端 未结 3 749
北荒
北荒 2021-02-04 05:52

Currently making up a browser based game in phaser and trying to add it into the container div tag I\'ve created however phaser seems to be pushing itself to below

3条回答
  •  清歌不尽
    2021-02-04 06:23

    For Phaser3 you can specify parent id in configuration object

    const config = {
        width: 800, height: 600,
        ...
        parent: 'element-id'
    };
    
    new Phaser.Game(config);

    checkout docs here: https://photonstorm.github.io/phaser3-docs/global.html#GameConfig

提交回复
热议问题