W3 Games - starter game "Tap Target"
===================================

This is a complete, working HTML5 game that follows every W3 Games rule. Use it as a base for your own game.

Files
-----
index.html   the entry file (W3 Games opens this one; you can use another name in the upload form)
game.js      the game
w3.js        helper: send the score, read in-game ads, safe storage (copy it into your game)
style.css    styles (all local, no external files)
guide.html   OPTIONAL user guide shown on the game's "User guide" page

Try it on your computer
-----------------------
Do not double-click index.html (browsers block modules from file://). Start a tiny web server in this folder:

    npx http-server . --cors -c-1      (Node.js; --cors matters for the sandbox test below)

and open the address it prints. Opened like this the game works on its own: scores are not sent anywhere and
there are no in-game ads (the helper handles that quietly).
(python -m http.server also works for the plain test, but it sends no CORS header, so use the line above for the sandbox test.)

Test it like W3 Games does
--------------------------
W3 Games runs your game inside a sandboxed frame. Make a file test.html next to index.html:

    <iframe src="index.html" sandbox="allow-scripts allow-pointer-lock" allow="fullscreen; gamepad"
            style="width:100%;height:90vh;border:0"></iframe>
    <script>
      window.addEventListener('message', e => console.log('score message:', e.data));
    </script>

Open /test.html, play one round and watch the console: you should see { type: "W3_GAME_SCORE", score: ..., mode: "classic" }.
If something fails there (storage errors, alert() not working, blocked files) it will fail on W3 Games too.

Why --cors? A sandboxed frame has no origin of its own, so the browser asks the server for permission (a CORS header)
before it loads your scripts and files. W3 Games sends that header for every game file; your local server must do it too
for this test. Without it the console says "blocked by CORS policy" - that is a local-server issue, not a game bug.

Upload
------
1. Select all files and put them in a ZIP so that index.html is at the TOP of the ZIP (not inside a folder).
2. W3 Games > Developer portal > Create game (details + thumbnail), then Upload new version (version 1.0.0, entry file index.html).
3. An administrator reviews the version. After approval and publishing your game is live.

The full rules and limits are on the Developer Guide page of W3 Games.
