|
BFont test2;
float i,j,x,y,z,a,k;
float x_direction;
float y_direction;
float z_direction;
int a_direction;
int k_direction;
float x_speed;
float y_speed;
float z_speed;
float a_speed;
float k_speed;
float mouse_speed;
void setup(){
size(300,300);
test2 =loadFont("arial_black.vlw");
x=100;
y=100;
z=100;
a=100;
k=100;
x_direction=1;
y_direction=1;
z_direction=1;
a_direction=1;
k_direction=1;
x_speed=0.7;
y_speed=1.0;
z_speed=1.3;
a_speed=0.5;
k_speed=1.2;
}
void loop(){
DrawObject1();
}
//object1 ------------------------
void DrawObject1(){
mouse_speed=mouseX/50;
x=x+x_direction*x_speed*mouse_speed;
y=y+y_direction*y_speed*mouse_speed;
z=z+z_direction*z_speed*mouse_speed;
a=a+a_direction*a_speed*mouse_speed;
k=k+k_direction*k_speed*mouse_speed;
background(255);
//background
for(int i=0; i<300 ; i=i+10){
for(int j=0; j<300 ; j=j+10){
stroke(0,i-mouseX+200,j-mouseY+200);
fill(0,i-mouseX+200,j-mouseY+200);
rect(j,i,10,10);
}
}
//move L
fill(255,0,0);
textFont(test2,mouseX/5);
text("L",x,y);
stroke(255,0,0);
line(x+8,y+8,150,150);
println(x);
//moveE
if(mousePressed){
fill(255,0,0);
textFont(test2,mouseX/5);
text("E",mouseX,mouseY);
stroke(0,0,255);
line(mouseX,mouseY,150,150);
}else{
fill(255,0,0);
textFont(test2,mouseX/5);
text("E",y,z);
stroke(0,0,255);
line(y+8,z+8,150,150);
}
//moveO
fill(255,0,0);
textFont(test2,mouseX/5);
text("O",z,a);
println(x);
stroke(255,255,0);
line(z+8,a+8,150,150);
//moveV
fill(255,0,0);
textFont(test2,mouseX/5);
text("V",a,k);
println(x);
stroke(0,255,0);
line(a+8,k+8,150,150);
//center_square
fill(255,0,0);
rect(120,120,30,30);
fill(30,255,30);
rect(120,150,30,30);
fill(255,255,0);
rect(150,120,30,30);
fill(0,0,255);
rect(150,150,30,30);
//center_text
fill(0,0,0);
textFont(test2,50);
text("L",120,150);
textFont(test2,50);
text("O",150,150);
textFont(test2,50);
text("V",120,180);
textFont(test2,50);
text("E",150,180);
if(x>300-60 || x<0){
x_direction=x_direction*-1;
}
if(y>300-30 || y<0){
y_direction=y_direction*-1;
}
if(z>300-15 || z<0){
z_direction=z_direction*-1;
}
if(a>300-15 || a<0){
a_direction=a_direction*-1;
}
if(k>300-15 || k<0){
k_direction=k_direction*-1;
}
}
|