diff --git a/src/images/improvements/mascot.png b/src/images/improvements/mascot.png new file mode 100644 index 000000000..a6afcfa90 Binary files /dev/null and b/src/images/improvements/mascot.png differ diff --git a/src/images/npc/carrotGuy.png b/src/images/npc/carrotGuy.png new file mode 100644 index 000000000..3897474f6 Binary files /dev/null and b/src/images/npc/carrotGuy.png differ diff --git a/src/images/sprites/greendale/Speakeasy-light.png b/src/images/sprites/greendale/Speakeasy-light.png new file mode 100644 index 000000000..41f589bb7 Binary files /dev/null and b/src/images/sprites/greendale/Speakeasy-light.png differ diff --git a/src/images/sprites/greendale/officer.png b/src/images/sprites/greendale/officer.png new file mode 100644 index 000000000..0e38cb704 Binary files /dev/null and b/src/images/sprites/greendale/officer.png differ diff --git a/src/images/sprites/greendale/speakeasy-table-3.png b/src/images/sprites/greendale/speakeasy-table-3.png index 93f96931d..8b2099210 100644 Binary files a/src/images/sprites/greendale/speakeasy-table-3.png and b/src/images/sprites/greendale/speakeasy-table-3.png differ 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 000000000..608c1f40f Binary files /dev/null and b/src/images/sprites/greendale/speakeasy-table-4.png differ 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 000000000..f3733e1d0 Binary files /dev/null and b/src/images/sprites/greendale/speakeasy-table-5.png differ diff --git a/src/items/improvements/mascot.lua b/src/items/improvements/mascot.lua new file mode 100644 index 000000000..ce9bcf285 --- /dev/null +++ b/src/items/improvements/mascot.lua @@ -0,0 +1,10 @@ +return{ + name = "mascot", + description = "City College's Mascot", + type = "improvement", + subtype = "improvement", + info = "Pay someone to kidnap the mascot of Greendale's rival school, City College.", + MAX_ITEMS = 1, + quantity = 1, + directory = 'improvements/' +} diff --git a/src/maps/greendale-speakeasy.tmx b/src/maps/greendale-speakeasy.tmx index 605581298..8cf9c64f0 100644 --- a/src/maps/greendale-speakeasy.tmx +++ b/src/maps/greendale-speakeasy.tmx @@ -1,5 +1,5 @@ - + @@ -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}, }, }