Skip to content

Instantly share code, notes, and snippets.

@jminor
jminor / Entity.touches.test.js
Created February 10, 2011 06:04
impactjs test for Entity.touches off-by-one issue
// try with and without this next block
if (0) {
ig.Entity.prototype.touches = function( other ) {
return !(
this.pos.x >= other.pos.x + other.size.x ||
this.pos.x + this.size.x <= other.pos.x ||
this.pos.y >= other.pos.y + other.size.y ||
this.pos.y + this.size.y <= other.pos.y
);
};
@jminor
jminor / picopico_english_docs.txt
Created July 18, 2012 05:14
PicoPicoEngine English Documentation
Here is an English translation of the PicoPicoEngine's documentation.
ppgame:start()
Call ppgame:start(fn) to change the function that the engine calls to update your game.
By default, the engine will call your function called "start" but you can update this at run time based on your game logic.
For example, you might call ppgame:start(mainmenu) and then later ppgame:start(play) and then ppgame:start(gameover).
The argument you pass is a lua closure.
ppgame:platform()
# Import the modulo python library
import modulo
# Create a new Port object using the first Modulo Controller it finds.
port = modulo.Port()
# Create a Display object attached to the port
display = modulo.Display(port)
eyes=[1,1]
@jminor
jminor / VRSimpleSketch.cs
Last active June 2, 2017 05:16
Unity SteamVR Simple 3D Sketching Tool
// Instructions:
// Just attach this script to your SteamVR Controller (left or right) and then you can draw in 3D.
// After you attach it, a new GameObject called "Sketch Line" will be added as a child.
// You'll want to adjust the material and width of the line renderer to make it look nice.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class VRSimpleSketch : MonoBehaviour {
@jminor
jminor / a_star.js
Created February 15, 2011 17:49
A* path finding algorithm for impactjs game engine
// A* path finding algorithm for impactjs game engine
// adapted from http://stormhorse.com/a_star.js
// via http://46dogs.blogspot.com/2009/10/star-pathroute-finding-javascript-code.html
// impact-ified by jminor - http://pixelverse.org/
/* Example:
this.pathFinder = new PathFinder();
var start = [((this.pos.x+this.size.x/2) / tilesize).floor(), ((this.pos.y+this.size.y/2) / tilesize).floor()];
var destination = [((target.pos.x+target.size.x/2) / tilesize).floor(), ((target.pos.y+target.size.y/2) / tilesize).floor()];
@jminor
jminor / main.lua
Last active February 12, 2019 06:47
Amulet shared game. See http://www.amulet.xyz for more info.
win = am.window{title = "Touch",
clear_color = vec4(1)}
face_img = [[
........BBBBBBBBBB.................
.....BBBBBBBBBBBBBBBBBBB...........
...BBBBBBBBBBBBBBBBBBBBBBBBB.......
..BBBBBBBBBBBBBBBBBBBBBBBBBBB......
.BBBBBBBBBBBBBBBBBBBBBBBBBBBBB.....
.BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB....
@jminor
jminor / main.lua
Created February 12, 2019 08:36
Amulet.xyz Sprite Editor
-- Sprite Editor
-- Paste any sized sprite into this block to edit it.
-- After drawing, copy the text from the console.
img = [[
...cc.ccc.
.cccccccc.
.cYYcYYYc.
YYgWYYgWcY
YYYYYYYYYY
@jminor
jminor / OSC.cs
Last active December 5, 2019 08:35
OpenSoundControl for Unity
/*
OSC.cs
Open Sound Control for Unity
LICENSE:
A large portion of this code is based on Makingthings's Make Controller OSC C# implementation:
https://web.archive.org/web/20121021044334/http://www.makingthings.com:80/ref/firmware/html/group___o_s_c.html
@jminor
jminor / OSCSyncedObject.cs
Last active December 5, 2019 08:40
Unity Synced Object, via OSC
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
public class OSCSyncedObject : MonoBehaviour {
public OSC osc;
public string address = "/example/obj1";
public bool forceSend;
// This adds a simple text area for you to add comments
// to your GameObjects in the Unity inspector.
// Comments are saved with your scene, just like any other
// component on a GameObject.
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif