void setup()
{
size(300,300);
frameRate(27);
}
void draw()
{
background(255);
int posX = mouseX;
int posY = mouseY;
int countBalloon = 0;
int unitBalloon = 3;
int range = 1;
if(mouseButton == LEFT)
{
while(countBalloon < unitBalloon)
{
posX = countBalloon*75+50;
draw_ballon(posX ,posY ,75);
countBalloon++;
}
}
if(mouseButton == RIGHT)
{
while(countBalloon < unitBalloon)
{
int moveY = frameCount;
posX = (countBalloon*75)+50;
posY = mouseY+(-moveY);
if(posY < 0)
{
posY = 0;
}
draw_ballon(posX ,posY ,75);
countBalloon++;
}
}
}
void draw_ballon(int posX ,int posY ,int radius )
{
fill(#FC0000);
line(posX,posY,posX,100+posY);
ellipse(posX,posY,radius,radius);
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น