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 & HelpSyntax Questions › What is missing Extreme Novice
Page Index Toggle Pages: 1
What is missing? Extreme Novice (Read 449 times)
What is missing? Extreme Novice
Sep 28th, 2007, 4:15am
 
What im basically wanting to do is when Key "A" is pressed a object will appear at random within stage parameters.

I have been trying with....

void keyPressed()
{
 if (key=='a') {
   jfs = push_jelly ( jfs, new jellyFish ( random(0,width), ( random(0,height))));
 }

processing reply = "Perhaps you wanted the overloaded version "jellyFish(int _x, int _y, Temporary_7536_753$jellyColor _jc);" instead?"

Suggestions anyone?
what have i missed or done wrong?
Any relevant code examples?
Re: What is missing? Extreme Novice
Reply #1 - Sep 28th, 2007, 5:53am
 
I think it's because random returns a float and your jellyFish function wants ints

try
Code:
jellyFish (int(random(width)), int(random(height)));

Page Index Toggle Pages: 1