在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:spbooks/html5games1开源软件地址:https://github.com/spbooks/html5games1开源编程语言:JavaScript 98.9%开源软件介绍:HTML5 Games: Novice to NinjaHello and thanks for checking out HTML5 Games: Novice to Ninja! These are the code examples for the book. If you are reading this then you are among the first people in the world getting your hands dirty. If you have issues running the examples, find any inconsistencies and errors, or you have suggestions then please either log an issue or email me at [email protected] (or ping me @mrspeaker), I will try to help. They will run in all recent browsers - check out all the examples and play some of the games! Making your own gamesTo modify the code and make your own game you'll need to be able to run it. Each example also includes an npm
You only have to do this once per example. This installs all the dependencies and files needed to run and package your game. Use the command:
It will start a webserver (at the URL http://localhost:9966/ by default). You can test your changes at the URL. Building for the outside worldOnce you've finished your game and are happy with your changes, you can run:
Which will convert the code into a single Getting helpSetting up a workable build system to run code can be the most frustrating aspect of JavaScript development. If you are having any trouble running or modifying the examples, either log an issue on the code repository, send me an email at [email protected], or ping me @mrspeaker on twitter - and we'll get it sorted. Using JavaScript Native ModulesRecently, most browsers have began to support JavaScript Native Modules. this means the step of converting all the code into a single file is not necessary - you can just make changes to your code and see the results without even needing npm. (For Firefox before version 60 it's enabled behind the about:config This is really convenient and cool - however, if you want to run your games locally on your own computer they still need to be served by a webserver. This is because JavaScript modules will only work via
This will run a server on http://localhost:9966/. If you browse here there will be links to each example. Examples to comeI'm organizing the code for each chapter. There's still a little tidying going on. Also, still remaining:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论