10/08/01 17:17:26 PhpNw+LL
BoundingBox[] shotClsn1;
BoundingBox[] enemyClsn1;
for (int i = 0; i < enemy1s.Count; i++)
{
shotClsn1[i] = new BoundingBox(
new Vector3(shot1pos[i].X, shot1pos[i].Y, 0),
new Vector3(shot1pos[i].X + 30, shot1pos[i].Y + 30, 0));
enemyClsn1[i] = new BoundingBox(
new Vector3(enemy1s[i].X, enemy1s[i].Y, 0),
new Vector3(enemy1s[i].X + 30, enemy1s[i].Y + 30, 0));
}
for (int i = 0; i < enemy1s.Count; i++)
{
for(int j = 0; j < enemy1s.Count; j++)
{
if (shotClsn1[j].Intersects(enemyClsn1[i]))
{
enemy1s.Remove(enemy1s[i]);
}
}
}
こんな感じだろうか
2Dの当たり判定にBoundingBox使った事ないから間違ってるかもしれない