Skip to content

Instantly share code, notes, and snippets.

@NimbusBP1729
NimbusBP1729 / floorspace.lua
Created November 15, 2012 12:26
cleaning up the children of reloadable objects
local Block = require 'nodes/block'
local controls = require 'controls'
local Floorspace = {}
Floorspace.__index = Floorspace
--=====================
--Following line is new
--=====================
Floorspace.isReloadable = true
@NimbusBP1729
NimbusBP1729 / player.lua
Created November 14, 2012 10:44
A finite state machine for player.lua that manages poses
--a snippet of how player.lua might function
local currentState = sm.wielding.lookup
local pose = currentState.pose
local keydown_DOWN = controls.isDown( 'DOWN' )
--at keyPress
if currentState.key then
currentState = currentState.key
@NimbusBP1729
NimbusBP1729 / mace.lua
Created November 3, 2012 03:04
mace is a subclass of weapon
-----------------------------------------------
-- mace.lua
-- Represents a mace that a player can wield or pick up
-- Created by NimbusBP1729
-----------------------------------------------
local Weapon = require 'nodes/weapon'
local utils = require 'utils'
local Mace = {}
Mace.__index = Mace
@NimbusBP1729
NimbusBP1729 / alpha1.lua
Created October 28, 2012 20:35
What we do...
--this is what we generally do
local Alpha = {}
Alpha.__index = Alpha
Alpha.alpha = true
--many lines of code later:
--to test a node's type:
if node.alpha then
@NimbusBP1729
NimbusBP1729 / Jhoff's Advice
Created October 27, 2012 03:21
Jhoff's Git Advice
Your master branch should always be an exact mirror of the upstream master:
Add upstream as a remote repository ( only need to do this one time ever ): git remote add upstream https://github.com/kyleconroy/hawkthorne-journey.git
Everytime you want to sync master, run the following 3 commands:
git checkout master (next do 'git fetch upstream')
git pull upstream master
git push origin master
To do a new pull request:
Check out your master branch ( this will be used as the basis for your new branch )
@NimbusBP1729
NimbusBP1729 / leaf.lua
Created October 23, 2012 03:07
LeafItem Leaf require loop
-----------------------------------------------
-- leaf.lua
-- Represents a leaf when it is in the world
-- Created by HazardousPeach
-----------------------------------------------
local controls = require 'controls'
local Leaf = {}
Leaf.__index = Leaf
@NimbusBP1729
NimbusBP1729 / Abed.lua
Created October 18, 2012 00:57
An example player file indicating motions that are necessary for attacks()
function plyr.new(sheet)
local new_plyr = {}
new_plyr.sheet = sheet
new_plyr.sheet:setFilter('nearest', 'nearest')
new_plyr.positions = position_matrix_main
local g = anim8.newGrid(48, 48, new_plyr.sheet:getWidth(),
new_plyr.sheet:getHeight())
local warp = anim8.newGrid(36, 300, beam:getWidth(),
@NimbusBP1729
NimbusBP1729 / weaponParentChild.lua
Created October 17, 2012 20:26
weapon parent/child hierarchy
--This is the only method in my weapon file that is referenced without a semicolon
-- Creates a new weapon object
-- @return the weapon object created
function Weapon.addWeaponMethods(myWeapon)
for k,v in pairs(Weapon) do
if not myWeapon[k] then
myWeapon[k] = v
end
end