C++ ```###前提・実現したいこと ここに質問したいことを詳細に書いてください 現在バブルポップみたいなゲームを作ってます。 ボールがクリックされた位置に飛んでボールにくっ付く感じにはできたのですがまだ一種類のボールしか飛ばせません。 なんとかボールがたくさん打ててたくさんくっつくようにしたいのでアドバイスお願いします ###該当のソースコード int i; int j; //マウス座標を格納 int mouseX, mouseY; //マウス座標の取得 GetMousePoint(&mouseX, &mouseY); //クリックしたらボールが飛ぶ if ((GetMouseInput() & MOUSE_INPUT_LEFT) != 0) { for (cnt = 0; cnt < MAX_BALL; cnt++) { if (g_ball[cnt].state == 0) { g_ball[cnt].number = rand() % 5+1; break; } if (cnt < MAX_BALL) { //ボールの初期座標 g_ball[cnt].pos_x = 320.0f; g_ball[cnt].pos_y = 429.0f; //ボールの速度 g_ball[cnt].spd_x = -(g_ball[cnt].pos_x - mouseX) / 60; g_ball[cnt].spd_y = -(g_ball[cnt].pos_y - mouseY) / 60; g_ball[cnt].state = 1; } } } //座標の変更 for (cnt = 0; cnt < MAX_BALL; cnt++) { if (g_ball[cnt].state == 1) { //ボールの移動 g_ball[cnt].pos_x = g_ball[cnt].pos_x + g_ball[cnt].spd_x; g_ball[cnt].pos_y = g_ball[cnt].pos_y + g_ball[cnt].spd_y; } } //ボールの反射 for (cnt = 0; cnt < MAX_BALL; cnt++) { if (g_ball[cnt].pos_x >= 640.0f - g_ball[cnt].grp_w) { if (g_ball[cnt].spd_x > 0.0f) { g_ball[cnt].spd_x = g_ball[cnt].spd_x * -1; } } if (g_ball[cnt].pos_x <= 0.0f) { if (g_ball[cnt].spd_x < 0.0f) { g_ball[cnt].spd_x = g_ball[cnt].spd_x * -1; } } } // ブロックとボールのあたり判定 for (j = 0; j < MAX_BALL; j++) { for (i = 0; i < MAX_BLOCK; i++) { if (collision(g_ball[j], g_block[i]) && g_block[i].state == 1) { g_ball[j].spd_x = 0; g_ball[j].spd_y = 0; g_block[i].state = 1; } } } //ボールの消滅 for (cnt = 0; cnt < MAX_BALL; cnt++) { if (g_ball[cnt].state == 1) { if (g_ball[cnt].pos_x < -64) { g_ball[cnt].state = 0; } } } ###試したこと 課題に対してアプローチしたことを記載してください ###補足情報(言語/FW/ツール等のバージョンなど) より詳細な情報
『たくさん』打つ、『たくさん』くっつくの『たくさん』意味は、1種類のボールだけではなく、『複数種類』のボールをうったりくっつけたりしたいという意味ですしょうか?
そうです!