This is based on a simple Webpack 2.x template for use with Phaser and ES6/2015.
My first full-production game in Phaser, so please forgive me for code issues.
Levels have been developed using the awesome Tiled Map Editor. Guidelines for making your own levels are included below.
You need Node.js and npm.
Clone the repository (or download the ZIP file)
git clone https://github.com/simonma10/sokoban
Install dependencies
npm install
Run a development build...
npm run dev
Your ES6 code will be transpiled into ES5 and concatenated into a single file called bundle.js
.
A sourcemap for your code will also be included (by default bundle.js.map
).
Phaser modules and dependencies will be transpiled and concatenated into vendor.bundle.js
, with a sourcemap (vendor.bundle.js.map
).
Any modification to the files inside the ./src
and ./static
folder will trigger a full page reload.
If you modify the contents of other files, please manually restart the server.
Run a production build:
npm run prod
Creates production-ready bundle.js
and vendor.bundle.js
in the \dist
folder.
Run eslint:
npm run test
First of all, download and install the Tiled Map Editor. It's free to download, but please support the developer.
Currently, Sokoban has a few rules in place:
- Maps are orthogonal
- width = 16 tiles
- height = 16 tiles
- files should be saved as
soko000.json
- replace the000
with the actual level number.
The tileset I'm using is stored in static\images\sokoban_tilesheet.png
. Make sure you add this tilesheet, and ensure it has the same name - sokoban_tilesheet
Maps have three layers, to keep things simple, and make it super easy to develop new levels:
- Background: ensure this is of type
Tile Layer
and is calledbackgroundLayer
. Nothing interacts with this layer, so you can include whatever tiles you want! - Blocks: make sure this is of type
Tile Layer
and is calledblockingLayer
. This is the layer with the walls: the player and the crates cannot move through these. - Objects: make sure this is of type
Object Layer
and is calledobjectLayer
. More information about this layer in the next section
Sokoban expects three types of objects for the game to work properly:
- Player Object. This is just a placeholder, so may not look the same in the game (the actual spritesheet used is
static\images\player.png
). However, to link up this object with the sprite in the game, make sure theType
is set toplayer
, and add a custom propertysprite
with the valueplayerSprite
. - Crates. Same as Player - make sure they are type
crate
, with custom propertysprite
=crateSprite
. - Parking Spots. Same again, make sure they are type
spot
, with custom propertysprite
=spotSprite
.
Please report any bugs or add requests on Github Issues.
This project is released under the MIT License (even though it should be spelt 'Licence').
Respect to the owners of the following projects:
https://github.com/lean/phaser-es6-webpack.git