Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As mentioned in one of the comments, a div with the id "cr-stage" is important to crafty.js. However, you don't actually have to include it. If you leave it out, it will automatically be created.</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;!-- this is the crafty.js library, which you could load from another server --&gt; &lt;script src="crafty.js"&gt;&lt;/script&gt; &lt;!-- this is the script where all your game's JS goes --&gt; &lt;script src="mygame.js"&gt;&lt;/script&gt; &lt;script&gt; window.addEventListener('load', Game.start); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>If you use the above, you will get a cr-stage id created for you.</p> <p>Another thing that might be relevant to your question is if you want to center the cr-stage and remove a small gap that automatically appears above it. To do that, use this code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;!-- this is the crafty.js library, which you could load from another server --&gt; &lt;script src="crafty.js"&gt;&lt;/script&gt; &lt;!-- this is the script where all your game's JS goes --&gt; &lt;script src="mygame.js"&gt;&lt;/script&gt; &lt;script&gt; window.addEventListener('load', Game.start); &lt;/script&gt; &lt;style type="text/css"&gt; /* remove the small gap at the top */ body { margin-top: 0 } /* horizontally center your stage on the page */ #cr-stage { margin: 0 auto 0 } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload