Skip to content

Commit

Permalink
Studyroom complete. Fixes to level and overworld.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Hoff committed Nov 27, 2012
1 parent ec45878 commit 59a5870
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 17 deletions.
10 changes: 7 additions & 3 deletions src/floorspaces.lua
@@ -1,8 +1,11 @@
local Floorspaces = {} local Floorspaces = {}
Floorspaces.__index = Floorspaces Floorspaces.__index = Floorspaces
Floorspaces.primary = false
Floorspaces.active = false function Floorspaces:init()
Floorspaces.objects = {} self.primary = false
self.active = false
self.objects = {}
end


function Floorspaces:setPrimary( fs ) function Floorspaces:setPrimary( fs )
assert( not self.primary, "You can only have one primary floorspace!" ) assert( not self.primary, "You can only have one primary floorspace!" )
Expand All @@ -13,6 +16,7 @@ function Floorspaces:setPrimary( fs )
end end


function Floorspaces:getPrimary() function Floorspaces:getPrimary()
assert( self.primary, "You must have one primary floorspace!" )
return self.primary or false return self.primary or false
end end


Expand Down
Binary file added src/images/plant.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/table.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/tilesets/greendale-interior.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/level.lua
Expand Up @@ -18,6 +18,7 @@ local tile_cache = {}
local Player = require 'player' local Player = require 'player'
local Floor = require 'nodes/floor' local Floor = require 'nodes/floor'
local Floorspace = require 'nodes/floorspace' local Floorspace = require 'nodes/floorspace'
local Floorspaces = require 'floorspaces'
local Platform = require 'nodes/platform' local Platform = require 'nodes/platform'
local Wall = require 'nodes/wall' local Wall = require 'nodes/wall'


Expand Down Expand Up @@ -214,6 +215,7 @@ function Level.new(name)
end end
end end


Floorspaces:init()
if level.map.objectgroups.floorspace then if level.map.objectgroups.floorspace then
for k,v in pairs(level.map.objectgroups.floorspace.objects) do for k,v in pairs(level.map.objectgroups.floorspace.objects) do
v.objectlayer = 'floorspace' v.objectlayer = 'floorspace'
Expand Down
51 changes: 38 additions & 13 deletions src/maps/studyroom.tmx
Expand Up @@ -5,26 +5,21 @@
<property name="title" value="Greendale"/> <property name="title" value="Greendale"/>
</properties> </properties>
<tileset firstgid="1" name="greendale_interior" tilewidth="24" tileheight="24"> <tileset firstgid="1" name="greendale_interior" tilewidth="24" tileheight="24">
<image source="../images/tilesets/greendale-interior.png" width="576" height="432"/> <image source="../images/tilesets/greendale-interior.png" width="264" height="144"/>
</tileset> </tileset>
<layer name="background" width="29" height="14"> <layer name="background" width="29" height="14">
<data encoding="base64" compression="zlib"> <data encoding="base64" compression="zlib">
eJxLZGBgYKYjTgLixFE7R7SdRsPEn+xAzEEi5sRhBro4LjvlgViBRKyIwwx0cVx2mgOxBYnYEqpXGs0MSzx2mlEJGxOhBmanDB3xQNlZCcRMdMRVQAwAchUf4A== eJzTZWBgYKEj1gNiXSBmHiA76YVH7Ry1c9ROBgY+EuyUoRKWJEINzE5+OuKBstMCiJnoiC2BGAC6zw7M
</data> </data>
</layer> </layer>
<layer name="side walls" width="29" height="14"> <layer name="side walls" width="29" height="14">
<data encoding="base64" compression="zlib"> <data encoding="base64" compression="zlib">
eJxjYGBgMIRiWgJ0O0btHLVz1M5RO9HtNKWxnUDzGwxR+Qy+NLYTaH4DyF4kPl2AL5Kd9AYABnQMEw== eJzt1LEJADAIBMDfwsLeOTJaRstoUUjApH8hkAfBb7xOADCgoSDujL2rm2w3PE2mLJdphiepyxpmbuOb33zVVLLp97ucPf4ENX6/h5t6SSyZ1Znc8Arp
</data> </data>
</layer> </layer>
<layer name="accents bg" width="29" height="14"> <layer name="accents bg" width="29" height="14">
<data encoding="base64" compression="zlib"> <data encoding="base64" compression="zlib">
eJxjYBgFo2AUDHbABcTcQMxDRzuVgFgZiFXoZJ8JEFsBsTUQ29DJTh8gDgLiYCAOoZOdKXSyZyABAOOMAxk= eJxjYBgFo2AUDBbABcTcNDKbF4e4KBCL0chOXEABiBWBWAtJTIqAHiUgVgZiFSifBwvGB7SBWAeINZHEVIlzLtnADIjNgVgDScyAxnbCgDqd7MEGAHfEAwk=
</data>
</layer>
<layer name="accents" width="29" height="14">
<data encoding="base64" compression="zlib">
eJxjYBgFo2AUDBbAC8R8NDJbCoe4KhCr0chOXMAWiO2AOBCLXCoQpwFxOhBnIIl7ArEXEHtD+ZJYMD4QCsRhQByAJm4FxLVAXAfE9UDcQKQfiAG5QJwHxP5Y5KYC8TQgng7EM6hoJwz40cBMYgEALO0LQw==
</data> </data>
</layer> </layer>
<objectgroup color="#0000a4" name="nodes" width="29" height="14"> <objectgroup color="#0000a4" name="nodes" width="29" height="14">
Expand All @@ -34,12 +29,42 @@
<property name="to" value="main"/> <property name="to" value="main"/>
</properties> </properties>
</object> </object>
<object type="floorspace" x="96" y="264" width="552" height="48"> <object name="main" type="door" x="168" y="240" width="23" height="45"/>
<object type="sprite" x="72" y="258" width="74" height="54">
<properties> <properties>
<property name="angled" value="true"/> <property name="depth_offset" value="30"/>
<property name="offset" value="5"/> <property name="height" value="54"/>
<property name="sheet" value="images/table.png"/>
<property name="width" value="74"/>
</properties> </properties>
</object> </object>
<object name="main" type="door" x="168" y="240" width="23" height="45"/> <object type="sprite" x="58" y="230" width="34" height="70">
<properties>
<property name="depth_offset" value="19"/>
<property name="height" value="70"/>
<property name="sheet" value="images/plant.png"/>
<property name="width" value="34"/>
</properties>
</object>
</objectgroup>
<objectgroup name="floorspace" width="29" height="14">
<object name="table" x="104" y="282">
<properties>
<property name="height" value="22"/>
</properties>
<polygon points="0,0 40,0 10,30 -30,30"/>
</object>
<object name="bookshelf" x="600" y="264">
<properties>
<property name="height" value="93"/>
</properties>
<polygon points="0,0 24,0 48,24 24,24"/>
</object>
<object x="72" y="264">
<properties>
<property name="primary" value="true"/>
</properties>
<polygon points="0,0 552,0 600,48 0,48 30,18 -20,18"/>
</object>
</objectgroup> </objectgroup>
</map> </map>
1 change: 0 additions & 1 deletion src/overworld.lua
Expand Up @@ -284,7 +284,6 @@ function state:keypressed( button )
--set the position before the switch to prevent automatic exiting from touching instant doors --set the position before the switch to prevent automatic exiting from touching instant doors
level.player.position = {x=coordinates.x, y=coordinates.y} -- Copy, or player position corrupts entrance data level.player.position = {x=coordinates.x, y=coordinates.y} -- Copy, or player position corrupts entrance data


Gamestate.load(self.zone.level, level.new(level.name))
Gamestate.switch(self.zone.level) Gamestate.switch(self.zone.level)
end end


Expand Down

0 comments on commit 59a5870

Please sign in to comment.