Skip to content

Instantly share code, notes, and snippets.

View Radnen's full-sized avatar

Andrew Helenius Radnen

View GitHub Profile
/**
* Script: actor.js
* Written by: Radnen
* Updated: 5/10/2012
**/
function Actor(name)
{
this.name = name;
this.dx = 0;
@Radnen
Radnen / actor.js
Created April 28, 2015 06:02
A simple OO wraper for Sphere entities.
function Actor(name)
{
this.name = name;
this.dx = 0;
this.dy = 0;
}
Actor.prototype = {
get angle() { return GetPersonAngle(this.name); },
set angle(val) { SetPersonAngle(this.name, val); },
@Radnen
Radnen / update.bat
Created September 11, 2014 18:14
Git batchscript folder updater
:: update.bat
::---------------------------------------------------------
:: A batch script that updates all git repos in a directory
:: By: Andrew Helenius - September 11th, 2014
::---------------------------------------------------------
::
:: In order to work git must be in your PATH
::
:: Caveats:
::
@Radnen
Radnen / query.js
Last active December 31, 2015 21:39
query.js is for your Sphere game. Use it to zip through arrays of data in little time with little effort. Useful for battle systems, person management, and menus.
/**
* Script: query.js
* Written by: Radnen
* Updated: 12/28/2013
**/
var Query = {
results: [],
/*
@Radnen
Radnen / personlist.js
Created August 30, 2013 05:00
A fix for Sphere games that crash when using GetPersonList.
var _GPL = GetPersonList;
GetPersonList = function() {
if (GetPersonList.updated) {
GetPersonList.list = _GPL();
GetPersonList.updated = false;
}
return GetPersonList.list;
}
GetPersonList.updated = true;
@Radnen
Radnen / analogue.js
Last active December 19, 2015 02:19
analogue.js - a lightweight persist-like library that is compatible with persist for Sphere's map engine. It redefines the way you interact with map entities - by having a direct code analogue for their on-screen counterparts: what goes in the code, goes in the game.
/**
* Script: analogue.js
* Written by: Radnen
* Updated: 6/28/2013
**/
/*
A lightweight alternative, and fully-compatible version
of tung's persist code.
@Radnen
Radnen / sphere_random.js
Last active December 17, 2015 23:29
A seed based random number generator for your JS application. (Made for the Sphere Game Engine).
function Random(seed) {
const MAX = 2147483647;
const MULT = 48271;
const Q = Math.floor(MAX / MULT);
const R = Math.floor(MAX % MULT);
this.seed = seed || Date.now();
this.next = function() {
var t = MULT * (this.seed % Q) - R * (this.seed / Q);
@Radnen
Radnen / binarytree.js
Last active December 16, 2015 08:39
An implementation of an A* pathfinding algorithm in JavaScript for Sphere.
/**
* Script: BinaryTree.js
* Written by: Radnen
* Updated: 10/27/2011
**/
function TreeNode(object)
{
this.data = object;
this.left = null;