Remember to hit ctrl-t in processing to get auto-format
Remark 1
popped is actually similar to isAlive.
Are they the same?
I mean do they serve the same functions? Then you should unify them and get rid of one.
Remark 2
You only have 2 balloons at the moment. You could restart a balloon that is at the top.
In the if-clause in the function top()
:
x=random(width-diameter);
y=height+diameter+random(30);
isAlive=true;
popped=false;
diameter=random(18,62);
Remark 3
Here is a similar thing with many balloons. Instead of restarting them they are managed in an ArrayList
and added and removed from it.
Regards, Chrisir