//Tami Evnin float posX = 0; float posY = 0; int speedX=2; int speedY=3; boolean directionX = true; boolean directionY = true; boolean bounce = true; int [] pressCount = new int [100]; void setup() { size(800,600); smooth(); fill(255,255,255,200); } void draw() { background(100,100,100); ellipse(posX,posY,50,50); //move ball if(bounce==true){ bounceBall(); } } void bounceBall(){ //*****X MOVEMENT*****// if(directionX==true){ posX+=speedX; }else{ posX-=speedX; } //bounce from right if(posX>=width-25){ directionX=false; } //bounce from left if(posX<=25){ directionX=true; } //*****Y MOVEMENT*****// if(directionY==true){ posY+=speedY; }else{ posY-=speedY; } //bounce from bottom if(posY>=height-25){ directionY=false; } //bounce from top if(posY<=25){ directionY=true; } } void mousePressed(){ bounce=!bounce; for(int i=0; i<100; i++){ if(mousePressed){ pressCount[i]++; } if(pressCount[i]>=6){ speedX=5; speedY=7; fill(0,255,0,150); } } }