O'Reilly logo

Monkey Game Development by Michael Hartlef

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — modifying the HTML5 output

To change the HTML5 output to your needed canvas size, follow the ensuing steps:

  1. Compile for HTML5.
  2. Open the MonkeyGame.HTML file, which is located inside the build/HTML5 folder of your project. Use Monk to do this as it can open HTML files.
  3. Locate the line that looks like the following:
    <canvas id="GameCanvas" on click="javascript:this.focus();" width=640 height=480 tabindex=1></canvas><br>
    
  4. Now, change the width value to 800 and the height value to 600. Save and close the file.

What just happened?

We have changed the size of the HTML canvas. It is now the size we need it to be so we can test the game easily in the HTML5 browser of your choice.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required