JavaScript - error en codigo de javascript

 
Vista:

error en codigo de javascript

Publicado por Daniel (1 intervención) el 17/12/2017 18:35:23
porque este codigo no ejecuta? ayer funcionaba raro, y cuando cambiava la pocicion de texto donde va el "var meesage" se desaparecia, aunque si recargaba volvia, aparte de eso funcionaba, probe cambian la funcion mouseIsPressed por una condicion if, pero ya nisiquiera respondia no funcionaba, vuelvo y le pongo la funcion anteriormente dicha y ya solo se queda en el inicion cuando doy click no hace nada

de verdad he mirado como hacerlo funcionar pero nada :(

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
fill(0, 0, 0);
ellipse(200, 200, 375, 375);
fill(255, 255, 255);
var message = "Oprime para \niniciar je je je";
textSize(50);
text(message, 59, 176);
var answer = 0;
 
mouseIsPressed = function() {
    fill(0, 0, 0);
    ellipse(200, 200, 375, 375);
    var answer = round(random(1, 5));
    textSize(30);
    if (answer === 1) {
        fill(53, 103, 230);
        triangle(200, 104, 280, 280, 120, 280);
        fill(255, 255, 255);
        text("Nope", 167, 226);
    } else if (answer === 2) {
        fill(230, 170, 51);
        triangle(200, 104, 280, 280, 120, 280);
        fill(255, 255, 255);
        text("Yes", 174, 223);
    } else if (answer === 3) {
        fill(53, 230, 136);
        triangle(200, 104, 280, 280, 120, 280);
        fill(255, 255, 255);
        text("Never", 160, 230);
    } else if (answer === 4) {
        fill(230, 53, 53);
        triangle(200, 104, 280, 280, 120, 280);
        fill(255, 255, 255);
        text(" Try \nagain", 166, 207);
    } else if (answer === 5) {
        fill(230, 53, 230);
        triangle(200, 104, 280, 280, 120, 280);
        fill(255, 255, 255);
        text("    I'm \nnot sure", 147, 211);
    }
};
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder