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
...
int pos= 0; int dispX; int dispY; boolean hayDisp= false; int velDisp= 7; int enemX; int enemY; boolean hayEnem= false; int velEnem= 10; int velEnemX; int puntos= 0; void pintar() { image("http://dis.um.es/~ginesgm/files/fondo1.jpg",0, pos, 320, 539); image("http://dis.um.es/~ginesgm/files/fondo1.jpg",0, pos-539, 320, 539); image("http://dis.um.es/~ginesgm/files/nave.png", mouseX-30, mouseY-30, 60, 60); pos= pos+1; if (pos==539) pos= 0; if (mousePressed && hayDisp==false) { hayDisp= true; dispX= mouseX-6; dispY= mouseY-30; } if (hayDisp) { image("http://dis.um.es/~ginesgm/files/disparo.png", dispX, dispY, 12, 24); dispY= dispY - velDisp; if (dispY<-24) hayDisp= false; } if (hayEnem) { image("http://dis.um.es/~ginesgm/files/enemigo1.png", enemX, enemY, 50, 56); enemY= enemY + velEnem; enemX= enemX + velEnemX; if (enemY>320) hayEnem= false; } if (hayEnem==false) { hayEnem= true; enemY= -56; enemX= floor(random(300)); velEnem= floor(random(15))+5; velEnemX= floor(random(6))-3; } if (dispX+12
Canvas not supported.
Programado por
GinesGM
0 votos
142 descargas
29 usos