我的java脚本需要帮助。 我想创建if if then else和last else ...但它不起作用:(
if(fallingFrame >= fallingSpeed) {
if(floor.contains(pt1) || floor.contains(pt2) || floatFloor.contains(pt1) || floatFloor.contains(pt2) || tLPF.contains(pt1) || tLPF.contains(pt2) ) {
//if (isPlayerOnFloor() || IsPlayerOnFloor()) {
falling = false;
if(floatFloor.contains(pt1) || floatFloor.contains(pt2)) {
character.y = main.height - floatFloorHeight - characterheight;
}
if else
{
character.y = main.height - floorheight - characterheight;
}
else (tLPF.contains(pt1) || tLPF.contains(pt2)) {
character.y = main.height - tLPFHeight - characterheight;
}
}
}
答案 0 :(得分:5)
if (a == b) {
... do this ...
} else if (a == b+1) { // <---- I believe you're looking for this!
... do that ...
} else {
... do something generic! ...
}
答案 1 :(得分:2)
它应该是“else if”,而不是“if else”。
你还需要另一个条件。 “否则,如果”什么?你基本上想说的是: