Skip to content

Instantly share code, notes, and snippets.

@bucketh3ad
Created May 15, 2013 01:41
Show Gist options
  • Save bucketh3ad/5581067 to your computer and use it in GitHub Desktop.
Save bucketh3ad/5581067 to your computer and use it in GitHub Desktop.
New Inventory Switching
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