私はこの本当に素晴らしいゲームをJavaScriptで書いていますが、今書いた関数の一部は実行するたびにクラッシュします。
だから私は疑問に思っています、それはforループで実行するだけですか、それともどこかで構文エラーを起こしましたか?
これがコードです。関数から取得したものですが、これがクラッシュの原因となる部分です。
for (zloop=min_houses_per_block; zloop<(house_number+1); zloop++)
{
if (zloop>0)
{
city_block_array[first][second].house_array[zloop].width =
(min_house_width+(((max_house_width-min_house_width)/house_width_slots)*(Math.floor(Math.random()*house_width_slots))));
city_block_array[first][second].house_array[zloop].height =
(min_house_height+(((max_house_height-min_house_height)/house_height_slots)*(Math.floor(Math.random()*house_height_slots))));
if (zloop=1)
{
x_number=(block_width-(house_threshold*2))-city_block_array[first][second].house_array[zloop].width;
min_house_x=house_threshold
city_block_array[first][second].house_array[zloop].x =
(min_house_x+(((x_number)/house_x_slots)*(Math.floor(Math.random()*house_x_slots))));
}
city_block_array[first][second].house_array[zloop].x=6000;
city_block_array[0][0].house_array[1].x=6000;
}
}
パーツがなくても問題なくif (zloop=1)
動作します。