Created
May 15, 2013 01:41
-
-
Save bucketh3ad/5581067 to your computer and use it in GitHub Desktop.
New Inventory Switching
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Inventory.new() | |
... | |
inventory.pageList = { | |
weapons = {'keys', 'consumables'}, | |
keys = {'materials', 'weapons'}, | |
materials = {'consumables', 'keys'}, | |
consumables = {'weapons', 'materials'} | |
} --Each key's value is a table with this format: {nextpage, previouspage} | |
... | |
end | |
--- | |
-- Switches to the next or previous inventory screen | |
-- @param direction 1 for next or 2 for previous determines direction of page switch | |
-- @return nil | |
function Inventory:switchScreen( direction ) | |
self:craftingClose() | |
self.cursorPos.x = 0 | |
self.scrollbar = 1 | |
self.currentPageName = self.pageList[self.currentPage][direction] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment