ARTICLE AD BOX
My goal is to make a skill tree that shows 1 section at a time and if you click one it goes to the next branch.
I do not know how to use it, though.
Here is my code:
//var[ var branchLocation = function() { this.x=0; this.y=0; this.rad=0; this.diam=0; this.r1=0; this.g1=0; this.b1=0; this.r2=0; this.g2=0; this.b2=0; }; var textWidthValue; var circleDiameter; var circleRadius; var circleX; var circleY; //] function branch(text1, x1, y1,r1,g1,b1,r2,g2,b2) { //vars[ var textWidthValue = textWidth(text1); var circleDiameter = max(50, textWidthValue + 40); var circleRadius = circleDiameter / 2; var circleX = x1; var circleY = (3 / 5) * height - circleRadius; branchLocation.push(branchLocation.x=x1); branchLocation.push(branchLocation.y=y1); branchLocation.push(branchLocation.diam=circleDiameter); branchLocation.push(branchLocation.rad=circleRadius); branchLocation.push(branchLocation.r1=r1); branchLocation.push(branchLocation.g1=g1); branchLocation.push(branchLocation.b1=b1); branchLocation.push(branchLocation.r2=r2); branchLocation.push(branchLocation.g2=g2); branchLocation.push(branchLocation.b2=b2); //] line(x1, y1, x1, circleY); fill(r1, g1, b1); ellipse(circleX, circleY, circleDiameter, circleDiameter); fill(r2, g2, b2); textAlign(CENTER, CENTER); text(text1, circleX, circleY); }//to use bob put the text,rgb code of the circle, and rgb code of the text fill(201, 50, 198); // doesn't do anything. it is for rgb codes for calls of branch branch("wild horses are beautiful", 184, 659,201, 50, 198,0); branch("", 455, 630,18, 13, 179); mouseClicked = function() { if (mouseX>x-branchLocation.rad()){}// here is my error };My error is:
Did you mean to type red instead of rad? In case you forgot, you can use it like red(color) | ProcessingJS
