r/processing • u/ali121906 • Jul 21 '22
Some quick questions
So I have this code and I want the circles to drop at different times but at the same speed, I want the circles to loop back to the top after they disappear from the bottom, and I also want to know how to change the speed of the circles... I know that's quite a bit but any sort of help is appreciated :)


0
Upvotes
3
u/Storyxx Jul 21 '22
Your Code in
abalready looks very solid! The only thing to say there is that you could take a look atArrayLists. They are far more powerful than arrays.For the different falling times you could use a
delayvariable that tells the ball when to start their "decend, display, bottom"-cycle. To achive this the variable can be compared againstframeCountin yourabfile.You almost already have the code for looping back around. But you are testing for 25 and positioning it back to 25 in that case. With the help of the global variables
widthandheightyou are able to test against the window size and then move the ball back to y-position 0.The speed is also very simple. Instead of incrementing
yposin line 11 inBallyou can add a speed value to it, like this:ypos += speed;Hope that helped :)