Following the Enchant.js tutorial I cannot find a way to define the place the game is rendered in the page. It either takes the maximum possible area or limits itself to the given size (using game.scale = 1).


There are two possible ways to do this.

The "fast" hack is to call your game's html page from an iframe. This is not recommended because of the iframe implications and cross-browser differences regarding attributes and, more important, you will not be able to capture input from keyboard.

The best way is to create the div and give it the id 'enchant-stage'. It's direct, 100% cross-browser compliant and lets you capture keyboard input.

<div id="enchant-stage"></div>
  • 1
    \$\begingroup\$ how did you know about "enchant-stage" ? \$\endgroup\$ – onmyway133 Dec 14 '13 at 17:04
  • \$\begingroup\$ @entropy around 5-6 months ago I ended up here and it was awesome! haha reddit.com/r/enchantjs \$\endgroup\$ – reefaktor Dec 17 '13 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.