We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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
NVM I don't know how to delete comments (If possible), but I realized that
stroke()
needs a color in the ().Near error! No need to delete your comments - people who encounter this error in the future can search for it and, after finding this discussion, know what the problem is! :-bd
see
https://www.processing.org/reference/stroke_.html