stage3在阶段2之后。我想知道如何判断mouseIsPressed
和stage2是否处于活动状态。
我已经尝试过if(mouseIsPressed&&stage2===true){so on}
var hp=100;
var name=["boromon","telemon","heptamon","coromon"];
var boromon={
eyecolor:"blue",
skincolor:[0,0,255],
abilitys:["beam of life","blinding bite","stare strike"]
};
var enemy=[hp,name[1]];
fill(255, 0, 0);
text(name[0]+" wants to be your freind"+" click to accept",10,10);
var currentCharacter=[];
fill(41, 23, 23);
text(currentCharacter,10,10);
var stage2=function(){
background(255, 0, 0);
text(currentCharacter+" is now your freind click to continue",10,10);
};
var stage3=function(){
background(0, 174, 255);
var star=getImage("space/star");
image(star,10,10);
image(star,10,10);
image(star,10,10);
image(star,10,10);
};
draw=function() {
if(mouseIsPressed)
{currentCharacter=name[0];}
if (mouseIsPressed){
stage2();
if(mouseIsPressed){stage3();}
}
};
我想每次按下鼠标和输出都不同
答案 0 :(得分:0)
您还没有定义mouseIsPressed
-使其看起来像这样:
var mouseIsPressed = 0;
document.body.onmousedown = () => ++mouseIsPressed;
document.body.onmouseup = () => --mouseIsPressed;