i am trying to get a code that will let the line scroll through and change the color. i would like to get it to filter through several colors and so far I have a basic code picked out, I can get it to draw in a new color but is there a way to tell it that since it's now teal, it has to draw red, etc.
float a = 100;
void setup()
{
size(500, 500);
background(255);
}
void draw()
{
stroke(95, 158, 160);
a = a - 0.5;
if (a < 0) {
a = height;
}
line(0, a, width, a);
This is what I have so far and I am having trouble making the bars rely on w/s and up/down arrows
// Global variables for the ball
float ball_x;
float ball_y;
float ball_dir = 1;
float ball_size = 15; // Radius
float dy = 0; // Direction
float heeto = 0;
// Global variables for the paddle
int paddle_width = 10;
int paddle_height = 60;
int again_width = 10;
int again_height = 60;
int dist_wall = 15;
// Test to see if the ball is touching the paddle
float py = width-dist_wall-paddle_width-ball_size;
if(ball_x == py
&& ball_y > paddle_y - paddle_height - ball_size
&& ball_y < paddle_y + paddle_height + ball_size) {
ball_dir *= -1;
if(mouseY != pmouseY) {
dy = (mouseY-pmouseY)/2.0;
if(dy > 5) { dy = 5; }
if(dy < -5) { dy = -5; }
}
}
float p2 = dist_wall+again_width+ball_size;
if(ball_x == p2
&& ball_y > paddle_2 - again_height - ball_size
&& ball_y < paddle_2 + again_height + ball_size) {
ball_dir *= -1;
if(mouseX != pmouseX) {
dy = (mouseX-pmouseX)/2.0;
if(dy > 5) { dy = 5; }
if(dy < -5) { dy = -5; }
}
}
// If ball hits paddle or back wall, reverse direction
if(ball_x < ball_size && ball_dir == -1) {
}
// If the ball is touching top or bottom edge, reverse direction
if(ball_y > height-ball_size) {
dy = dy * -1;
}
if(ball_y < ball_size) {
dy = dy * -1;
}