0
我創建的XNA遊戲,我需要一個碰撞檢測邏輯:XNA - 碰撞永遠不會發生
public Rectangle boundingBox = new Rectangle((int)playerShipPos.X, (int)playerShipPos.Y, frameWidth, frameHeight);
this.boundingBox = new Rectangle((int)meteorPosPub.X, (int)meteorPosPub.Y, (int)meteorTexture.Width, (int)meteorTexture.Height);
for (int i = meteorList.Count - 1; i >= 0; i--)
{
meteorGenerator meteor = new meteorGenerator(Vector2.Zero);
if (meteorList[i].meteorPosPub.Y > 664)
{
meteorList.RemoveAt(i);
if (meteor.boundingBox.Intersects(playerShip.boundingBox))
{
meteorList.RemoveAt(i);
}
}
}
所以我想實現這一目標的效果:如果玩家船舶觸碰流星流星是皮並從列表中刪除,但實際上沒有任何反應。