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
... | |
-- From splash to select | |
function state:keypressed( button ) | |
Gamestate.switch("select") | |
end | |
... |
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
Possibility 1: | |
self.konami = { 'UP', 'UP', 'DOWN', 'DOWN', 'LEFT', 'RIGHT', 'LEFT', 'RIGHT', 'JUMP', 'ATTACK' } | |
TO | |
self.konami = { 'UP', 'UP', 'DOWN', 'DOWN', 'LEFT', 'RIGHT', 'LEFT', 'RIGHT', 'SELECT', 'ATTACK' } | |
Possibilty 2: | |
if self.konami[self.konami_idx + 1] == button then | |
self.konami_idx = self.konami_idx + 1 |
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
BEFORE: | |
function Inventory:keypressed( button ) | |
if self:isOpen() then | |
if button == 'SELECT' then | |
self:close() | |
end | |
if button == 'RIGHT' then | |
self:right() | |
end | |
if button == 'LEFT' then |
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
inventory.pageList = { | |
weapons = 'keys', | |
keys = 'materials', | |
materials = 'consumables', | |
consumables = 'weapons' | |
} --Each key's value is the subsequent page name | |
inventory.pageNext = 'consumables' --Initial inventory page | |
inventory.pageLength = 13 --With 0 index, pages have a capacity of 14 | |
inventory.pages = {} | |
for i in pairs(inventory.pageList) do --Creates a new blank table for each key in pageList |
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
This is the relevant code in its current form. | |
These two functions are responsible for closing the inventory, and should be consolidated somehow: | |
--- | |
-- Begins closing the players inventory | |
-- @return nil | |
function Inventory:close() | |
self.player.controlState:standard() | |
self:craftingClose() | |
self.pageNext = self.state |
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 |
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
--- | |
-- Drops the currently selected item and destroys it TODO: Prompt for confirmation and/or create a node. | |
-- @return nil | |
function Inventory:drop() | |
if self.craftingState == 'open' then return end --Ignore dropping in the crafting annex | |
local slotIndex = self:slotIndex(self.cursorPos) | |
if self.pages[self.currentPageName][slotIndex] then | |
local level = GS.currentState() | |
local itemNode = self.pages[self.currentPageName][slotIndex].props | |
local NodeClass = require('/nodes/' .. itemNode.type) |
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
-- Klein Bottle Asteroids | |
-- By: bucketh3ad | |
-- Ludum Dare 29 | |
import Keyboard | |
--MODELS AND INPUTS | |
type Input = {space:Bool, dx:Int, dy:Int, dt:Time} |
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
-- Klein Bottle Asteroids: Caffeinated Version | |
-- By: bucketh3ad | |
-- MODIFIED AFTER Ludum Dare 29 | |
import Keyboard | |
--MODELS AND INPUTS | |
type Input = {space:Bool, dx:Int, dy:Int, dt:Time} |
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
-- subArray - Take two Ints, i and l, and an Array and returns an Array with length l starting at index i | |
subArray : Int -> Int -> Array a -> Array a | |
subArray i l = slice i (i + l - 1) | |
-- slice' - Exclusive slicing (breaks negative indices) | |
slice' i j = slice i (j-1) | |
subArray' i l = slice' i (i + l) | |
take' = slice' 0 |
OlderNewer