好吧,我在這裏有三個條件。這看起來很簡單,但我無法按照自己的想法做到這一點,在我嘗試解釋它時忍受着我。有條件的陳述(請參閱說明)
If(conditionA){
Play Sound 1}
If(conditionB) {
changedrawable ///(irrelevant)
}
If(conditionA && conditionB){
Play sound 2
}
////Unfortunately, since condition A is true, it plays sound 1 too, and I only want it to play sound 2
FWIW這些條件只是座標上的觸摸屏,和我有他們設置爲布爾的
Boolean conditionA;
conditionA = y > 0 && y < (0.2 * tY) && x > 0 && x < (0.1667 * tX) || y2 > 0
&& y2 < (0.2 * tY) && x2 > 0 && x2 < (0.1667 * tX);
ConditionA和ConditionB指的是不同的點上觸摸屏。主要問題:當條件A和條件B都爲真時,我怎樣才能得到它,只播放聲音2(而不是兩個聲音)?試圖解決這個問題的最後一天,我一直拉着我的頭髮。請讓我知道是否有解決方案或需要進一步的細節。謝謝!
如果conditionA和conditionB爲真,那麼「change drawable」永遠不會執行。這似乎不是問題中所解釋的預期流程。 – Danny