diff --git a/pallet.ase b/pallet.ase new file mode 100644 index 0000000..f1ada58 Binary files /dev/null and b/pallet.ase differ diff --git a/src/assets/images/lift_button.png b/src/assets/images/lift_button.png new file mode 100644 index 0000000..43d73bc Binary files /dev/null and b/src/assets/images/lift_button.png differ diff --git a/src/assets/images/room_lift.png b/src/assets/images/room_lift.png new file mode 100644 index 0000000..03288b1 Binary files /dev/null and b/src/assets/images/room_lift.png differ diff --git a/src/assets/images/room_stasis.png b/src/assets/images/room_stasis.png index c5190d2..ccd27c0 100644 Binary files a/src/assets/images/room_stasis.png and b/src/assets/images/room_stasis.png differ diff --git a/src/assets/images/room_stasis_dark.png b/src/assets/images/room_stasis_dark.png index a10fde8..c3c2d43 100644 Binary files a/src/assets/images/room_stasis_dark.png and b/src/assets/images/room_stasis_dark.png differ diff --git a/src/assets/styles.css b/src/assets/styles.css index 30fb891..fec1b88 100644 --- a/src/assets/styles.css +++ b/src/assets/styles.css @@ -40,7 +40,7 @@ canvas { image-rendering: -webkit-crisp-edges; image-rendering: pixelated; width: 800px; - height: 400px; + height: 320px; cursor: hand; } diff --git a/src/bubble.js b/src/bubble.js index f2c1926..6da73d6 100644 --- a/src/bubble.js +++ b/src/bubble.js @@ -1,5 +1,5 @@ (function() { - "use strict"; + 'use strict'; var bubble = {}; diff --git a/src/entity.js b/src/entity.js index e0a5b17..10edd18 100644 --- a/src/entity.js +++ b/src/entity.js @@ -1,5 +1,5 @@ (function() { - "use strict"; + 'use strict'; var entity = {}; var allEntities = []; @@ -12,22 +12,23 @@ }; entity.create = function(name, sprite) { - allEntities.push({ + var e = { name: name, sprite: sprite, - callbacks: [] - }); - return { + callbacks: [], addCallback: function(callback) { - entity.get(name).callbacks.push(callback); + this.callbacks.push(callback); return this; } }; + allEntities.push(e); + return e; }; entity.update = function() { var clickedOnASprite = false; allEntities.forEach(function(e) { + if (e.name.split('.')[0] !== muri.currentRoom) return; e.sprite.update(); if (muri.get('mouse').clickedOn(e.sprite)) { clickedOnASprite = true; @@ -43,7 +44,8 @@ entity.render = function() { allEntities.forEach(function(e) { - e.sprite.render(); + if (e.name.split('.')[0] === muri.currentRoom) + e.sprite.render(); }); }; diff --git a/src/index.html b/src/index.html index a707228..6515e21 100644 --- a/src/index.html +++ b/src/index.html @@ -1 +1 @@ -

murí

a js13kgame by Aaron Fischer (2017)

loading game ...

+

murí

a js13kgame by Aaron Fischer (2017)

loading game ...

diff --git a/src/index_dev.html b/src/index_dev.html index 2b2d09c..2d1719a 100644 --- a/src/index_dev.html +++ b/src/index_dev.html @@ -1,11 +1,10 @@ - - +

murí

a js13kgame by Aaron Fischer (2017)

- +
@@ -16,4 +15,5 @@ + diff --git a/src/lift.js b/src/lift.js new file mode 100644 index 0000000..e612ee7 --- /dev/null +++ b/src/lift.js @@ -0,0 +1,57 @@ +(function() { + 'use strict'; + + var lift = {}; + + var buttonSheet, background = null; + var buttons = []; + var roomState = { + position: 1 + }; + + var createButtonEntity = function(i, room) { + var e = muri.get('entity') + .create('lift.button'+i, + kontra.sprite({x: 59, y: i*2+8+i*2, + animations: buttonSheet.animations})) + .addCallback(function() { + buttons.forEach(function(b) { b.sprite.playAnimation('off'); }); + muri.get('entity').get('lift.button'+i).sprite.playAnimation('on'); + muri.get('bubble').talk([room], [65, i*4+8]); + setTimeout(function() { muri.currentRoom = room; }, 1000); + }); + e.sprite.playAnimation('off'); + return e; + }; + + lift.init = function() { + buttonSheet = kontra.spriteSheet({ + image: kontra.assets.images.lift_button, + frameWidth: 2, frameHeight: 2, + animations: { + on: {frames: 1}, + off: {frames: 0} + } + }); + + background = kontra.sprite({ + x: 0, y: 0, + image: kontra.assets.images.room_lift}); + buttons = [ + createButtonEntity(0, 'engine'), // Engine room + createButtonEntity(1, 'stasis'), // Stasis + createButtonEntity(2, 'hydro'), // Hydro Deck + createButtonEntity(3, 'bridge') // Bridge + ]; + buttons[1].sprite.playAnimation('on'); + }; + + lift.update = function() {}; + + lift.render = function() { + background.render(); + }; + + lift.name = 'lift'; + muri.rooms.push(lift); +}()); diff --git a/src/mouse.js b/src/mouse.js index 4f47eb1..6641a9b 100644 --- a/src/mouse.js +++ b/src/mouse.js @@ -1,5 +1,5 @@ (function() { - "use strict"; + 'use strict'; var mouse = {}; var isEnabled = true; diff --git a/src/muri.js b/src/muri.js index 1dfae22..f9df05f 100644 --- a/src/muri.js +++ b/src/muri.js @@ -69,7 +69,9 @@ var muri = (function() { 'room_stasis_dark.png', 'room_stasis.png', 'stasis_doorSheet.png', - 'stasis_lightSwitch.png' + 'stasis_lightSwitch.png', + 'room_lift.png', + 'lift_button.png' ).then(function() { document.getElementById('loading').style.display = 'none'; muri.modules.forEach(function(m) { diff --git a/src/stasis.js b/src/stasis.js index 66aa493..981d0be 100644 --- a/src/stasis.js +++ b/src/stasis.js @@ -1,5 +1,5 @@ (function() { - "use strict"; + 'use strict'; var stasis = {}; @@ -72,6 +72,7 @@ if (!roomState.isDoorOpen) { doorSprite.playAnimation('open'); roomState.isDoorOpen = true; + setTimeout(function() { muri.currentRoom = 'lift'; }, 800); } else { doorSprite.playAnimation('close'); roomState.isDoorOpen = false; diff --git a/www/DEJsT_3XkAAep0x.jpg b/www/DEJsT_3XkAAep0x.jpg new file mode 100644 index 0000000..76f619b Binary files /dev/null and b/www/DEJsT_3XkAAep0x.jpg differ diff --git a/www/b4b535f0a8789cedbf89117ce49fdaad--pixel-art-scifi.jpg b/www/b4b535f0a8789cedbf89117ce49fdaad--pixel-art-scifi.jpg new file mode 100644 index 0000000..94f11bb Binary files /dev/null and b/www/b4b535f0a8789cedbf89117ce49fdaad--pixel-art-scifi.jpg differ diff --git a/www/hyper-light-drifter-paradise-lost-first-contact-crossover-asthreeworks-game.png b/www/hyper-light-drifter-paradise-lost-first-contact-crossover-asthreeworks-game.png new file mode 100644 index 0000000..1926a1e Binary files /dev/null and b/www/hyper-light-drifter-paradise-lost-first-contact-crossover-asthreeworks-game.png differ