All the time. As a programmer, you are not only a designer, architect, detective but also a vandal. You want to break your games before other players do.
Breaking your game is actually a good idea because it not only makes you a better programmer but also better at logic.
From my experience, I remember when I was programming a character to move in 4 directions. Weirdness ensues when I pressed all four arrow keys.
Long story short, my movement code was button dependent when it should have been dependent on a character state and direction of the character.
A lot of the time, your initial code might work in terms of "English" but when you apply English directly to logic, that is where the bugs can actually happen quite often.
Bugs are all learning experience. Learn from them and embrace them all!
Usually a game can break because of faulty logic.
It is more important to question the coding style of your code and think about how it can affect your future code in the long term.
This was my old code for character idle animation:
if(direction.equalsIgnoreCase("right") && !rightPressed
&& !castingMagic && !attacking ||
(rightPressed && (upPressed || downPressed || leftPressed))
&& !castingMagic)
{
g.drawImage(idleRightAnim.getImage(0),(int)position.getX(),(int)position.getY(),null);
}
The old code was so bad. Eventually i had to scrapped it and re evaluate my logic. Here is the new code
else if(state == State.IDLE && direction == Direction.RIGHT)
{
soraIdleRightAnimation.draw(g2D);
}
My learning experience was if my code is hard to read there is probably a better approach that takes fewer lines. It is important not to over think it. My old code involves so much over thinking that it became a pile of mess.