0
我想弄清楚瓷磚碰撞,我不能得到這個工作。當我與瓷磚碰撞時,什麼也沒有發生。XNA資源錯誤
我的碰撞類
public Point WorldToMapCell(Point worldPoint)
{
return new Point((int)worldPoint.X, (int)worldPoint.Y);
}
public MapCell GetCellAtWorldPoint(Point worldPoint)
{
Point mapPoint = WorldToMapCell(worldPoint);
return Rows[mapPoint.Y].Columns[mapPoint.X];
}
public MapCell GetCellAtWorldPoint(Vector2 worldPoint)
{
return GetCellAtWorldPoint(new Point((int)worldPoint.X, (int)worldPoint.Y));
}
我的更新方法
if (myMap.GetCellAtWorldPoint(player.position).Walkable == false)
{
player.velocity = Vector2.Zero;
}
Your WorldToMapCell()函數什麼都不做。它只是返回您傳入的相同Point對象。 – jgallant