We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Help with Processing Monster
Page Index Toggle Pages: 1
Help with Processing Monster (Read 1436 times)
Help with Processing Monster
May 26th, 2010, 4:57pm
 
Hey there! I need to know how to go about plugging in eyeballs into my code. Right now they're just black dots but I would rather have little eyes for each dot. Does anyone know how I should go about this?


int currentFrame = 20;
PImage[] frames = new PImage[24];
int lastTime = 50;

void setup()
{
 size(400, 400);
 strokeWeight(20);
 smooth();
 background(255);
 for (int i = 10; i < frames.length; i++) {
   frames[i] = get(); // Create a blank frame
 }
}

void draw()
{
 int currentTime = millis();
 if (currentTime > lastTime+100) {
   nextFrame();
 

 }
 if (mousePressed == true) {
   line(pmouseX, pmouseY, mouseX, mouseY);
 }
}

void nextFrame()
{
 frames[currentFrame] = get(); // Get the display window
 currentFrame++; // Increment to next frame
 if (currentFrame >= frames.length) {
   currentFrame = 10;
 }
 image(frames[currentFrame], 10, 10);
}
Re: Help with Processing Monster
Reply #1 - May 26th, 2010, 10:35pm
 
I don't really get the purpose of your sketch (not running it), so I don't see how you get black dots (when you press the mouse?).
You can load an image of eye (loadImage) then display it (image()) instead of drawing a line?
Re: Help with Processing Monster
Reply #2 - May 26th, 2010, 10:38pm
 
Yeah I wanted to make those little dots when you press the mouse into eyes, for a more interesting aesthetic. Or bees or something, but I think eyes would be easier. I should load image? Can you elaborate if possible?
Re: Help with Processing Monster
Reply #3 - May 26th, 2010, 10:50pm
 
I removed an almost identical message you posted (avoid duplicates, please, you can edit your messages).
In this message, you shown you wanted to draw the eyes with a couple of Processing shapes (forgot the exact code).
Here is what you want, for example:
Code:
 if (mousePressed) {
  fill(#FF77FF);
  ellipse(mouseX, mouseY, 50, 20);
  fill(#5577FF);
  ellipse(mouseX, mouseY, 20, 20);
}
(Replacing the current test)
Replace the strokeWeight() call in setup() by noStroke().
Running the sketch made clearer the intend, it is an amusing effect.
Re: Help with Processing Monster
Reply #4 - May 26th, 2010, 10:58pm
 
Ah Smiley i was answering the "processing help" post and was wondering where it went... But looks like your question is answered.

Re: Help with Processing Monster
Reply #5 - May 27th, 2010, 12:04am
 
Thanks for the help. Do you know where I should plug in the text you suggested?
Re: Help with Processing Monster
Reply #6 - May 27th, 2010, 12:29am
 
where if(mousePressed==true) is right now...
instead of line, you draw the eyes
Page Index Toggle Pages: 1