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
...
void estrella(){ stroke (255,255,255); double x= random (319); double y= random (319); double ancho = random (2,5); ellipse (x,y,ancho, ancho); } void nave(){ double x = random(320); double y = random(320); double escala=1; int grosorAleron=round(2*escala); fill(239,179,93,1); rect(x-20*escala,y,40*escala,10*escala); fill(212,141,39,1); noStroke(); ellipse(x,y,10*escala,40*escala); ellipse(x-20*escala,y+5*escala,5*escala,20*escala); ellipse(x+20*escala,y+5*escala,5*escala,20*escala); stroke(144,102,15,1); line(x,y+5*escala,x,y+15*escala); } void main (){ background (0); for ( int n=1;n<=20;n=n+1){ double altura=random(0,319); line(0,altura,319,altura); nave(); estrella(); } estrella (); estrella (); estrella (); estrella (); }
Canvas not supported.
Programado por
Antonio_Rosa
2 votos
414 descargas
1004 usos