https://github.com/code-dot-org/craft
Top-down 2D game engine for the Craft app type. See NOTICE for restrictions on use.
https://github.com/code-dot-org/craft
Last synced: 9 days ago
JSON representation
Top-down 2D game engine for the Craft app type. See NOTICE for restrictions on use.
- Host: GitHub
- URL: https://github.com/code-dot-org/craft
- Owner: code-dot-org
- License: other
- Created: 2015-09-10T19:14:02.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2022-09-15T21:27:42.000Z (over 3 years ago)
- Last Synced: 2024-08-14T13:23:45.316Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://code-dot-org.github.io/craft/
- Size: 290 MB
- Stars: 19
- Watchers: 48
- Forks: 11
- Open Issues: 42
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/code-dot-org/craft/builds) [](https://codecov.io/gh/code-dot-org/craft)
_Note: proprietary materials fall under different rules, per the [LICENSE](https://github.com/code-dot-org/code-dot-org/blob/staging/LICENSE)._
## Local Setup (all platforms)
### Node.js
You will need to first install [Node.js](http://nodejs.org/download/)
### Setup Your Project
Check this project out from source:
git clone git@github.com:code-dot-org/craft.git
cd craft
Next, inside the project, you need to install the project's various NPM dependencies:
npm install
And you should now be ready to spin up a development build of your new project:
npm run dev
A browser should open with a Minecraft Hour of Code test page displayed:

## Developing
All of the files required to run the game live in the `src` folder, including any javascript, images, HTML ([ejs](http://www.embeddedjs.com/) templated), and CSS. When the default `npm build` task is invoked, these files are compiled to a `dist` directory.
Files in the `dist` directory will always be generated and excluded from Git by the `.gitignore`, as such these will removed without warning and should generally not be edited.
### What's being used?
* [NPM](https://www.npmjs.org/) via [webpack](https://webpack.js.org/), [eslint](https://eslint.org/), dev server with livereload (auto refresh), [.gitignore](https://github.com/serby/GitIgnore).
* ES6 via [babel](https://babeljs.io/)
### Recommendations
* If you intend to store development assets (i.e PSD's, Texture Packer files, etc) inside your project, store them outside of the `src` directory to avoid unnecessary copying during dev builds.
### Resources for:
#### Phaser.js
* [Phaser.io Examples](http://phaser.io/examples) — lots of great example code
* [Game Mechanic Explorer](http://gamemechanicexplorer.com/) - set of game mechanic demos with Phaser source below
* [Kenney.nl assets](http://kenney.nl/assets) — public domain placeholder assets for spritesheets, backgrounds, etc.
* [Freesound](https://freesound.org/) — public domain placeholder sounds
### Available Targets
#### `npm run`
Display a list of all scripts that can be run with NPM. Notable options include:
##### `npm run build`
##### `npm run dev`
Configures and runs an un-minified development build optimised for fast watch performance with source maps and live reload. Opens browser window pointing to a test page on first build.
##### `npm run lint`
##### `npm run test:unit`
### Updating or adding libraries
The project comes with an unminified version of Phaser with arcade physics, this can be replaced if you require updates or one of the alternate physics engines.
You can install new npm-compatible libraries with:
`npm install --save my-package-name`
Then require it in your code with e.g. `import MyCoolTimesavingLibrary from 'My-Cool-Timesaving-Library'`.
Some interesting npm libraries: list of [browserify-friendly game modules](https://github.com/hughsk/game-modules/wiki/Modules), [@substack's npm repositories](https://www.npmjs.com/~substack).
Raw vendor packages can be added to `src/test-build-only` and added directly to `src/index.html.ejs`.
If adding new libraries that aren't CommonJS compatible, you'll have to additionally update the [Browserify shim configuration](https://github.com/thlorenz/browserify-shim#3-provide-browserify-shim-config) in our `package.json`.
### Coding style
We will try to follow the [Airbnb ES6 styleguide](https://github.com/airbnb/javascript).
### Acknowledgements
Boilerplate based on the [Phaser.js grunt/browserify boilerplate](https://github.com/lukewilde/phaser-js-boilerplate/), which was based on [1](https://github.com/luizbills/phaser-js-boilerplate) and [2](https://github.com/gamecook/phaser-project-template).