From 62149c058f01059e4a6728d0c6dd9c22655fb6d3 Mon Sep 17 00:00:00 2001 From: Aaron Fischer Date: Wed, 13 Sep 2017 11:16:39 +0200 Subject: [PATCH] Finish ... kind of ... now some space reduction --- Makefile | 2 +- src/assets/images/door_sheet.png | Bin 306 -> 265 bytes src/assets/images/keycard.png | Bin 0 -> 93 bytes src/assets/images/room_engine.png | Bin 505 -> 467 bytes src/assets/images/room_hydro.png | Bin 507 -> 513 bytes src/assets/images/room_lift.png | Bin 339 -> 245 bytes src/assets/images/room_stasis.png | Bin 603 -> 486 bytes src/assets/images/room_stasis_dark.png | Bin 148 -> 129 bytes src/assets/images/toggleSwitch_sheet.png | Bin 0 -> 78 bytes src/index_dev.html | 2 - src/muri.js | 13 +++-- src/room_end.js | 10 +--- src/room_engine.js | 6 +- src/room_hydro.js | 19 +++++-- src/room_lift.js | 34 ++++++++---- src/room_stasis.js | 67 +++++++++++++++++++++-- 16 files changed, 112 insertions(+), 41 deletions(-) create mode 100644 src/assets/images/keycard.png create mode 100644 src/assets/images/toggleSwitch_sheet.png diff --git a/Makefile b/Makefile index 88e67c1..c16c086 100755 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ all: build stat clean build: rm -f muri-src.zip muri.zip src/muri.min.js uglifyjs --compress --mangle --no-dead-code --output src/muri.min.js src/*.js - (cd src/assets/images; for i in `ls *.png`; do pngcrush -brute -reduce_palette -ow $$i; done) + #(cd src/assets/images; for i in `ls *.png`; do pngcrush -brute -reduce_palette -ow $$i; done) (cd src && zip -q -9 ../muri.zip index.html muri.min.js assets/* assets/**/* vendor/*.min.js) (cd src && zip -q -9 ../muri-src.zip ./* ./**/* ./**/**/* ../README) diff --git a/src/assets/images/door_sheet.png b/src/assets/images/door_sheet.png index e519af7a25d788f591c045bf4ad91ba69b50b93b..bfec54b9c7686dc294fec24674c4e1ffb3eb3dfa 100644 GIT binary patch delta 249 zcmdnQ)X6kKqMn7Bfq@}6=#3?i;t%i%aRt)SvT{IDT|>dn)@WtoPLLF1NswPKgTu2M zX+X{jPZ!4!jq^(ttxU2tx$VYk(DU&o~23DQ#I<|25T<` z+bJ4q-P6_w%Wc`n?ap5&K6S-^xjk-7=H)`0001=eDMkZ008+(L_t(o!|j;C4gw(zMEf5`<4w=r_5c40 zgBN#^r89$8vVnx`UMA3K`vRD~M*?PRD4H$(Uq(6{Pp^5oo;SaFDtcvocK_fy{szhk z8Ug8<^+_X;BsI0oAi&H*dNv6}K#Jz0f)Zmy%>+d6v7n}7SbsulN)Gu!0Hxhi3D#-C zswEU07-GOOAhsP8CaCS8R06~Vpb{Xx0_LHZ;8nt80$2?!6UeNpCd4rzsvRa1L=(c8 z;F&O)@Wpe&WWwl7P!3DGJ10yg1fCOicXt??36J|N1dQPqs9!Pxc~mL&?8{O|JNRH+ pW16p(HtvpoNO>E6P_o7w#WC>#-IQI002ovPDHLkV1j`qd!hgU diff --git a/src/assets/images/keycard.png b/src/assets/images/keycard.png new file mode 100644 index 0000000000000000000000000000000000000000..328afc01d71181ec74acf36747813c68f02e16cf GIT binary patch literal 93 zcmeAS@N?(olHy`uVBq!ia0vp^EI`b}#0(;jP5l6*cmjMvT+?p8U-n4v$B$2cr^{=3 nd1ZjaJzX3_IIbrrq*?&=TxB@X)$?*UP@KWj)z4*}Q$iB}GU6K0 literal 0 HcmV?d00001 diff --git a/src/assets/images/room_engine.png b/src/assets/images/room_engine.png index 4ee2cd18463ae1576a0a5db0ec0f22cad977636d..c017244031e3991f19f49343d5b7ba3e33a8b30d 100644 GIT binary patch delta 453 zcmV;$0XqKq1JeVL7=Hu<0002`Rzh$9000|MOjJbx002HcG8-KpCnz9wabEcN^8J?| z=G%1nCPxc0m-+wz0dq-2K~y-)<&!~OE9lI61P%bdJ%ChQz|nTE3GO|Dt66*W zsfGeZAf}1Sc?tK(=KgfOG?7*Auh-gV^ER|>f_$VQ zB2|96`tNKvXMaPa{A%nH9pO;Y*6ddj!6-s8py(oNjU>rxzpm+6D9#Ms%pl-zg!Do> z(=kz2X8p_<{jui4hqai&W-~1xT?_7Qi&;N2$W3;+{aA|`Y&Nv;c$d$+?PAu?3<4%C zbZcA8V6#_G>|rftHk)Y~p4i!TF@w!sw5)4uG3#f>cs~6IMiGhNIYK0r4==jxW~~Ky vD-!V`Pa{#lMMvIfk;TwvF_bUnpSS!1N=44ly^#0M00000NkvXXu0mjf2l~#6 delta 491 zcmVgXvn!yINCvUK{}HGLZ%V*hU=; zFY&Hce{DLwu33fvXa?i5w)`RkO|O?0-3_7C+Ia|a6gNY(91z=1DWzy2iXtZ4p-Wot zB%(?wDnwF*U4O=gbV2JO4I@)-hG@?KQqX|zic<*gihTHX5ElqR$bgdp=Sv6#_u440 zd^l*y3RxyZ0$|lqdu^0gzq9446He%ywAv`|)JfVqAzz)7MjPd=Rej%+8LxToWTTDp zRww$tC-bZCNvnz`reFf-Dc7R38>ewQVcLMc;F%Y|u)@ntd%1)Ojk6eguF6OWBU3Uh zRtd8koX7`fOxY;gfEh$UW@(8)j*(vMH>~`9QMOn%K}pAYxvCpT2)jfuHK$YPRXz_% zq0Ax~2nkB)vME^#?p#su{2aF*6jio`+7cK`NlgK>Ds0b4(tkT3LKUgWs;jFxXCHDt z5FivtDD|HrxdL&owbtA1cJr-tA&`_=Td4!FpRR$ieB7Xf3qTP9q2+}#u2T?S3%^nn zstU0v`@Ppcc@h*-`b9!vKkL}s=NvCZRBO)Qu2zFTjLHQ#IA zq0(lM$ISfZBC~!ZDt36xArk>BR+voi8N}xdn?*8*oQh=j^f!T=dV(D9RO6KsEqp9d j{=oSBKlwmDkg0tGK+PRG4+j@P00000NkvXXu0mjfW?1EY diff --git a/src/assets/images/room_lift.png b/src/assets/images/room_lift.png index 145890819450ae093e3100f3592b04a8475ddd9d..d7116dea1f74f54d59756c09b5dd09ad429d06ff 100644 GIT binary patch delta 229 zcmcc2^p$afL_G^L0|UdaFsA|_B^Tfm;tHhgY>j^W_#`bWr>>z;S{SEc8uaXTN!rc# zf2Ygmrg1z0s+i>I;uvCa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eENZ`-!1hX4@mVSG#=3nve!IgHAiEmPD$p7wlN)voZ-U30>c;#)WP ziV-Q**(Z>;ez@~W$^6}x$=yojpSnV$Ru?K^a5z^J3L3{zpN(j+tUwQC8jG~KZ zfT)MK@+TD~p&FK=P2A%uM=>miRBWHI>Cn88{|Ylg4# z_n{b;hmkPNj3n&O+zceE++zpx&QzG diff --git a/src/assets/images/room_stasis_dark.png b/src/assets/images/room_stasis_dark.png index cca8fc7ca50916e8064d55128f35ce7c9aa1d310..f8c77efc96aa4592b81760c3cf5d58c4cc8b4468 100644 GIT binary patch delta 112 zcmbQj*vL3RB9n!gfq~&ym{S3e5(@AMaRt&p)!fxJ6#h<^e|EcM*(1FG(P{EPQ7umw z#}JFt$r7xK8&VFOP;po#mX^lMc8fX8jWuYi!A66gra%KOw}Tu^3{Be@%5E%b(E#dV N@O1TaS?83{1OQ=$BI5u6 delta 131 zcmZo9(yvMS7ktjv*erZx3$dWia4i*?3u8AoYKvF)QoEn;w^@C>`ChY_@)k imJc_(=OmT2-xxNuGB~U|nJ)y?$>8bg=d#Wzp$Pzn^e*uL diff --git a/src/assets/images/toggleSwitch_sheet.png b/src/assets/images/toggleSwitch_sheet.png new file mode 100644 index 0000000000000000000000000000000000000000..bbe4f33c6cf07eeeb7e57a6ac3146c7a586c978e GIT binary patch literal 78 zcmeAS@N?(olHy`uVBq!ia0vp^EI`c2!2~4B;%3YOQlg$Njv*W~lmD!Iw(fYzi|2Qm2@Ah)w)<2B?6+)78&qol`;+0H?YYh5!Hn literal 0 HcmV?d00001 diff --git a/src/index_dev.html b/src/index_dev.html index 9ed9e3a..f16cc0d 100644 --- a/src/index_dev.html +++ b/src/index_dev.html @@ -1,5 +1,4 @@ -

murĂ­

a js13kgame by Aaron Fischer (2017)

@@ -16,7 +15,6 @@ - diff --git a/src/muri.js b/src/muri.js index 8cbee96..cb105b1 100644 --- a/src/muri.js +++ b/src/muri.js @@ -98,12 +98,13 @@ var muri = (function() { }); }; - muri.end = function(reason) { + muri.end = function(reason, again) { muri.changeRoom('end'); muri.get('bubble') .talk(reason, [20, 20]) .then(function() { - document.getElementById('tryagain').style.display = 'block'; + if (again) + document.getElementById('tryagain').style.display = 'block'; }); }; @@ -114,6 +115,8 @@ var muri = (function() { 'room_engine.png', 'room_hydro.png', 'door_sheet.png', + 'toggleSwitch_sheet.png', + 'keycard.png', 'laser_sheet.png', 'stasis_lightSwitch.png', 'room_lift.png', @@ -129,7 +132,8 @@ var muri = (function() { kontra.gameLoop({ update: function() { - muri.room(muri.currentRoom).update(); + var r = muri.room(muri.currentRoom); + if (r.update !== undefined) r.update(); muri.modules.forEach(function(m) { if (m.update !== undefined) m.update(); }); @@ -140,7 +144,8 @@ var muri = (function() { } }, render: function() { - muri.room(muri.currentRoom).render(); + var r = muri.room(muri.currentRoom); + if (r.render !== undefined) r.render(); muri.modules.forEach(function(m) { if (m.render !== undefined && m.name !== 'entity') m.render(); diff --git a/src/room_end.js b/src/room_end.js index 6aecb80..d94d3cb 100644 --- a/src/room_end.js +++ b/src/room_end.js @@ -1,12 +1,4 @@ (function() { 'use strict'; - - var end = {}; - - end.init = function() {}; - end.update = function() {}; - end.render = function() {}; - - end.name = 'end'; - muri.rooms.push(end); + muri.rooms.push({name: 'end'}); }()); diff --git a/src/room_engine.js b/src/room_engine.js index c4172df..16eca5c 100644 --- a/src/room_engine.js +++ b/src/room_engine.js @@ -6,7 +6,7 @@ var background, door, lasers = null; var roomState = { firstVisit: true, - engineBroken: true, + engineBroken: false, //true, laserStates: [0, 0, 0] }; @@ -88,13 +88,11 @@ randomSounds(); }; - engine.update = function() { - }; - engine.render = function() { background.render(); }; engine.name = 'engine'; + engine.roomState = roomState; muri.rooms.push(engine); }()); diff --git a/src/room_hydro.js b/src/room_hydro.js index cb0a43d..2e5f4f8 100644 --- a/src/room_hydro.js +++ b/src/room_hydro.js @@ -3,22 +3,29 @@ var hydro = {}; - var background, door = null; - var roomState = { - }; + var background, door, keycard = null; hydro.init = function() { background = muri.bg('hydro'); door = muri.door('hydro', [38, 9]); + keycard = muri.get('entity') + .create('hydro.keycard', kontra.sprite({x: 55, y: 28, image: kontra.assets.images.keycard})) + .addCallback(function() { + muri.get('bubble') + .talk([ + 'Thats interesting ... ', + 'The keycard from the captain.', + 'That can be handy some day.' + ]); + muri.room('lift').roomState.bridgeAccessible = true; + muri.get('entity').get('hydro.keycard').invisible = true; + }); }; hydro.onEnter = function() { door.sprite.playAnimation('close'); }; - hydro.update = function() { - }; - hydro.render = function() { background.render(); }; diff --git a/src/room_lift.js b/src/room_lift.js index d4bcbd5..39c0450 100644 --- a/src/room_lift.js +++ b/src/room_lift.js @@ -10,7 +10,6 @@ hydroDoorBroken: true }; - var createButtonEntity = function(i, room) { var e = muri.get('entity') .create('lift.button'+i, @@ -18,19 +17,33 @@ animations: buttonSheet.animations})) .addCallback(function() { buttons.forEach(function(b) { b.sprite.playAnimation('off'); }); - - if (room === 'bridge' && !roomState.bridgeAccessible) { - muri.get('bubble') - .talk([ - 'The bridge is not accessible.', - 'You have no sufficient permission to do that.']); + if (room === 'bridge') { + if (!roomState.bridgeAccessible) { + muri.get('bubble') + .talk([ + 'The bridge is not accessible.', + 'You have no sufficient permission to do that.']); + } else { + muri.end([ + 'You\'ve made it all the way to the bridge.', + 'The engine is running fine.', + 'You can finally head home and leave this rotten ship.', + '... ', + 'You crank the throttle all the way up.', + '...', + '...', + 'The ship burst apart.', + 'You are lost.', + 'Lost from the very beginning.' + ], false); + } return; } if (room === 'hydro' && roomState.hydroDoorBroken) { muri.get('bubble') .talk([ - 'The hyperlift moved, but to door to the hydro deck does not open.', + 'The hyperlift moved, but the door to the hydro deck does not open.', 'You can\'t access this deck with a broken door.' ]); return; @@ -42,7 +55,7 @@ 'Which is broken on this ship.', 'It takes no more than a second to drag you into space.', 'You are lost ... ....', - '... and die.']); + '... and die.'], true); return; } @@ -94,12 +107,11 @@ muri.get('bubble').talk([welcomeMessage]); }; - lift.update = function() {}; - lift.render = function() { background.render(); }; lift.name = 'lift'; + lift.roomState = roomState; muri.rooms.push(lift); }()); diff --git a/src/room_stasis.js b/src/room_stasis.js index ce11416..691523e 100644 --- a/src/room_stasis.js +++ b/src/room_stasis.js @@ -4,11 +4,61 @@ var stasis = {}; var background, backgroundDark = null; - var door = null; + var door, liftBox = null; var roomState = { isDoorOpen: false, - isLightOn: false, - isIntroRunning: true + isLightOn: true, //false + isIntroRunning: false, //true + hydroDoorBroken: false, // true + liftSwitches: ['off', 'off', 'off', 'off', 'off'] + }; + + var toggleLiftSwitch = function(i) { + if (!roomState.hydroDoorBroken) return; + var state = roomState.liftSwitches[i]; + var newState = state == 'on' ? 'off' : 'on'; + muri.get('entity').get('stasis.liftSwitch'+i).sprite.playAnimation(newState); + roomState.liftSwitches[i] = newState; + }; + + var liftSwitch = function(i) { + var switchAnimation = kontra.spriteSheet({ + image: kontra.assets.images.toggleSwitch_sheet, + frameWidth: 2, frameHeight: 1, + animations: { + 'off': {frames: 0}, + 'on': {frames: 1} + } + }); + var liftSwitch = kontra.sprite({ + x: 95, y: 16+i*2, + animations: switchAnimation.animations + }); + + return muri.get('entity') + .create('stasis.liftSwitch'+i, liftSwitch) + .addCallback(function() { + toggleLiftSwitch(i); + var randomSwitch = Math.floor(Math.random()*roomState.liftSwitches.length); + if (randomSwitch !== i) + toggleLiftSwitch(randomSwitch); + + var solved = true; + console.log(roomState.liftSwitches); + roomState.liftSwitches.forEach(function(s) { + console.log(s); + if (s === 'off') solved = false; + }); + if (solved) { + muri.get('bubble') + .talk([ + 'Once again, the ship shakes like crazy.', + 'Something broke or looses inside the lift and metal scrapes against the hull.', + 'Not sure if this is a good sign ...']); + muri.room('lift').roomState.hydroDoorBroken = false; + roomState.hydroDoorBroken = false; + } + }); }; stasis.init = function() { @@ -66,13 +116,22 @@ ]); }) .invisible = true; - + } + + if (!muri.room('engine').roomState.engineBroken && !liftBox) { + liftBox = kontra.sprite({x: 94, y: 15, width: 4, height: 11, color: '#000'}); + liftSwitch(0); + liftSwitch(1); + liftSwitch(2); + liftSwitch(3); + liftSwitch(4); } }; stasis.render = function() { if (roomState.isLightOn) { background.render(); + if (liftBox) liftBox.render(); } else { backgroundDark.render(); }