android If else statements
<p>So my issue is, I get a wierd sound problem (it repeats the hit sound really fast) when I use an if statement to determine if I hit the monster and lived or if I hit the monster and died. Using classic mario logic, if I land on top I live, if not then I die. I didn't have a problem until I added two different if statements. If you need more info let me know. I think my problem is how I am using the if statement.</p>

<pre><code>private void checkGhostCollisions() {
    int len = ghosts.size();
    for (int i = 0; i &lt; len; i++) {
        Ghost ghost = ghosts.get(i);
        if (hero.position.y &lt; ghost.position.y) {
            if (OverlapTester.overlapRectangles(ghost.bounds, hero.bounds))
                hero.hitGhost();
                listener.hit();
        } else {
        if(hero.position.y &gt; ghost.position.y) 
             if (OverlapTester.overlapRectangles(hero.bounds, ghost.bounds)) {
                 hero.hitGhostJump();
                 listener.jump();
            break;
            }
        }
    }
}
</code></pre>
