Skip to content

Instantly share code, notes, and snippets.

View roaminggamer's full-sized avatar

Roaming Gamer, LLC. roaminggamer

View GitHub Profile
@roaminggamer
roaminggamer / NeuralNetwork.lua
Created November 19, 2018 22:21 — forked from cassiozen/NeuralNetwork.lua
Lua Neural Network
ACTIVATION_RESPONSE = 1
NeuralNetwork = {
transfer = function( x) return 1 / (1 + math.exp(-x / ACTIVATION_RESPONSE)) end --This is the Transfer function (in this case a sigmoid)
}
@roaminggamer
roaminggamer / catmull.lua
Created August 2, 2018 16:44 — forked from HoraceBury/catmull.lua
Takes a table of x,y points and returns a smooth catmull-rom spline table of x,y points.
-- catmull-rom-spline library
-- Resources:
-- https://gist.github.com/1383576
-- http://codeplea.com/simple-interpolation
-- http://codeplea.com/introduction-to-splines
require("tablelib") -- https://gist.github.com/HoraceBury/9307117
require("mathlib") -- https://gist.github.com/HoraceBury/9431861
@roaminggamer
roaminggamer / TwineiOS
Created July 29, 2018 19:37 — forked from KalleMacD/TwineiOS
How to make a Twine game into an iOS web-app
//This quick guide will show you how add an optional web-app (iOS) view to your Twine game!
//First you'll need to open up your Twine (.tws) file.
1. Add a new passage to your story and name it "script"
2. Enter the tags section and add the word "script"
3. Now, in the main body, add the code:
document.addEventListener('touchmove', function(e) {
e.preventDefault();
}, false);
--[[
Perspective v2.0.2
A library for easily and smoothly integrating a virtual camera into your game.
Based on modified version of the Dusk camera system.
v2.0.2 adds a more stable tracking system and re-implements scrollX and scrollY
--]]
-- polygon concave test
require("mathlib")
stage = display.getCurrentStage()
local text = display.newText{ text="- - -", x=display.contentCenterX, y=100, fontSize=24 }
lines = display.newGroup()
lines:insert(display.newGroup())
-- swipe library
--[[ Libraries ]]--
local composer = require("composer")
--[[ Fields ]]--
local mainstage = display.getCurrentStage()
local stage = composer.stage
-- debug console
local widget = require("widget")
local lib = {}
local originalPrintFunc = print
local debugPrintFunc = nil
local showingDebugConsole = false
local sm = require("statemachine")
local process = sm.new(function(self, time)
local txt = display.newText( "Press Me", display.contentCenterX, display.contentCenterY, native.systemFont, 32)
txt:addEventListener("touch", function(evt)
self:continue()
end)
self:waiting()
txt.text = "Hello!"
end)
local sm = require("statemachine")
local process = sm.new(function(self, time)
self:sleep(100)
print("hello")
self:sleep(100)
print("hehe...")
self:sleep(100)
print("end")
end)
--[[
statemachine.lua
Copyright (c) 2013 Erin Lin
erinylin.blogspot.com
Licensed under the MIT license.
Usage:
local sm = require("statemachine")
local process = sm.new(function(self, time)