Referring to variables in Classes
in
Contributed Library Questions
•
2 years ago
Hey everyone,
Thank you so much in advance!
I'm working on a interactive project but i'm having some difficulties making it interactive...
The program I have is randomly moving circles that connect to each other with a line() if they come within a range of "distance" to each other. The "distance" variable is one i get from Pure Data's "peakamp" function.
Basically, processing just gets values from one sound input (computer mic) in pure data.
I got Processing and PD communicating perfectly.
The program has this structure:
1. a general structure with the void setup() and void draw() functions, aswell as a void that receives the sound input values PD sends in.
2. a ball class, where i define the properties of the balls
3. a world class, where i define the collection of randomly moving balls. It's this part that controls the connection of the balls.
Now the question:
I want to refer in my "world"-class part of the program to the variable "distance" that is in the void section in the general structure. How can I do this??
I know you can refer to another class its variables by using the "class.variable" command, but not sure how to use the "distance" variable i need, as its not in a class...
All help greatttttly appreciated as it's kind of urgent.
Thank you so much in advance!
w
1