class Pelotita{ //datos y variables color c; float xpos; float ypos; float tamanio; float velocidad; float incremento; //constructor Pelotita (color unColor, float unaPosX, float unaPosY, float unTamanio){ c = unColor; xpos = unaPosX; ypos= unaPosY; tamanio = unTamanio; velocidad = 1; //el incremento no tiene por que estar como parametro del constructor incremento = 0; } //metodos void draw(){ ellipseMode(CENTER); fill(c); noStroke(); ellipse(xpos,ypos,tamanio, tamanio); //println(xpos); } void mover(){ ypos = ypos+ velocidad ; xpos = xpos +velocidad; incremento = incremento+2; if(ypos > height +tamanio){ incremento = 100; ypos = -ypos -tamanio; if(xpos > width +tamanio){ incremento = 1; xpos = -xpos -tamanio; } } } }