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 / 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 / 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 / screenres.swift
Created July 21, 2016 20:38
Change your Mac's screen resolution from the command line.
#!/usr/bin/swift
import Foundation
var shouldPrintUsage = true
var shouldPrintModes = true
var shouldSwitchMode = false
var didSwitchMode = false
var desiredDisplayNumber: Int? = nil
var desiredWidth: Int? = nil
@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 / Standard-DoubleSided.shader
Created June 1, 2017 16:30
Unity Standard-DoubleSided.shader
Shader "Standard-DoubleSided"
{
Properties
{
_Color("Color", Color) = (1,1,1,1)
_MainTex("Albedo", 2D) = "white" {}
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
_Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
@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;
@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....