Using HTML5 in Ebooks and Publications

Applies to IE Browser publications.

Warning: for users of Windows 7, Vista, XP, support for HTML5 in HTML Executable 4 requires Internet Explorer 9 to be installed on the end user’s computer (not necessarily set as the default browser). On Windows 8, 8.1, 10 and higher, this is natively supported (thanks to Internet Explorer 10 and higher that ships with Windows).

This documentation uses HTML5 features.

Canvas Space Game

This sample uses the new canvas HTML tag defined in HTML5. It comes from Microsoft HTML5 documentation.

The object of the game is to fly your spaceship safely to home base through the starfield of exploding asteroids. If you hit an asteroid, your ship will be destroyed. You must avoid the asteroids or blow them up with green bombs before you crash into them.

To begin playing the game, press one of the four arrow keys on your keyboard. The ship moves in that direction. If you drive your ship into a red asteroid, the ship is destroyed and the game will be over and you will lose. If an asteroid is in your way and you want to remove it, press the “A” key to launch a green bomb. The bomb will blow up the asteroid and you can fly through the green dust to safety. The direction the bomb launches is based on your last move; for example, if you move left, the bomb will launch one space to the left of your ship. If you try to move your ship off the screen, the game won’t let you.

During game play, your score is continuously displayed in a separate canvas to the right of the game canvas. Scoring is based on how many times you move your ship and how many bombs you launch. Each move of the ship adds one point and each bomb launch adds twenty points. You want to get the lowest possible score before you reach home base. Use bombs sparingly and choose your path wisely.

Example not available in this online documentation: please run the offline help from HTML Executable to have a working example.

Copyright G.D.G. Software 2019. All rights reserved