├── .gitignore
├── README.md
├── jamscreenshot.png
├── assets
├── audio
│ ├── laser_music.mp3
│ ├── laser_music.ogg
│ ├── building_move.ogg
│ ├── laser_fireup.mp3
│ ├── laser_fireup.ogg
│ ├── laser_completed.mp3
│ └── laser_completed.ogg
└── models
│ ├── stop_stationary.json
│ ├── sidewalk.json
│ ├── roof_stationary.json
│ └── hole_stationary.json
├── package.json
├── src
├── lib
│ ├── mousetrap-global-bind.js
│ ├── hsl.js
│ ├── tween.min.js
│ ├── FileSaver.js
│ └── SkyShader.js
├── statemachine.js
├── renderableobject.js
├── gameparameters.js
├── monospacebitmapfont.js
├── utilthree.js
├── orbitcameracontrol.js
├── gamepad.js
├── editor.js
├── loadingbar.js
├── unlocker.js
├── threesceneobject.js
├── mainloop.js
├── audio.js
├── animatedsprite.js
├── game.js
├── hitbox.js
├── laser.js
├── canvasui.js
├── inputmapper.js
└── sprite.js
└── index.html
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # lasertown
2 | Ludum Dare 35 Game
3 |
--------------------------------------------------------------------------------
/jamscreenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Oletus/lasertown/HEAD/jamscreenshot.png
--------------------------------------------------------------------------------
/assets/audio/laser_music.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Oletus/lasertown/HEAD/assets/audio/laser_music.mp3
--------------------------------------------------------------------------------
/assets/audio/laser_music.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Oletus/lasertown/HEAD/assets/audio/laser_music.ogg
--------------------------------------------------------------------------------
/assets/audio/building_move.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Oletus/lasertown/HEAD/assets/audio/building_move.ogg
--------------------------------------------------------------------------------
/assets/audio/laser_fireup.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Oletus/lasertown/HEAD/assets/audio/laser_fireup.mp3
--------------------------------------------------------------------------------
/assets/audio/laser_fireup.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Oletus/lasertown/HEAD/assets/audio/laser_fireup.ogg
--------------------------------------------------------------------------------
/assets/audio/laser_completed.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Oletus/lasertown/HEAD/assets/audio/laser_completed.mp3
--------------------------------------------------------------------------------
/assets/audio/laser_completed.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Oletus/lasertown/HEAD/assets/audio/laser_completed.ogg
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Laser Town",
3 | "version": "0.1.0",
4 | "description": "Laser Town game",
5 | "repository": "https://github.com/Oletus/lasertown.git",
6 | "dependencies": {
7 | "howler": "^1.1.28",
8 | "tween": "^0.9.0"
9 | },
10 | "devDependencies": {
11 | "gulp": "^3.9.0",
12 | "gulp-fluent-ffmpeg": "^1.0.2"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/lib/mousetrap-global-bind.js:
--------------------------------------------------------------------------------
1 | /**
2 | * adds a bindGlobal method to Mousetrap that allows you to
3 | * bind specific keyboard shortcuts that will still work
4 | * inside a text input field
5 | *
6 | * usage:
7 | * Mousetrap.bindGlobal('ctrl+s', _saveChanges);
8 | */
9 | /* global Mousetrap:true */
10 | window.Mousetrap = (function(Mousetrap) {
11 | var _globalCallbacks = {},
12 | _originalStopCallback = Mousetrap.stopCallback;
13 |
14 | Mousetrap.stopCallback = function(e, element, combo, sequence) {
15 | if (_globalCallbacks[combo] || _globalCallbacks[sequence]) {
16 | return false;
17 | }
18 |
19 | return _originalStopCallback(e, element, combo);
20 | };
21 |
22 | Mousetrap.bindGlobal = function(keys, callback, action) {
23 | Mousetrap.bind(keys, callback, action);
24 |
25 | if (keys instanceof Array) {
26 | for (var i = 0; i < keys.length; i++) {
27 | _globalCallbacks[keys[i]] = true;
28 | }
29 | return;
30 | }
31 |
32 | _globalCallbacks[keys] = true;
33 | };
34 |
35 | return Mousetrap;
36 | }) (window.Mousetrap);
37 |
--------------------------------------------------------------------------------
/src/statemachine.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | // Requires utiljs.js
4 |
5 | if (typeof GJS === "undefined") {
6 | var GJS = {};
7 | }
8 |
9 | /**
10 | * A very simple state machine. Tracks state and the time that the machine has been in that state.
11 | * @constructor
12 | * @param {Object} options Options for the object. Contains keys:
13 | * stateSet: An object with number values, each key-value pair identifying a state. Example:
14 | * { IDLE: 0, RUNNING: 1 }
15 | * id: Number that identifies the initial state.
16 | */
17 | GJS.StateMachine = function(options) {
18 | var defaults = {
19 | id: null,
20 | stateSet: {}
21 | };
22 | objectUtil.initWithDefaults(this, defaults, options);
23 | if (this.id === null) {
24 | for (var key in this.stateSet) {
25 | if (this.stateSet.hasOwnProperty(key)) {
26 | this.id = this.stateSet[key];
27 | break;
28 | }
29 | }
30 | }
31 | this.time = 0;
32 | };
33 |
34 | /**
35 | * @param {number} newStateId Id of the new state.
36 | */
37 | GJS.StateMachine.prototype.change = function(newStateId) {
38 | this.id = newStateId;
39 | this.time = 0;
40 | };
41 |
42 | /**
43 | * Call this regularly to update the state machine.
44 | * @param {number} deltaTime Time change since last call to this function.
45 | */
46 | GJS.StateMachine.prototype.update = function(deltaTime) {
47 | this.time += deltaTime;
48 | };
49 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Lasertown
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/src/renderableobject.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | // Requires utiljs.js
4 |
5 | /**
6 | * A renderable object that game objects can inherit. May contain multiple renderers that have different render order,
7 | * like a foreground and background.
8 | * @constructor
9 | */
10 | var RenderableObject = function() {
11 | };
12 |
13 | /**
14 | * Initialize the object.
15 | */
16 | RenderableObject.prototype.initRenderableObject = function() {
17 | this.renderOrder = 0; // Renderers with greater render order get rendered first
18 | };
19 |
20 | /**
21 | * Override this function to generate multiple renderers from this object.
22 | * @return {Array.