This question might be simple to you guys but it’s a pain to me >.<
Please help me take a look on it… Thank you
if (hand2._visible === true){
if (hand2.hitTest(empty0)){correctscore += 1; empty0._x += 1000;}
if (hand2.hitTest(empty1)){correctscore += 1; empty1._x += 1000;}
if (hand2.hitTest(empty2)){correctscore += 1; empty2._x += 1000;}
if (hand2.hitTest(empty3)){correctscore += 1; empty3._x += 1000;}
}
These codes are workable…
However if I want to change it to a for loop like this:
if (hand2._visible === true){
for (var k = 0; k < 4; k++){
if (hand2.hitTest(this["empty" + k])){correctscore += 1; this["empty" + k]._x += 1000;}
}
}
The codes won’t work… >.<
Thanks for reading this question…