Skip to content

Instantly share code, notes, and snippets.

@raonioliver
raonioliver / Vector.js
Last active January 11, 2018 14:23 — forked from jjgrainger/Vector.js
A simple Vector class in javascript
var Vector = function(x, y) {
this.x = x || 0;
this.y = y || 0;
};
// return the angle of the vector in radians
Vector.prototype.getDirection = function() {
return Math.atan2(this.y, this.x);
};
@raonioliver
raonioliver / random_rooms_gen.js
Created January 15, 2018 03:17
This code takes some variables and creates various rooms of random sizes and locations based on the given variables. Very useful for roguelike map generating.
/*********************************************************
COPYRIGHT RAONI OLIVEIRA 2018
Please don't use my code without mentioning me.
I can be reached at [email protected]
The following code is written in JavaScript using p5.js library.
*********************************************************/