class Car{ //datos y variables color c; float xpos; float ypos; float xvel; int ancho = 20; int largo = 10; //constructor Car (color unColor, float unaPosX, float unaPosY, float unaVelocidad){ c= unColor; xpos = unaPosX; ypos = unaPosY; xvel = unaVelocidad; } //metodos void draw(){ rectMode(CENTER); fill(c); noStroke(); rect(xpos,ypos,ancho,largo); } void drive(){ xpos = xpos + xvel; outputCell(floor(map(xpos,0,width,21,108))); if(xpos>width +20){ xpos = -20; outputCell2(floor(map(xpos,0,width,21,108))); } } }