Files in the download package
How do I download the latest version?
The latest version can be downloaded from the download page .
What are the dev and ja folders for?
- doc/ … documents
- doc/core/ … documentation for the core library of enchant.js
- doc/plugins/ … documentation for included plugins
- enchant.js … the enchant.js core library
- examples/ … code samples
- beginner/ … easy samples for beginners
- expert/ … samples for those more comfortable with the library
- plugins/ … samples for included plugins
- images/ … images
- plugins/ … plugins which extend the functionality of the enchant.js core library
- ja/ … commentary on the source code (Japanese)
The following folders are meant for developers. Generally, end users won’t need them.
- dev/ … for developers of enchant.js. Contains uncompiled source code with comments in multiple languages.
- src/ … files relating to the core enchant.js library
- plugins/ … files related to included plugins
- feature/ … folder for specific features and manual testing
- qunit/ … folder used for self-testing of the use of qunit in enchant.js. Testing can be run automatically via a grunt command.
- raster/ … folder for rasterization testing
・I want to see the console
・I want to check error messages
・Checking parts of the game
For example, if you want to check the x and y coordinates of a sprite named bear, you can display them on the console by adding console.log(bear.x, bear.y); inside of the game script.
This checking isn’t limited to numbers and character strings, but can also be performed on objects. Swapping out the previous code with console.log(bear); allows checking of other properties.
・I want to check a variable in the game code while the game is running
If the variable called bear is scoped globally, it can be checked by typing bear into the console and hitting the enter key.
If there is an assignment like window.bear = bear; and then a declaration like var bear = new Spring(…);, the variable bear can be globally scoped by removing the var and declaring with bear = new Sprite(…); instead. Then the variable’s contents can be checked. However, it is recommended to not globally scope all variables.
・I want to overwrite variables within the game while the game is running
After checking a variable’s contents with the method explained in I want to check a variable in the game code while the game is running, variables can be overwritten by inputting code such as bear.x = 100; into the console.
・Initiating debug mode
Games can be started in debug mode by replacing Game#start (ex. game.start(); ) with Game#debug (ex. game.debug(); ). In debug mode, frame borders are displayed on Entities and Sprites, and frame difference from the previous frame can be observed.
・The meaning of # and .
Inside of comments and explanations, in order to signify methods or properties, both the pound sign (#) and periods (.) are used. Properties and methods of instances are indicated with the pound sign (e.g. Game#start). Classes, objects, or other properties or methods not part of the instance, are indicated with a period (e.g. Sprite.frame, Env.TOUCH_ENABLED).
Troubleshooting during development
・The screen goes completely white (enchant.js cannot be read)
・Cannot read enchant.js
・Cannot resolve an error
・The game doesn’t stop
This post is also available in: Japanese