From e91beab04c84d792668dab1e6de61aa49652af82 Mon Sep 17 00:00:00 2001 From: 8bitgentleman Date: Sat, 10 Oct 2015 12:44:45 -0400 Subject: [PATCH] Finish goat and light switch --- src/images/improvements/mascot.png | Bin 0 -> 119 bytes src/images/npc/carrotGuy.png | Bin 0 -> 973 bytes .../sprites/greendale/Speakeasy-light.png | Bin 0 -> 2499 bytes src/images/sprites/greendale/officer.png | Bin 0 -> 887 bytes .../sprites/greendale/speakeasy-table-3.png | Bin 899 -> 440 bytes .../sprites/greendale/speakeasy-table-4.png | Bin 0 -> 514 bytes .../sprites/greendale/speakeasy-table-5.png | Bin 0 -> 478 bytes src/items/improvements/mascot.lua | 10 ++ src/maps/greendale-speakeasy.tmx | 115 +++++++++++++----- src/nodes/enemies/goat.lua | 4 + src/nodes/rave-switch.lua | 51 -------- src/nodes/sprite.lua | 11 +- src/nodes/switch.lua | 45 +++++++ src/suppliers/bursar.lua | 2 +- 14 files changed, 154 insertions(+), 84 deletions(-) create mode 100644 src/images/improvements/mascot.png create mode 100644 src/images/npc/carrotGuy.png create mode 100644 src/images/sprites/greendale/Speakeasy-light.png create mode 100644 src/images/sprites/greendale/officer.png create mode 100644 src/images/sprites/greendale/speakeasy-table-4.png create mode 100644 src/images/sprites/greendale/speakeasy-table-5.png create mode 100644 src/items/improvements/mascot.lua delete mode 100644 src/nodes/rave-switch.lua create mode 100644 src/nodes/switch.lua diff --git a/src/images/improvements/mascot.png b/src/images/improvements/mascot.png new file mode 100644 index 0000000000000000000000000000000000000000..a6afcfa90179877741c7391ddeed18238733c574 GIT binary patch literal 119 zcmeAS@N?(olHy`uVBq!ia0vp^{2i literal 0 HcmV?d00001 diff --git a/src/images/npc/carrotGuy.png b/src/images/npc/carrotGuy.png new file mode 100644 index 0000000000000000000000000000000000000000..3897474f62578b2cd807c7acb09cefeee51a8126 GIT binary patch literal 973 zcmV;;12X)HP)Kc+v(iZ2ANdK zR%Ek7B-^uL@5Z0aOTcVJ_7vuNE;EF3!!t_OY_pp%O!fNI31z&uo2|(9hf4x%pT>jj z?P1((T{d_Fz$qY;K$}}}vvt_hUOp2J^!k0dQ`~G_whWFESheD2Ut4<|?)tTpCTYl= z#FC1et;UYy4)}fYf(#}J)HYv<}-N(T&YqlzT zRUGeCH(QtOZ;FfIbM8`7H|?3N!X77b4yPuCxzUx8vw6>KHTL97(?tp7z-Ftnr)wk} zPJMN;xZ-AC8~elQwvX-mqdq>J9k)NOKKD_`rW4}US-48O&lmVNGPQQ@!7g2I=k8AS z(fxgSx$8sF9?t--@foxT9BTBM?a;xNw!3mV^VQ+=_Vtr7&R)K0zkfZKwL^^#SCJF8 z3Kwnkn(ffRmbSac`RS2oJOAq2g{&PLQeFIdG)Ac;LXBRt9Xi<3w)^S|=kW83{PAv6 z&N95k1SK)sPCdhFv$=zfM>Q$iMVCVtyN_FOyNxwE-dYmbm!55NjZSTAsm;a*8}F`= zwz)fBA-fq04-Kgpy?Qt%x1{2*VzAL+#cH;xU9oH0DVrn<+TljWpbNNFMXJ#?*xbfM zX*O1_+YPP6U!QdFWK1|?)puEFquMl z@)=g6opLpivR#>H$M1$%!S;JRY;<_t#=XAaf*;xF8f@xduW5(oh=O+BoDJTclsMC3 zXIRa4YE)$J3ruNre0Nf!;-R^M+11(8Ycw~+;%j)Rv&?KYHjgC!%f8uW&$~kjE$&5r zv&(F=mnBg8J2JD?+fBRKY`g_N?)Dda&TO;i<1X+dl6v24vlp+mK^*pScqT{;>1OM& vCyTlmBH&`XM$J}bM}L+)_h-w^R%-tNHw&w+9cUX600000NkvXXu0mjf@_h5b literal 0 HcmV?d00001 diff --git a/src/images/sprites/greendale/Speakeasy-light.png b/src/images/sprites/greendale/Speakeasy-light.png new file mode 100644 index 0000000000000000000000000000000000000000..41f589bb7c29f4476b75241eae54a2edf295e9f1 GIT binary patch literal 2499 zcmeHJ`BPI@6uvJ637Z6JX+R-~j*1!=L~5mkB|w8!&@xI0L5W0(ltGXvA_95RfFNKf z9TqnNF4ZXkf}jXupskb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y%?bXrW2|G8EQq^%+5% z4W#f5GcbrRgZ=02XF{}w?dfaj_EvmvF$=z?F zH|;tz!+$GG{nq g;?v>!U)(5E{B$+FL6KSy@2?c?uVPGhJ13-NCk9{>OV literal 0 HcmV?d00001 diff --git a/src/images/sprites/greendale/officer.png b/src/images/sprites/greendale/officer.png new file mode 100644 index 0000000000000000000000000000000000000000..0e38cb7041c736bc0bbee8eca403fd9ae724eb29 GIT binary patch literal 887 zcmV--1Bm>IP)C={h0009%Nklvo?%jIGi3={%dw*pWz}wybT!2CPUVP+QjSHhTQ}DLa6>6>1CG_SMUM z#9%0Ccr4awwdL#soWdESMeSkiE{=^B>~pB&YWHq;(Y`vawupTMe}DPV%aWqDnBB!o zV65Y6_ipFm;d<{Mb0bad!EAbh5cU(KV70~VnF;oHCNZn$>5II$@B)mU#fRPa(8 zDt4`!eEaigKi~edA8#MpXx?+}!*cP=T(tq+wGWPyZEQIyv7v&O+Rb^fV%MmNUvHPA z#6EycKn3^P5fgOULj^CjQw0y(aBbgr#b(+kerm$x+9xMqBix6P1YkkJg4eK91uwNz zD-**uvDMGL_cvD@n_Tb^OC-rIc&wuwJ2kRPY-+JHYy-`@V6&5LpESY>9_s|PC|JQu zY|7})wV`4&ZO{)kJlQsR?e^bqHk&p|ijpdL4LenEt{v{e3v6=DIX0`{>-D;gJ_=rH zLj@<=1{%<*0iIzSY@@@qt1Kxmp1i3x!Z|i~2~XJQHUFILXfeWqzkkQOK2Sz@sSOo{ zX_E?mrna$9&FfCMLiztUf011z$&TexyPCb9x>&^8K|g0udk`C+_NjF|vZYpgSi20T z-tkad#4g6k_aW8p-9GLPd&1S0wU5*H`RMJ*SC#pEZYPsT8$lbj&(Ai8EpZBW2{;{B zTh!i9Y4_a*`yS-lP?r?7oQ zXEYjFwTH8#a4dZ-4r`FI&Fj~S;n+#jg6oSo$6oIS<{v4^m$&Tkkt)p3Ea zsg5g#e06*vz7}Y+{c?hb%7lykkRjy2gLKPEG93 z(LkXP>_me?Z>^Mx!dxHkl8In8@;1X-K*mQq>z{~V5@3q*LWPDD1}5}aPlJOBiowJ} z&_S`7x6k(|2wYDFb5q?eClngEo)jiFf=RWSk$}iP9F!8I=$ROYd{p28QjE2~KeVzmR*gyi@-XHP-!*a61;J&q iSg(!HtFX@IQ-yCG3}A=J=?J_40000Xf90Z}nAQbT+Q6hNAK?sq8VA_KhFS&`ci>}x&8B_dzIi)4o>w;g*6nr?q3|MVwHl^~ z@uLWeA)(!FODTd794HwIQRG!dq=fN!T#5h*aJ}E}=URr61OhFiP$B>bo{;BSp;aXF zD#B0sX0vHb9%Qh=7?B4Vfq+iFywxTTvrcs7;y-v2WP;dhDiUUsRmAe))jHlfAweX< zAS;Az{n8rZv2mm0?>iwPDl4MSn~I=iI58}2ijYZgAuIggf4+Zdb!bG1$T}+mBH~Dp ziBOS{byjGJVCxBejbv0D5lfL3tOQy{QWBh~6)GY`=VT(tTtP>M6Y~lPN+g6g1C>e8 z6+-$rHQkm8QK<_$GfUS5NQLl-`&}`-T6H^kV8y$Qk$r74*K;Gn4<0x?I!5#PL5Pp@ z{XoAsGF%i93hw*SZyYp0OZf3^Ka?@1GL}LF@b%XT+FSfVZx+WG*k=P52#Fq2aL;DA_EM zGYL~}@Xv2uTd`XC6MK!GtK18{LR+mCs@LlnrjM695#%)~5ct{QdBq65)oHIlnm5pG`L@!3PqB>Hx&_kpWeli0Qd7m;6PY7 zYm*+kFvH$csZ>xJA|6g2;b2UG`&kiO2|OY6TScM2brEsV5+PWNl*(9E5h|bHx}WZ; zyfu=RkV#vHdBoC)5Vf0~4kCE2w^BqYq7+ezC`Du_;_+aBXc2H+I1v!^-OWv30Bqsd zX&Fh2AQI?fvhSpf-sRIsgz0ZWptJ;5gs4xZSzu!|nk|gHpq(k6DuE`oH1E{Y&$8(} Z{lD03BV`O716%+A002ovPDHLkV1lAZi#`AV diff --git a/src/images/sprites/greendale/speakeasy-table-4.png b/src/images/sprites/greendale/speakeasy-table-4.png new file mode 100644 index 0000000000000000000000000000000000000000..608c1f40fd91445bc84e5a01b6a3aa17296d60f8 GIT binary patch literal 514 zcmV+d0{#7oP)YjXyW(1fK2s2z@3@QB4Z-fDr~-Bx^_9?2;{Ji=+z=|R|f zDB*-3uIa)IoacZRCruN6arzEVO-6yzH!}f*N1Q0J<5ikI$g~aLOvXc#-hg-IRPkyX zU7wA0_NEHn3-FA#1a1=;9B*EFJaZjS@$JH8(VpX-z@I*9QfTZS2zB}8EVrjd;kCd07*qoM6N<$ Ef`HZbe*gdg literal 0 HcmV?d00001 diff --git a/src/images/sprites/greendale/speakeasy-table-5.png b/src/images/sprites/greendale/speakeasy-table-5.png new file mode 100644 index 0000000000000000000000000000000000000000..f3733e1d0c0db1882b3d519f22af27310d4bb436 GIT binary patch literal 478 zcmV<40U`d0P)a7Y9KUaVs4a+#J-&(apc3|APP3lNY&g z#^g-ylH9%e9(;MdHVN<3CTXeXRb0K*35ds|R`1*6;oyUl*|6i95jFt=ft?hD5iSB` z1Q`e;Tm_JVr~o7&SpZH$l71uQjdjG}p$=*N^KBF4uG-#e^$)&J3DfRuiBAFJQLX!+ z2Co;>VHm*(Mlhn9x;t6~(Vwo?0K0gO1OkUW@6@B=#bfL;#A!rpWf@dqL|L^pKLT?8 zLf|(2!^toR5s4osO9}(@c4vNNuF*&gz7}kZM!D?#OwzGbF@~f8s*W~9=c6w>T8QIT z&6)gf1o_jcs5{&K(v-ac7{Q1P)%ABkH%=gMkekO_?c{|NjxYu2KuSS8f4mq0aDVHF z;QBNiL^rs<6A05V!Uc%+yVKBoPpE3W*#r@?KRXz~2u2JU;>`C!M&Ozh0ten}x1-^) z - + @@ -31,18 +31,6 @@ - - - - - - - - - - - - @@ -59,26 +47,38 @@ - + - + - + - + - + - + + + + + + + + + + + + + @@ -106,14 +106,6 @@ - - - - - - - - @@ -170,13 +162,76 @@ - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/nodes/enemies/goat.lua b/src/nodes/enemies/goat.lua index 47b155a2d..c9ae5eb10 100644 --- a/src/nodes/enemies/goat.lua +++ b/src/nodes/enemies/goat.lua @@ -33,6 +33,10 @@ return { }, }, enter = function( enemy ) + local hidden = enemy.db:get('mascot', false) + if enemy.containerLevel.name == 'greendale-exterior' and hidden ~= true then + enemy.state = 'hidden' + end enemy.direction = math.random(2) == 1 and 'left' or 'right' enemy.maxx = enemy.position.x + math.random(48,60) enemy.minx = enemy.position.x - math.random(48,60) diff --git a/src/nodes/rave-switch.lua b/src/nodes/rave-switch.lua deleted file mode 100644 index ca96f0e0f..000000000 --- a/src/nodes/rave-switch.lua +++ /dev/null @@ -1,51 +0,0 @@ -local Gamestate = require 'vendor/gamestate' - -local RaveSwitch = {} -RaveSwitch.__index = RaveSwitch --- Nodes with 'isInteractive' are nodes which the player can interact with, but not pick up in any way -RaveSwitch.isInteractive = true - -function RaveSwitch.new(node, collider) - local raveswitch = {} - setmetatable(raveswitch, RaveSwitch) - raveswitch.bb = collider:addRectangle(node.x, node.y, node.width, node.height) - raveswitch.bb.node = raveswitch - raveswitch.player_touched = false - raveswitch.level = node.properties.level - raveswitch.reenter = node.properties.reenter - raveswitch.to = node.properties.to - raveswitch.height = node.height - raveswitch.width = node.width - collider:setPassive(raveswitch.bb) - return raveswitch -end - -function RaveSwitch:switch(player) - local level = Gamestate.get(self.level) - local current = Gamestate.currentState() - - current.collider:setPassive(player.bb) - Gamestate.switch(self.level) - if self.to ~= nil then - local level = Gamestate.get(self.level) - local coordinates = {x=level.doors[self.to].x, - y=level.doors[self.to].y, - } - level.player.position = {x=coordinates.x+self.width/2-24, - y=coordinates.y+self.height-48} -- Copy, or player position corrupts entrance data - - if level.doors[self.to].warpin then - level.player:respawn() - end - end -end - -function RaveSwitch:keypressed( button, player ) - if button == 'INTERACT' then - self:switch(player) - -- Key has been handled, halt further processing - return true - end -end - -return RaveSwitch diff --git a/src/nodes/sprite.lua b/src/nodes/sprite.lua index a25ca62aa..a6e92b7fd 100644 --- a/src/nodes/sprite.lua +++ b/src/nodes/sprite.lua @@ -1,5 +1,6 @@ local anim8 = require 'vendor/anim8' local utils = require 'utils' +local app = require 'app' local Sprite = {} @@ -79,12 +80,14 @@ function Sprite.new(node, collider, level) sprite.velocity_y = tonumber(p.velocity_y) end + sprite.db = app.gamesaves:active() + sprite.trigger = p.trigger or nil + return sprite end function Sprite:update(dt) - self.dt = self.dt + dt - + self.dt = self.dt + dt if self.random and self.dt > self.interval then self.dt = 0 self.animation:gotoFrame(1) @@ -112,6 +115,10 @@ function Sprite:update(dt) end function Sprite:draw() + if self.trigger ~= nil then + local triggered = self.db:get( self.trigger ) + if triggered ~= true then return end + end if self.animation then self.animation:draw(self.sheet, self.x, self.y + self.offsetY, 0, self.flip and -1 or 1, 1, self.flip and self.width or 0) else diff --git a/src/nodes/switch.lua b/src/nodes/switch.lua new file mode 100644 index 000000000..58f24c78c --- /dev/null +++ b/src/nodes/switch.lua @@ -0,0 +1,45 @@ +local Gamestate = require 'vendor/gamestate' +local app = require 'app' +local sound = require 'vendor/TEsound' + +local Switch = {} +Switch.__index = Switch +-- Nodes with 'isInteractive' are nodes which the player can interact with, but not pick up in any way +Switch.isInteractive = true + +function Switch.new(node, collider) + local switch = {} + setmetatable(switch, Switch) + switch.bb = collider:addRectangle(node.x, node.y, node.width, node.height) + switch.bb.node = switch + switch.player_touched = false + switch.height = node.height + switch.width = node.width + switch.trigger = node.properties.trigger or nil + switch.db = app.gamesaves:active() + switch.sound = node.properties.sound or false + collider:setPassive(switch.bb) + return switch +end + +function Switch:setDB(trigger) + if self.db:get( trigger ) == true then + self.db:set( trigger, false) + else + self.db:set( trigger, true) + end +end + +function Switch:keypressed( button, player ) + if button == 'INTERACT' then + if self.sound ~= false then + sound.playSfx( self.sound ) + end + if self.trigger ~= nil then + self:setDB(self.trigger) + return true + end + end +end + +return Switch diff --git a/src/suppliers/bursar.lua b/src/suppliers/bursar.lua index 008c93ced..8266aad0b 100644 --- a/src/suppliers/bursar.lua +++ b/src/suppliers/bursar.lua @@ -5,7 +5,7 @@ return { {"airplane",1,100000,'greendale-airplane'}, {"hologram",1,50000,'hologram-pierce'}, {"shirleySandwich",1,50000,'sandwich-shop'}, - --{"mascot",1,10000}, + {"mascot",1,1000,'mascot'}, --{"building",1,500000}, }, }