I am trying to implement color detection within my code. I am planning to have a pair of red gloves, and a pair of blue gloves that I would like to be detected. The main objective of my code is to create a 'square' when a collision happens with the red/blue gloves.
If someone can give me a simple example that would be great, and this will be a live video feed.
Hey Guys,
So I've been working on creating a drawing tool and I have it all laid out. However I am having trouble creating a mousePressed button to change the drawing tool. For example
I have 4 buttons that are suppose to do different things
button1- regular line tool
button 2- change colors depending where the mouse is on the screen
button 3- mousepressed ellipse tool
button 4- mousepressed square tool.
Here is my code for you =]
//******CANVAS******//
int xMin = 15; // position-left
int xMax = 450; // position of the canvas from-right
int yMin = 50; // position-top
int yMax = 420; // position-bottom
Basically I've been playing around with the //*******FIRST SQUARE BUTTON******// just to combine the mousepress and buttonPressed. I also need to put a constrain in to stay within the parameters of the canvas. I figured once I figure out how to connect the first button, than I can play with the other three. If someone can help me that will be great. I have so much code that it's confusing me. I know what I want to say but I don't know how.
Thanks in advance, if someone can stir me in the right direction for my first button.
I am trying to make my creature have multiple arms, but every time I run it I keep getting an error that says "maybe missing right parenthesis?" I tried to fix it, and even rewrote my code. If anyone can take a look at my code and quickly point out my error that would be great! The problem is happening in void draw window. ==>
if ((x > width)i(x < 0)){
Thanks again!!
int x=100;
int y=100;
int w=60;
int h=60;
int eyeSize=16;
int pupil=8;
int speed=1;
void setup() {
size (400, 400);
smooth ();
}
void draw () {
x=x+speed;
if ((x > width)i(x < 0)){
speed = speed *-1;
}
background (255); // white background
ellipseMode (CENTER);
rectMode (CENTER);
for (int i = y+5; i<y+h;i+=10);
{
stroke(0);
line(x-w/3, i, x+w/3, i);
}
fill (239, 255, 20); //yellow body
ellipse(x, y, w/6, h*2); // HEAD
fill(255); // white
ellipse (x-w/3, y-h/2, eyeSize, eyeSize); // left eye
fill (255); //white
ellipse (x+3, w/3, y-h/2, eyeSize, eyeSize); // right eye
line (x-w/12, y+h, x-w/4, y+h+10); // left arm
line (x+w/12, y+h, x-w/4, y+h+10); // right arm
fill(0); //black
ellipse (x-w/2, y-h/1, pupil, pupil); // left pupil
fill (0); //black
ellipse ( x+w/2, y-h/1, pupil, pupil); // right pupil
So I just started a processing class, and I really do not understand it. I got the basics, but the more command keys I learn and the less explaining my teacher does, the more confused I am. But if someone can help me move my character in an animation that would be great. Here is the code.
void setup() {
size (400,400);
smooth ();
frameRate (30);
}
void draw (){
background (255);
ellipseMode (CENTER);
rectMode (CENTER);
stroke (0);
fill (239,255,20); //yellow body
ellipse(mouseX,mouseY,100,150); // HEAD
stroke (0);
fill(255); // white
ellipse (mouseX-20,mouseY-30,30,40); // left eye
stroke (0);
fill (255); //white
ellipse (mouseX+20,mouseY-30,30,40); // right eye
stroke(0);
line (mouseX-50,mouseY,pmouseX-70,pmouseY-20); // left arm
stroke (0);
line (mouseX+50, mouseY, pmouseX+65,pmouseY-20); // right arm
stroke (0);
fill(mouseX,0,mouseY); //black
ellipse (mouseX-20,mouseY-30,5,15); // left pupil
stroke(0);
fill (mouseX,0,mouseY); //black
ellipse (mouseX+20,mouseY-30,5,15); // right pupil
stroke(0);
fill (142,255,228);// blue
ellipse (mouseX,mouseY+40,75,70); // belly
stroke(0);
line (mouseX-20,mouseY-3,pmouseX+20,pmouseY-3); // mouth
fill (255,36,102);
stroke (252,13,33);
line (mouseX-60,mouseY-60,pmouseX+60,pmouseY-60); // flat line for hat
rect(mouseX-1,mouseY-76,65,30); // hat
}
He moves with the mouse, and now I am trying to just get him to move verticle up the page, bottom to top. I changes the information between the () for each variable but that isn't working. Just making it a huge mess.Please write back to me and explain in detail.