I'm getting a wierd error.

I'm getting a [object Arguments]is not a valid color representation. error when trying to run this code:

function setup() {
createCanvas(640, 480);
background(51);
}
var Noclip = false;
var X = 40
var Y = 40
function draw() {
drawmap(1,false);
}


function NoClip() {
switch(Noclip) {
    case true:
        Noclip = false
document.getElementById("NoClipState").innerHTML = "NoClip Disabled";
        break;
    case false:
        Noclip = true
document.getElementById("NoClipState").innerHTML = "NoClip Enabled";
        break;
} 
}

function drawmap(N,S) {
fill(50);
if (this.N = 1) {
if (this.S = false){
noStroke();
rect(X,Y,40,40);
} else {
stroke();
rect(X,Y,40,40);
}
}
}

If anyone can explain what is happening I would greatly appreciate it.

(P.S. it isn't the background cause the canvas color is being set to 51) (This is using the p5.js library)

Answers

Sign In or Register to comment.