Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

How to code phaser game on html


Mizukage
 Share

Recommended Posts

whats odious ? this is my index.html for example :
 

<html>    <head>        <title> Hit enemies</title>        <script src="assets/phaser.min.js"></script>        <script src="main.js"></script>        <script src="game.js"></script>        <script src="menu.js"></script>    </head>        <body>                <div id="Hello" align="center"></div>                <script>                var game = new Phaser.Game(800,700,Phaser.AUTO,'Hello');        game.state.add('gameState',gameState);        game.state.add('menuState',menuState);        game.state.start('menuState');                        </script>            </body></html>
Link to comment
Share on other sites

That's the way you do it. 

In your HTML you define how the webpage containing the game is going to be structured. You also define a div element where you want to insert the game. Then, in your javascript, which may be part of the html file or on one or many separate js files, you need to tell phaser where to attach the canvas.

Why do you think it's ugly?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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