0
我將如何處理並記錄發生的碰撞數量?我有一個簡單的碰撞檢測,它會檢測一個對象是否與另一個碰撞,現在我希望記錄它們之間的碰撞。記錄收集檢測和輸出碰撞數量
代碼碰撞
public void CompositionTarget_Rendering(object sender, EventArgs e)
{
appleTimer += 1;
if (appleTimer > 60)
{
appleTimer = 0;
AddApple(new Apple());
}
for (int indx = 0; indx < myapples.Count; indx++)
{
myapples[indx].Update(LayoutRoot);
bool collided = DetectCollision(myapples[indx], myPig);
if (collided)
{
// record how many apples are eaten here
RemoveApple(myapples[indx]);
indx--;
}
}
在循環'int count = 0;'和代替你的註釋'count ++;'?之前? –
感謝您的建議 – Beep