Toggle navigation
Explora
(current)
Aprende
Crea
Retos
×
Aspectos básicos
void main() {...}
for ( int i = 0 ; i < N ; i++ ) {...}
while (condición) {...}
do {...} while (condición);
if (condición) {...}
if (condición) {...} else {...}
switch (valor) {...}
Mostrar y pedir datos
print()
println()
readInteger()
readDouble()
readChar()
readString()
Funciones matemáticas
abs(n)
log(n)
sqrt(n)
pow(b,e)
floor(n)
ceil(n)
round(n)
sin(n)
cos(n)
tan(n)
asin(n)
acos(n)
atan(n)
random(n)
Funciones gráficas
point(x,y)
line(x1,y1,x2,y2)
ellipse(x,y,w,h)
rect(x,y,w,h)
triangle(x1,y1,x2,y2,x3,y3)
text(msg,x,y)
textWidth(msg)
textSize(n)
background(r,g,b,a)
strokeWeight(n)
stroke(r,g,b,a)
noStroke()
fill(r,g,b,a)
noFill()
image(url, x,y,w,h)
Nuevo
Ayuda
Probar
...
double xld = 290; double xli = 30; double y = 160; double vy = 7; double x = 160; double vx =5; int p = 0; /** Es inestable, puede dar algun que otro error. * Siempre se me han solucionado los errores recargando la pagina. **/ void ika(){ background(255,255,255,1); fill(0,0,0,1); image("http://3.bp.blogspot.com/-b6LOn7JgVmU/TwYruz1UDmI/AAAAAAAAADc/2rKoGiVTQNo/s320/Ika.png",0,17,320,320); textSize(18); text("Has Perdido",10,28); vy = 0; vx = 0; } void miku(){ background(255,255,255,1); fill(0,0,0,1); image("https://myanimelist.cdn-dena.com/r/360x360/images/characters/4/301226.jpg?s=058392a99c4b740b980d1c31219af70b",0,30,360,360); textSize(18); text("Has Ganado",10,28); vy = 0; vx = 0; } int c=150; void juego(){ background(0,0,0); image("http://static.cdn.ea.com/battlelog/prod/emblems/320/490/2832655241387166490.jpeg?v=1345636040.13",0,0,320,320); textSize(20); text(p,c,178); fill(255,255,255,1); double yi = mouseY; double y1 = yi - 40; double y2 = yi + 40; stroke(255,255,255,1); strokeWeight(2); noFill(); rect(xli-10,y1,10,y2-y1); rect(xld,y1,10,y2-y1); fill(255,255,255,1); stroke(255,255,255,1); ellipse(x,y,10,10); if (x-5==xli){ if(y>=y1){ if(y<=y2){ p = p + 1; vx=5; } } } if(x+5==xld){ if(y>=y1){ if(y<=y2){ p = p + 1; vx=-5; } } } x = x + vx; if(y>=315){ y = 315; vy = random(-4,-14); } if(y<=5){ y = 5; vy=random(4,14); } y = y + vy; if(x>=315){ ika(); } if(x<=5){ ika(); } if(p>=10){ c=142; } if(p == 10){ miku(); } } void main(){ animate(juego); }
Canvas not supported.
Programado por
Nicolás
45 votos
5172 descargas
7405 usos