HTML moving phaser into container div

后端 未结 3 743
北荒
北荒 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:18

    Using the examples found on the phaser github (https://github.com/photonstorm/phaser)

    in the Html:

    on the .js

    var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
    

    The fourth parameter on Phaser.Game() is the id of the DOM element in which you would like to insert the element that Phaser creates.

提交回复
热议问题