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
Elm = (function (){ | |
//Begin elm-runtime.js | |
'use strict'; | |
var Elm = ... | |
}; | |
//End elm-runtime.js | |
Elm.MeteorHelpers = [A2,A3,A4,A5,A6,A7,A8,A9,F2,F3,F4,F5,F6,F7,F8,F9]; |
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
import Math.Vector2 (Vec2) | |
import Math.Vector3 (..) | |
import Math.Matrix4 (..) | |
import Graphics.WebGL (..) | |
import Mouse | |
import Keyboard | |
-- Define the mesh for a crate | |
crate : [Triangle { pos:Vec3, coord:Vec3 }] | |
crate = concatMap rotatedFace [ (0,0), (90,0), (180,0), (270,0), (0,90), (0,-90) ] |
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
import Keyboard | |
import Mouse | |
mpos : Signal (Int,Int) | |
mpos = Mouse.position | |
kpos : Signal {x:Int,y:Int} | |
kpos = Keyboard.arrows | |
draw1 : (Int,Int) -> Element |
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 |
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
-- 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
--- | |
-- 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
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
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
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 |
NewerOlder