From 3df5f0d766750b1056a7356f9cb55f651db0d286 Mon Sep 17 00:00:00 2001 From: Aaron Fischer Date: Wed, 13 Sep 2017 01:14:17 +0200 Subject: [PATCH] More coooode .... --- Makefile | 2 +- src/assets/images/laser_sheet.png | Bin 0 -> 156 bytes src/assets/images/lift_button.png | Bin 86 -> 86 bytes src/assets/images/room_bridge.png | Bin 242 -> 0 bytes src/assets/images/room_engine.png | Bin 248 -> 505 bytes src/assets/images/room_lift.png | Bin 345 -> 339 bytes src/assets/images/room_stasis.png | Bin 488 -> 603 bytes src/assets/styles.css | 6 ++++ src/index.html | 2 +- src/index_dev.html | 2 ++ src/muri.js | 11 ++++++- src/room_bridge.js | 28 ------------------ src/room_end.js | 12 ++++++++ src/room_engine.js | 46 ++++++++++++++++++++++++++++-- src/room_lift.js | 13 ++++++++- 15 files changed, 88 insertions(+), 34 deletions(-) create mode 100644 src/assets/images/laser_sheet.png delete mode 100644 src/assets/images/room_bridge.png delete mode 100644 src/room_bridge.js create mode 100644 src/room_end.js 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 0000000000000000000000000000000000000000..5204d4b0b573481ae5d80758dd42e52cd5566bb1 GIT binary patch literal 156 zcmeAS@N?(olHy`uVBq!ia0vp^{6Ngb!2~3qR8C$8q>?>d977~7CnqE%Xz2F*{`gpU zLJ9-(pBMp#Pm&THPmTVB6t{1le^-yOs8J;>QeeWgsmw|pUHdOTRpii{UG~{_3acRN zD(7i#%&(>XD_b~}p7{1CxHm_orT4t*lOK~>1XS$G7#?(|Zk>1Xtpm_H22WQ%mvv4F FO#ltSIDP;C literal 0 HcmV?d00001 diff --git a/src/assets/images/lift_button.png b/src/assets/images/lift_button.png index 43d73bccf473fd97c80ab52780050f5bba7fec74..f33284e18ce3a7d0c65af7a4af88d1d40230e180 100644 GIT binary patch delta 47 zcmWFwo1mk0!GPCm_s_bU%6rqddrLIPC@>W@a4<~&$vt`dL%wzfAnYWfANVlQOglNuja^{& zT{d3c`WYb~MCMKmX|Q=(<~_SJkYmM#4u#u40ytPSLOTl2cAn5!a=Q8b=GNbPdZr3S zo|x0|seh^axz_CpQrQ7DW0%e>ay20EbQM5<~bc~n{}Hv?*=-P!PC{xWt~$(698P>U1|UT diff --git a/src/assets/images/room_engine.png b/src/assets/images/room_engine.png index a9fcefed188b4161d71c4f93c230fc7fec727098..4ee2cd18463ae1576a0a5db0ec0f22cad977636d 100644 GIT binary patch delta 479 zcmV<50U-YP0r>-vB!3%FOjJbx000{u9w#UuK0PvZabEcN^7$r5{g)r++jRS^)J6aR z0hvieK~zY`?Ul=Vg&+`vlT6U_{!iQmh$v!@{q%Ivj=MPUPZ%!XNk|M)w3AIq6oaDF zXbMTxCND(g2#G?TF6zV)B(+i`I-DGN#w@j3p1;$?QlUg_2!AY0k)%uYRya9i7DQ|` ziP=o66;KW$&nuFVX}JvA08G*>gXvn!yINCvUK{}HGLZ%V*hU=;FY&Hce{DLwu33fv zXa?i5w)`RkO|O?0-3_7C+Ia|a6gNY(91z=1DWzy2iXtZ4p-WotB%(?wDnwF*UB-rV zLF*w6BU5gMXn)TDQqX|zic<*gihTHX5ElqR$bgdp=Sv6#_u440d^l*y3RxyZ0$|lq zdu^0gzq9446He%ywAv`|)JfVqAzz)7MjPd=Rej%+8LxToWTTDpRww$tC-bZCNvnE}-Gu`nQDtrnG9&Fu1O{*dQc3Tp-_A>tp#hkusZxH7o%50; zV}w8wVycwfjGgmxKN12U%v)$VN9Vi*0K`s3ieMd}aw;7;2yYv#b! W2@{t73!8BO0000Xhl>S*`%5%Dm( z!ZLF)^I}*e>tAGHHIg-yEG$K`hLTn6TbZ3K9J>oEjVzotlYeAI$U>)D?+(|8#_g9Z zG`spAVPX0TOVtxj4a@9@Vd-tYUPJ9iXFDv9&Poo;qq9)&x6|t~@2Pmo49lal(CnWk zSx%i54a+3Usk73^a_X!!vgj;2i_W66=qx&mWYJl47M(?BjfSjdK`C%p@DuL~!3*mLZuWTYP+Z#U>$)Jhq$F`M593Cn}DY#lq@jI>Xg^wbAU`BY|PG z!E(8{yaY>T{mLw?CbRmQg{5RxU$e4(D+f0V$8@mL%))6kWq(%0EOd(X?r?n=ZeFv{ zZ0mo(!sLQw(NmuW%k9@;*=<~}q4lG)35zkal3_7s7V7%u;44vy@rNEM*qCS=E9Wk{aBsknslm7-nVrX=e?f?J) diff --git a/src/assets/images/room_stasis.png b/src/assets/images/room_stasis.png index a03370f272ed53dedc261e72d50d6e5aa5824531..72f24c325888970dd15d4cebf53101fe5acb7240 100644 GIT binary patch delta 521 zcmV+k0`~pr1KR|UU4Q9GL_t(Y$L*HMa^o-zMA6-louric|IeKR_f4{F)tm;pKp>2# z21u3-1VNE+IeeQsPr^T)R)nk;vPW96bM(T(ZAT`5}A&@JLMn0000< LMNUMnLIPldl4Sk* delta 405 zcmV;G0c!r+1n2{hU4M2-L_t(Y$L*HMc7resMP)q&(jMCX|J>qvgxZF~rhVBcvh0fn zoRDJu0rQlh6gjCAk&TDjHf;1ku4E$JnHUL-M8=GLXI~~pV5cFYI}1kr;ctbYfG-EME7^2|Y4CvHRK zxF_C&6Ns5>dF?{8@w5;x4ak9kR^x#%Y#Aj&R$5m|%4HwAD2`o%`&KkQVdNB7EL|U2Ha!F_7=OALQ zJmI9@xB@B56@ME~QonKcKveZM_ZT!@uF+Q907-A7a&nWkYY^7EKVD6dUA_atJH)Gm zEM1Va@lEBBT%_Ld??d|Ydy)xSGLY}KNavZvJ_5lk1c#7q(~vy)8ssb2W>iCP0n%PU z1A;los2+jf5y%dxAkoHsluBU<59lBAM

murĂ­

a js13kgame by Aaron Fischer (2017)

loading game ...

+link rel="stylesheet" href="assets/styles.css">

murĂ­

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'); };