McLeopold / perlin

Perlin and Simplex noise tool
1 stars 0 forks source link

Uncaught TypeError: Object 2012-08-14T00:00:00.000Z has no method 'shortdatetime' #1

Closed a1k0n closed 12 years ago

a1k0n commented 12 years ago

seems stash.js isn't stashing shortdatetime into the Date object early enough?

anyways, cool project! I was just thinking of doing the same thing, expanding my little world game with perlin noise-based biomes and 3D soil and mining and so forth.

a1k0n commented 12 years ago

Oh, it's just not a date object. Here:

diff --git a/stash.js b/stash.js
index f38c62d..5a9bbae 100644
--- a/stash.js
+++ b/stash.js
@@ -65,7 +65,7 @@ Stash.prototype.del_rev = function (name, rev) {
 Stash.prototype.load = function () {
   this.files = JSON.parse(localStorage.getItem(this.key));
   if (this.files === null || typeof this.files !== 'object') {
-       this.files = { basic: [ { date: "2012-08-14T00:00:00.000Z",
+    this.files = { basic: [ { date: new Date("2012-08-14T00:00:00.000Z"),
                               data: "r = g = b = (noise(x / 100, y / 100, 0) + 1) * 128;" }
                           ]
                  };

also you have whitespace issues w/ mixed tabs/spaces

McLeopold commented 12 years ago

Thx, nice to see you're interested in this. Right now this is all just a hack. I've got simplex noise in there as well. I want to make it so that you can share interesting maps with others via a nodejs web server, maybe running on heroku.

It would also be fun to allow for the alpha channel to be modified and layer a few different maps together.