Skip to content

Instantly share code, notes, and snippets.

@darkwave
darkwave / SimpleMenu.pde
Created September 29, 2013 09:47
Simple menu for IndieSpeedRun 2013 entry by SpaghettiCoder
final int GAME_INIT = -1;
final int GAME_MENU = 0;
final int GAME_RUNNING = 1;
final int GAME_WIN = 2;
final int GAME_LOOSE = 3;
int gameState = GAME_INIT;
int gameLoadedTime;
PImage splashScreen, startMenu, youWin, youLoose;
@darkwave
darkwave / Element.pde
Created September 27, 2013 22:54
WIP for the Indie Speed Run 2013
class Element {
Body body;
float w, h;
String spriteFilename;
BodyType bodyType;
Element(float x, float y, float w, float h, String _spriteFilename, boolean obstacle) {
if (obstacle)
bodyType = BodyType.STATIC;
@darkwave
darkwave / Box.pde
Created September 26, 2013 20:40
A simple top-view car movement and collisions using Box2D. You need PBox2D by Daniel Shieffman in order to run this application. You'll need also 3 images for the sprites.
// A rectangular box
class Box {
// Instead of any of the usual variables, we will store a reference to a Box2D Body
Body body;
float w,h;
Box(float x, float y) {
this(x, y, 64, 64, false);
}
@darkwave
darkwave / ThreeJSLoader.pde
Last active December 23, 2015 14:38
Unfinished Three.js JSON Model format 3.1 loader for Processing.
class ThreeJSLoader {
PApplet parent;
ThreeJSLoader(PApplet _parent) {
parent = _parent;
}
boolean isBitSet(int value, int position ) {
@darkwave
darkwave / Buffer.pde
Created February 16, 2013 13:45
A modified version of the Buffer class suggested by chicoatomico to recreate the Picking library for Processing 2.0
import java.nio.IntBuffer;
import java.nio.ByteOrder;
public class Buffer extends PGraphics3D
{
protected int current_color = 0;
public Buffer(PApplet parent)
{
setParent(parent);