Skip to content

Commit

Permalink
Finish goat and light switch
Browse files Browse the repository at this point in the history
  • Loading branch information
8bitgentleman committed Oct 10, 2015
1 parent 93c5d57 commit e91beab
Show file tree
Hide file tree
Showing 14 changed files with 154 additions and 84 deletions.
Binary file added src/images/improvements/mascot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/npc/carrotGuy.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/sprites/greendale/Speakeasy-light.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/sprites/greendale/officer.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/images/sprites/greendale/speakeasy-table-3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/sprites/greendale/speakeasy-table-4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/sprites/greendale/speakeasy-table-5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/items/improvements/mascot.lua
Original file line number Diff line number Diff line change
@@ -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/'
}
115 changes: 85 additions & 30 deletions src/maps/greendale-speakeasy.tmx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" renderorder="right-down" width="24" height="14" tilewidth="24" tileheight="24" nextobjectid="27">
<map version="1.0" orientation="orthogonal" renderorder="right-down" width="24" height="14" tilewidth="24" tileheight="24" nextobjectid="48">
<properties>
<property name="blue" value="92"/>
<property name="green" value="114"/>
Expand Down Expand Up @@ -31,18 +31,6 @@
</data>
</layer>
<objectgroup color="#90d83c" name="floorspace">
<object id="1" x="408" y="221">
<properties>
<property name="height" value="20"/>
</properties>
<polygon points="0,0 48,48 144,48 96,0"/>
</object>
<object id="2" x="6" y="288">
<properties>
<property name="primary" value="true"/>
</properties>
<polygon points="-6,0 66,-72 396,-72 408,-60 516,-60 570,0 570,24 -6,24"/>
</object>
<object id="3" x="230" y="232" width="120" height="6">
<properties>
<property name="height" value="38"/>
Expand All @@ -59,26 +47,38 @@
</properties>
<polygon points="2,0 -1,5 48,5 46,0"/>
</object>
<object id="17" x="465" y="246" width="6" height="4">
<object id="24" x="232" y="303" width="39" height="6">
<properties>
<property name="height" value="34"/>
<property name="height" value="62"/>
</properties>
</object>
<object id="19" x="448" y="220" width="14" height="1">
<object id="26" x="298" y="299" width="50" height="6">
<properties>
<property name="height" value="20"/>
<property name="height" value="62"/>
</properties>
</object>
<object id="24" x="232" y="305" width="39" height="6">
<object id="31" x="380" y="304" width="64" height="6">
<properties>
<property name="height" value="62"/>
</properties>
</object>
<object id="26" x="298" y="301" width="65" height="6">
<object id="32" x="476" y="298" width="50" height="6">
<properties>
<property name="height" value="62"/>
</properties>
</object>
<object id="2" x="6" y="288">
<properties>
<property name="primary" value="true"/>
</properties>
<polygon points="-6,0 66,-72 396,-72 408,-60 516,-60 570,0 570,24 -6,24"/>
</object>
<object id="1" x="408" y="221">
<properties>
<property name="height" value="20"/>
</properties>
<polygon points="0,0 48,48 144,48 96,0"/>
</object>
</objectgroup>
<objectgroup name="nodes">
<object id="6" type="sprite" x="120" y="243" width="65" height="62">
Expand Down Expand Up @@ -106,14 +106,6 @@
<property name="width" value="35"/>
</properties>
</object>
<object id="10" name="raveSwitch" type="door" x="144" y="162" width="24" height="60">
<properties>
<property name="button" value="INTERACT"/>
<property name="level" value="rave-hallway"/>
<property name="sound" value="alarmswitch"/>
<property name="to" value="raveSwitch"/>
</properties>
</object>
<object id="11" type="sprite" x="230" y="164" width="120" height="72">
<properties>
<property name="animation" value="1-5,1"/>
Expand Down Expand Up @@ -170,13 +162,76 @@
<property name="width" value="39"/>
</properties>
</object>
<object id="25" type="sprite" x="298" y="243" width="66" height="64">
<object id="25" type="sprite" x="298" y="254" width="51" height="50">
<properties>
<property name="depth" value="4"/>
<property name="height" value="64"/>
<property name="height" value="50"/>
<property name="sheet" value="images/sprites/greendale/speakeasy-table-3.png"/>
<property name="width" value="66"/>
<property name="width" value="51"/>
</properties>
</object>
<object id="29" type="sprite" x="182" y="184" width="31" height="48">
<properties>
<property name="animation" value="1-5,1|4,1|3,1|2,1|1,1"/>
<property name="depth" value="2"/>
<property name="foreground" value="false"/>
<property name="height" value="48"/>
<property name="random" value="true"/>
<property name="sheet" value="images/npc/carrotGuy.png"/>
<property name="speed" value=".1"/>
<property name="width" value="31"/>
</properties>
</object>
<object id="30" type="sprite" x="380" y="266" width="64" height="42">
<properties>
<property name="depth" value="4"/>
<property name="height" value="42"/>
<property name="sheet" value="images/sprites/greendale/speakeasy-table-4.png"/>
<property name="width" value="46"/>
</properties>
</object>
<object id="33" type="sprite" x="476" y="244" width="49" height="59">
<properties>
<property name="depth" value="4"/>
<property name="height" value="59"/>
<property name="sheet" value="images/sprites/greendale/speakeasy-table-5.png"/>
<property name="width" value="49"/>
</properties>
</object>
<object id="34" type="sprite" x="284" y="242" width="23" height="49">
<properties>
<property name="animation" value="1-5,1|5,1|4,1|3,1|2,1|1,1"/>
<property name="depth" value="2"/>
<property name="foreground" value="false"/>
<property name="height" value="49"/>
<property name="random" value="true"/>
<property name="sheet" value="images/sprites/greendale/officer.png"/>
<property name="speed" value=".1"/>
<property name="width" value="23"/>
</properties>
</object>
<object id="35" type="switch" x="144" y="156" width="24" height="60">
<properties>
<property name="button" value="INTERACT"/>
<property name="sound" value="alarmswitch"/>
<property name="trigger" value="speakeasy-lights"/>
</properties>
</object>
<object id="44" type="info" x="181" y="184" width="31" height="48">
<properties>
<property name="info" value="What can I say, they ran out of costumes."/>
</properties>
</object>
<object id="47" type="sprite" x="0" y="2" width="22" height="332">
<properties>
<property name="depth" value="4"/>
<property name="foreground" value="true"/>
<property name="height" value="336"/>
<property name="sheet" value="images/sprites/greendale/speakeasy-light.png"/>
<property name="trigger" value="speakeasy-lights"/>
<property name="width" value="576"/>
</properties>
</object>
</objectgroup>
<objectgroup name="Object Layer 3"/>
</map>
4 changes: 4 additions & 0 deletions src/nodes/enemies/goat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
51 changes: 0 additions & 51 deletions src/nodes/rave-switch.lua

This file was deleted.

11 changes: 9 additions & 2 deletions src/nodes/sprite.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local anim8 = require 'vendor/anim8'
local utils = require 'utils'
local app = require 'app'

local Sprite = {}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
45 changes: 45 additions & 0 deletions src/nodes/switch.lua
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/suppliers/bursar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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},
},
}

0 comments on commit e91beab

Please sign in to comment.