Bugs and their types
There are actually two kinds of bugs that appear in a game: the compile time bug and the runtime bug. The compile time bug is the bug that is detected by Construct 2 (or any other programming tools) when the code is being translated into a game or when it is being compiled. On the other hand, the runtime bug is the bug that is not detected when compiled, but comes up while the game is played.
The compile time bug usually appears because there's some code that's not written correctly, or, maybe, we're trying to access a variable that has not been created yet. Usually, there's no compile time bug in Construct 2, because it is designed to be beginner-friendly, and you can't do something impossible such as accessing a variable that doesn't exist.
Solving a runtime bug
Alright, so what usually causes runtime bugs to appear in Construct 2? Bugs appear when we do not write code clear enough for Construct 2 to understand. Let's say you're writing the code that runs at the beginning...