diff --git a/Makefile b/Makefile index a97237f..88e67c1 100755 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ build: stat: build @filesize=`stat --printf="%s" muri.zip` && \ - echo $$filesize "byte ->" $$((100*$$filesize/13000)) "%" + echo $$filesize "byte ->" $$((100*$$filesize/13312)) "%" clean: rm -f src/muri.min.js muri.zip diff --git a/src/assets/images/laser_sheet.png b/src/assets/images/laser_sheet.png new file mode 100644 index 0000000..5204d4b Binary files /dev/null and b/src/assets/images/laser_sheet.png differ diff --git a/src/assets/images/lift_button.png b/src/assets/images/lift_button.png index 43d73bc..f33284e 100644 Binary files a/src/assets/images/lift_button.png and b/src/assets/images/lift_button.png differ diff --git a/src/assets/images/room_bridge.png b/src/assets/images/room_bridge.png deleted file mode 100644 index 7dd816e..0000000 Binary files a/src/assets/images/room_bridge.png and /dev/null differ diff --git a/src/assets/images/room_engine.png b/src/assets/images/room_engine.png index a9fcefe..4ee2cd1 100644 Binary files a/src/assets/images/room_engine.png and b/src/assets/images/room_engine.png differ diff --git a/src/assets/images/room_lift.png b/src/assets/images/room_lift.png index 42a1c8c..1458908 100644 Binary files a/src/assets/images/room_lift.png 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 a03370f..72f24c3 100644 Binary files a/src/assets/images/room_stasis.png and b/src/assets/images/room_stasis.png differ diff --git a/src/assets/styles.css b/src/assets/styles.css index a54e593..8a8c907 100644 --- a/src/assets/styles.css +++ b/src/assets/styles.css @@ -49,3 +49,9 @@ canvas { font-family: monospace; text-transform: uppercase; } + +#tryagain { + position: relative; + top: -200px; + display: none; +} diff --git a/src/index.html b/src/index.html index af8861c..c117e0d 100644 --- a/src/index.html +++ b/src/index.html @@ -1 +1 @@ -link rel="stylesheet" href="assets/styles.css">
a js13kgame by Aaron Fischer (2017)
loading game ...
+link rel="stylesheet" href="assets/styles.css">a js13kgame by Aaron Fischer (2017)
loading game ...
Try again diff --git a/src/index_dev.html b/src/index_dev.html index 41569ce..9ed9e3a 100644 --- a/src/index_dev.html +++ b/src/index_dev.html @@ -9,6 +9,7 @@loading game ...
+Try again @@ -20,3 +21,4 @@ + diff --git a/src/muri.js b/src/muri.js index 88c30d3..8cbee96 100644 --- a/src/muri.js +++ b/src/muri.js @@ -98,14 +98,23 @@ var muri = (function() { }); }; + muri.end = function(reason) { + muri.changeRoom('end'); + muri.get('bubble') + .talk(reason, [20, 20]) + .then(function() { + document.getElementById('tryagain').style.display = 'block'; + }); + }; + muri.setup = function() { kontra.assets.load( 'room_stasis_dark.png', 'room_stasis.png', 'room_engine.png', - 'room_bridge.png', 'room_hydro.png', 'door_sheet.png', + 'laser_sheet.png', 'stasis_lightSwitch.png', 'room_lift.png', 'lift_button.png' diff --git a/src/room_bridge.js b/src/room_bridge.js deleted file mode 100644 index 8c3df2e..0000000 --- a/src/room_bridge.js +++ /dev/null @@ -1,28 +0,0 @@ -(function() { - 'use strict'; - - var bridge = {}; - - var background, door = null; - var roomState = { - }; - - bridge.init = function() { - background = muri.bg('bridge'); - door = muri.door('bridge', [83, 4]); - }; - - bridge.onEnter = function() { - door.sprite.playAnimation('close'); - }; - - bridge.update = function() { - }; - - bridge.render = function() { - background.render(); - }; - - bridge.name = 'bridge'; - muri.rooms.push(bridge); -}()); diff --git a/src/room_end.js b/src/room_end.js new file mode 100644 index 0000000..6aecb80 --- /dev/null +++ b/src/room_end.js @@ -0,0 +1,12 @@ +(function() { + 'use strict'; + + var end = {}; + + end.init = function() {}; + end.update = function() {}; + end.render = function() {}; + + end.name = 'end'; + muri.rooms.push(end); +}()); diff --git a/src/room_engine.js b/src/room_engine.js index 3ebca23..c4172df 100644 --- a/src/room_engine.js +++ b/src/room_engine.js @@ -3,10 +3,11 @@ var engine = {}; - var background, door = null; + var background, door, lasers = null; var roomState = { firstVisit: true, - engineBroken: true + engineBroken: true, + laserStates: [0, 0, 0] }; var randomSounds = function() { @@ -25,9 +26,50 @@ }); }; + var laser = function(i) { + var laserAnimationSheet = kontra.spriteSheet({ + image: kontra.assets.images.laser_sheet, + frameWidth: 5, frameHeight: 10, + animations: { + 0: {frames: 0}, + 1: {frames: 1}, + 2: {frames: 2}, + } + }); + var laserSprite = kontra.sprite({ + x: 36+i*20, y: 14, + animations: laserAnimationSheet.animations + }); + return muri.get('entity') + .create('engine.laser'+i, laserSprite) + .addCallback(function() { + if (!roomState.engineBroken) return; + var state = roomState.laserStates[i] + 1; + if (state > 2) state = 0; + laserSprite.playAnimation(state); + roomState.laserStates[i] = state; + + if (roomState.laserStates[0] == 2 && + roomState.laserStates[1] == 2 && + roomState.laserStates[2] == 2) { + roomState.engineBroken = false; + muri.get('bubble') + .talk([ + 'A huge beem light up and the whole ship vibrates.', + 'You\'ve made it, the engine is running again!' + ]); + } + }); + }; + engine.init = function() { background = muri.bg('engine'); door = muri.door('engine', [8, 10]); + lasers = [ + laser(0), + laser(1), + laser(2) + ]; }; engine.onEnter = function() { diff --git a/src/room_lift.js b/src/room_lift.js index e264ed1..d4bcbd5 100644 --- a/src/room_lift.js +++ b/src/room_lift.js @@ -36,6 +36,16 @@ return; } + if (room === 'shot') { + muri.end([ + 'You stepped into a pressure shot ... ', + 'Which is broken on this ship.', + 'It takes no more than a second to drag you into space.', + 'You are lost ... ....', + '... and die.']); + return; + } + muri.get('entity').get('lift.button'+i).sprite.playAnimation('on'); var goMessage = muri.ra([ 'Sure, ' + room, @@ -68,7 +78,8 @@ createButtonEntity(0, 'bridge'), // Bridge createButtonEntity(1, 'hydro'), // Hydro Deck createButtonEntity(2, 'stasis'), // Stasis - createButtonEntity(3, 'engine') // Engine room + createButtonEntity(3, 'shot'), // Shot + createButtonEntity(4, 'engine') // Engine room ]; buttons[2].sprite.playAnimation('on'); };