Diferencia entre revisiones de «Archivo:Bounceball.gif»

De Casiopea
(PVector location; // Location of shape PVector velocity; // Velocity of shape PVector gravity; // Gravity acts at the shape's acceleration void setup() { size(640,360); location = new PVector(100,100); velocity = new PVector(1.8,2.8); gra…)
 
 
Línea 1: Línea 1:
== Resumen ==
PVector location;  // Location of shape
PVector velocity;  // Velocity of shape
PVector gravity;  // Gravity acts at the shape's acceleration





Revisión actual - 02:39 21 may 2019


void setup() {

 size(640,360);
 location = new PVector(100,100);
 velocity = new PVector(1.8,2.8);
 gravity = new PVector(0,0.8);

}

void draw() {

 background(0);
 
 // vector de velocidad 
 location.add(velocity);
 // vector de gravedad (fuerza)
 velocity.add(gravity);
 
 
 if ((location.x > width) || (location.x < 0)) {
   velocity.x = velocity.x * -1;
 }
 if (location.y > height) {
   // velocidad reducida al golpear la esquina inferior.
   velocity.y = velocity.y * -0.95; 
   location.y = height;
 }
 // variantes de la pelota
 stroke(255);
 strokeWeight(8);
 fill(17);
 ellipse(location.x,location.y,48,48);

}

Historial del archivo

Haz clic sobre una fecha y hora para ver el archivo tal como apareció en ese momento.

Fecha y horaMiniaturaDimensionesUsuarioComentario
actual02:38 21 may 2019Miniatura de la versión del 02:38 21 may 2019641 × 371 (3 kB)Gonzalogallo (discusión | contribs.)PVector location; // Location of shape PVector velocity; // Velocity of shape PVector gravity; // Gravity acts at the shape's acceleration void setup() { size(640,360); location = new PVector(100,100); velocity = new PVector(1.8,2.8); gra…

La siguiente página usa este archivo: