HTML5 Games - specific question about ch3 importing js file

Hi - I am very much enjoying HTML5 Games - I’m just a bit stuck on the best way to import KeyControls.js
The book says to import on top of main.js…
The GitHub repo code doesn’t do this, however…it just adds the KeyControls.js file to the index.html page.

  1. I’ve tried both ways and neither is working…so I guess I misunderstand something…I am just not quite sure what :slight_smile:
  2. Which method is better in this case – importing at the top of main.js (which I assume means also exporting at the bottom of KeyControls.js?
    adding it to index.html?

If this question isn’t clear enough, I am happy to rephrase the question, etc…

Thank you!!!

Ah!! I figured it out –
Is protocol to delete this ?? Sorry that I can’t remember.
Thank you!

No, it won’t be deleted, but if you can summarize for us your solution it might interest other users (including me, because I am also working through the book whenever I have the time).


HI – sorry for late reply. The solution was obvious as I kept moving through the book. The file structure needs a folder for controls, and both keycontrol and mousecontrol end up there.
(hope that makes sense – the way the book was structured, the architecture wasn’t obvious until I kept reading a bit further along.)

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.