martes, 8 de noviembre de 2011

Fail!

audio , imagen , movimiento.


float speed= 2.5;
int diameter= 20;
float x;
float y;
PImage kathy;
import ddf.minim.*;

AudioPlayer player;
Minim minim;

void setup() {
size(700,550);
smooth();
fill(136, 227, 101);

x= width/2;
y= height/2;
minim = new Minim(this);
player = minim.loadFile("blue.mp3", 1024);
player.play();

}

void draw() {
kathy = loadImage ("kathy.jpg");
image (kathy, 0, 0);
x+= random (-speed, speed);
y+= random (-speed, speed);

image (kathy, x, y, 60, 60);

}

void stop()
{
player.close();
minim.stop();

super.stop();
}


imagen movimiento.


PImage estrella;
PImage cielo;
int size = 60;
float xpos, ypos;
float xspeed = 2.0;
float yspeed = 2.0;
int xdirection = 1;
int ydirection = 1;
void setup()
{
size(500,400);
noStroke();
frameRate(50);
smooth();
xpos = width/20;
ypos = height/8;
cielo = loadImage ("cielo.jpg");
estrella = loadImage ("estrella.gif");
}
void draw()
{
background(cielo);
xpos = xpos + ( xspeed * xdirection );
ypos = ypos + ( yspeed * ydirection );
if (xpos > width-size || xpos < 0) {
xdirection *= -1;
}
if (ypos > height-size || ypos < 0) {
ydirection *= -1;
}
image (estrella,xpos+size/2, ypos+size/2);
}


No hay comentarios:

Publicar un comentario