Skip to content

Commit ca21b66

Browse files
committed
Initial commit
0 parents  commit ca21b66

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1709
-0
lines changed

.bowerrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "bower_components"
3+
}

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
bower_components
3+
dist
4+
backup
5+
*.log
6+
*.sh
7+
*.wav
8+
*.m4a

.jshintrc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"node": true,
3+
"esnext": true,
4+
"bitwise": true,
5+
"camelcase": true,
6+
"curly": true,
7+
"eqeqeq": true,
8+
"immed": true,
9+
"indent": 2,
10+
"latedef": true,
11+
"newcap": true,
12+
"noarg": true,
13+
"quotmark": "single",
14+
"regexp": true,
15+
"undef": true,
16+
"unused": true,
17+
"strict": true,
18+
"trailing": true,
19+
"smarttabs": true,
20+
"white": true
21+
}

Gruntfile.js

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
// Generated on 2014-03-28 using generator-phaser-official 0.0.8-rc-2
2+
'use strict';
3+
var config = require('./config.json');
4+
var _ = require('underscore');
5+
_.str = require('underscore.string');
6+
7+
// Mix in non-conflict functions to Underscore namespace if you want
8+
_.mixin(_.str.exports());
9+
10+
var LIVERELOAD_PORT = 35729;
11+
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
12+
var mountFolder = function (connect, dir) {
13+
return connect.static(require('path').resolve(dir));
14+
};
15+
16+
module.exports = function (grunt) {
17+
// load all grunt tasks
18+
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
19+
20+
grunt.initConfig({
21+
watch: {
22+
scripts: {
23+
files: [
24+
'game/**/*.js',
25+
'!game/main.js'
26+
],
27+
options: {
28+
spawn: false,
29+
livereload: LIVERELOAD_PORT
30+
},
31+
tasks: ['build']
32+
}
33+
},
34+
connect: {
35+
options: {
36+
port: 9000,
37+
// change this to '0.0.0.0' to access the server from outside
38+
hostname: '0.0.0.0' //'localhost'
39+
},
40+
livereload: {
41+
options: {
42+
middleware: function (connect) {
43+
return [
44+
lrSnippet,
45+
mountFolder(connect, 'dist')
46+
];
47+
}
48+
}
49+
}
50+
},
51+
open: {
52+
server: {
53+
path: 'http://localhost:9000'
54+
}
55+
},
56+
clean: {
57+
game: [
58+
'dist/js/game.js'
59+
],
60+
dist: [
61+
'dist/*'
62+
]
63+
},
64+
copy: {
65+
dist: {
66+
files: [
67+
// includes files within path and its sub-directories
68+
{ expand: true, src: ['assets/*.png', 'assets/*.gif', 'assets/*.jpg'], dest: 'dist/' },
69+
{ expand: true, src: ['assets/sfx/*.ogg', 'assets/sfx/*.m4a', 'assets/sfx/*.mp3'], dest: 'dist/' },
70+
{ expand: true, flatten: true, src: ['game/plugins/*.js'], dest: 'dist/js/plugins/' },
71+
{ expand: true, flatten: true, src: ['bower_components/phaser-official/build/phaser.min.js'], dest: 'dist/js/' },
72+
{ expand: true, flatten: true, src: ['bower_components/lodash/dist/lodash.min.js'], dest: 'dist/js/' },
73+
{ expand: true, flatten: true, src: ['LICENSE'], dest: 'dist/' },
74+
{ expand: true, src: ['css/**'], dest: 'dist/' },
75+
{ expand: true, src: ['index.html'], dest: 'dist/' }
76+
]
77+
}
78+
},
79+
browserify: {
80+
build: {
81+
// options: {
82+
// ignore: ['lodash']
83+
// },
84+
src: ['game/main.js'],
85+
dest: 'dist/js/game.js'
86+
}
87+
},
88+
uglify: {
89+
dist: {
90+
options: {
91+
report: 'min',
92+
preserveComments: false,
93+
banner: '<%= grunt.file.read("templates/header.txt") %>'
94+
},
95+
files: {
96+
'dist/js/game.min.js': ['dist/js/game.js']
97+
}
98+
}
99+
},
100+
processhtml: {
101+
dist: {
102+
files: {
103+
'dist/index.html': ['index.html']
104+
}
105+
}
106+
}
107+
});
108+
109+
grunt.registerTask('build', ['buildBootstrapper', 'browserify','copy']);
110+
grunt.registerTask('serve', ['build', 'connect:livereload', 'open', 'watch']);
111+
grunt.registerTask('default', ['serve']);
112+
grunt.registerTask('prod', ['build', 'uglify', 'processhtml', 'clean:game']);
113+
114+
grunt.registerTask('buildBootstrapper', 'builds the bootstrapper file correctly', function() {
115+
var stateFiles = grunt.file.expand('game/states/*.js');
116+
var gameStates = [];
117+
var statePattern = new RegExp(/(\w+).js$/);
118+
stateFiles.forEach(function(file) {
119+
var state = file.match(statePattern)[1];
120+
if (!!state) {
121+
gameStates.push({shortName: state, stateName: _.capitalize(state) + 'State'});
122+
}
123+
});
124+
config.gameStates = gameStates;
125+
console.log(config);
126+
var bootstrapper = grunt.file.read('templates/_main.js.tpl');
127+
bootstrapper = grunt.template.process(bootstrapper,{data: config});
128+
grunt.file.write('game/main.js', bootstrapper);
129+
});
130+
131+
};

LICENSE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Copyright (c) 2014 Petar Petrov
2+
3+
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
4+
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The Bank Job
2+
==================

assets/bags.png

52.3 KB
Loading

assets/bg.jpg

295 KB
Loading

assets/chair.png

27.7 KB
Loading

0 commit comments

Comments
 (0)