Return 2 Values out of a function into a Class
in
Programming Questions
•
6 months ago
Ok basically i have 3 colours for RGB and i want to get the value of each colour to be counted up and down again in a loop
so that's my code so far without the setup part and so
Thank you
Hannes
so that's my code so far without the setup part and so
- public class colour{
int CountingDirection;
int Colour;
}
colour Red = new colour(0,1);
colour Green = new colour(50,1);
colour Blue = new colour(100,1);
void draw() {
Red.Colour = count(Red.CountingDirection, Red.Colour);
Green.Colour= count(Green.CountingDirection, Green.Colour);
Blue.Colour= count(Blue.CountingDirection, Blue.Colour);
}
int count( int Direction, int Colour) {
if (Direction==1)Colour++;
else Colour--;
if (Colour==255)Direction=0;
if (Colour==0)Direction=1;
return Colour;
return Direction;
}
Thank you
Hannes
1