Why Doesn't This Work On Playground?
<!doctype html> <html> <head> <title>Game</title> <script> window.onload = function() { window.focus(); var blob; var blobs = []; var numBlobs = 500; var bigBlobRadius = 26; var babyBlobRadius = 10; function setup() { // Create a canvas the same size as the window createCanvas(windowWidth, windowHeight); // Create a new blob... this is the main player blob blob = new Blob(width / 2, height / 2, bigBlobRadius); // Create numBlobs blobs for (var i = 0; i < numBlobs; i++) { // Create blobs at random locations within height*3 and width*3 var posX = random(random(-width, width * 4), Math.floor(random(width))); var posY = random(random(-height, height * 4), Math.floor(random(height))); // Add new blob to the array to later be show()'d blobs[i] = new Blob(posX, posY, babyBlobRadius); } } function windowResized() { // Fix the canvas size if the window is resized resizeCanvas(windowWidth, windowHeight); } function draw() { // Make a black background background(0); // Move the origin (0,0) of the window with the blob translate(width / 2 - blob.pos.x, height / 2 - blob.pos.y); // Show & update the big blob blob.show(); blob.update(); // Show all of the baby blobs & check if eaten for (var i = blobs.length - 1; i >= 0; i--) { blobs[i].show(); // Check if we're eating something if (blob.eats(blobs[i])) { blobs.splice(i, 1); // Remove the eat-ee } } } function Blob(x, y, r) { this.id = guid(); this._r = r; this.colour = randomColour(this.id); // Assign a position and radius this.pos = createVector(x, y); this.r = r; this.update = function() { // Displ