/* built with Studio Sketchpad: * https://sketchpad.cc * * observe the evolution of this sketch: * https://studio.sketchpad.cc/sp/pad/view/ro.aKiEp3CGiHc/rev.16 * * authors: * Natalia Valencia * license (unless otherwise specified): * creative commons attribution-share alike 3.0 license. * https://creativecommons.org/licenses/by-sa/3.0/ */ /* @pjs preload="/static/uploaded_resources/p.14209/pollos.png"; */ PImage p; POLLOS pollitos; void setup() { size (800,800); background (255); p = loadImage("/static/uploaded_resources/p.14209/pollos.png"); pollitos = new POLLOS(); } void draw() { background (255,10); image(p,0,0,800,800); pollitos.escribir(); pollitos.mover(); } class POLLOS { int posx; int posy; String mensajeVisible; String [] mensaje; int numeroVisible; PFont f; PImage p; POLLOS() { mensaje= loadStrings("/static/uploaded_resources/p.14209/pollos.txt"); posy= height; f = loadFont("Chalkboard-70.vlw"); numeroVisible = 0; mensajeVisible= mensaje[numeroVisible]; } void escribir() { textAlign (LEFT); textFont(f,68); fill(0,200); text(mensajeVisible,posx,posy); } void mover() { posy = posy -4; if (posy < 0) { posy = height; numeroVisible = numeroVisible +1; if(numeroVisible== mensaje.length) { numeroVisible = 0; } mensajeVisible= mensaje[numeroVisible]; } } }