• Asignatura: Informática
  • Autor: reisebastian02
  • hace 5 años

Necesito ayuda para terminar el codigo de un minijuego que estoy haciendo en processing.
5º Hacer que la imagen del topo esté sólo un tiempo en el mismo sitio, es decir, si no se hace clic en un tiempo, se pone en otra posición, pero sin que se sumen puntos ni fallos. 2 PUNTOS. Pista: hacer una variable, llamada por ejemplo tiempo, y cada vez que el castor cambie de sitio poner tiempo =millis(), millis sigue aumentando, pero tiempo no, por lo que si millis() - tiempo>4000 (por ej), el castor cambia otra vez de posición.


codigo:

PImage fondo;
PImage castor;
int xcastor;
int ycastor;
int puntuacion;
int fallos;
int categoria;
int aprendiz;


void setup(){
size(420,420);
fondo=loadImage("back.jpg");
castor=loadImage("animal.png");
xcastor=(int)random(0,width-50);
ycastor=(int)random(0,width-60);

}

void draw(){
background(fondo);
(image(castor, xcastor, ycastor, 50, 60);
int t= millis();
if(t > 2000){
xcastor=(int)random(0,width-50);
}


text("puntos=" + puntuacion, 30,30);
textSize(30);
text("fallos=" + fallos ,60,60);
textSize(30);


int s = millis();
if( s > 10000){
background(0);
//text("puntuacion=" + puntuacion,30,30);
//text("fallos=" + fallos,30,60);
text("puntuacion=" + categoria ,30,90);
//text("categoria=", 30,120);
categoria= puntuacion-fallos;

if(categoria 3 && categoria 7){
text("Eres un master",120,120);

}

}

}

void mouseReleased(){
int s = millis();
if(s = xcastor && mouseX = ycastor && mouseY <= ycastor+60) {
xcastor = (int)random(0, width - 50);
ycastor = (int)random(0, height - 60);
puntuacion = puntuacion + 1;

}

else {
fallos = fallos + 1;

}

}

}

Respuestas

Respuesta dada por: Proaco
0

Respuesta:

dbdjjdjdjejdjdjdjdjfjjdndjdbdbdndjdjdjdjdjjdjdjdjdjdjfjjfjfhfjfjfufugufufjjfjjfjr

Preguntas similares