Starting out

There are several ways to create games and applications in enchant.js. Please note that this list does not include the Maeda Block development environment derived from enchant.js.

  • develop using code.9leap
  • develop using
  • develop with the file system
  • develop on a local server
  • develop on a remote server

Develop using code.9leap

code.9leap is both a development environment and a learning environment for creating simple games in enchant.js. It is recommended for those new to enchant.js or JavaScript. The right side of the environment contains a code editor while the left side displays the results of edited code live. It is also possible to upload desired images and attach script files or libraries other than enchant.js to this environment.

Develop using is a web development environment sponsored by KAYAC Inc., which can also be used for enchant.js.

Develop with the (local) file system

This method is easiest for those already familiar with JavaScript. JavaScript files of a game or application being developed can be edited in a text editor, and then checked by opening an html file, set to read the associated javascript files, in a browser.

For example, please open the file /examples/beginners/hellobear/index.html, included in the download package (live version) in your browser. Editing the file main.js, which is in the same folder as index.html, and then reopening index.html will allow you to check the results of your code. Various types of text editors are available for editing your code. Mac editors include CotEditor and mi, while Windows has Terapad and Sakura Editor. Programming environments called IDEs are also convenient, as they have many features which manage multiple projects and their associated files. Well-known ones include Eclipse, Aptana, WebStorm.

Due to the specs of some browsers[1] such as Google Chrome and Firefox not supporting certain functions, some games may be prevented from starting. Examples of this include:

  • loading model data fails when using gl.enchant.js
  • loading sound files fails when trying to use sound

These issues can be avoided by setting the browser’s launch options (Chrome only) before opening.

Another option is to develop while checking the game’s performance through a local web server, explained in the next section.

[1]: Since the local copy of the origin file points to file names, access is restricted based on the Same Origin Policy. This is active for releases of Google Chrome from version 5 on.

Developing with a web server

Development can be carried out via a local web server, such as apache, which can be installed very easily using a package such as MAMP (Mac) or XAMPP (Windows). This does not use a server connected to the internet necessarily, but is simply a method for circumventing restrictions caused by browser specs.

In this instance, the file being edited is stored and locally, but the html file is viewed by way of the local web server. Those who want to utilize a remote web server can also do so without problems.

This post is also available in: Japanese