Bugsy
Explains
3 hearts left

If and else

New idea

How does a game know you lost?

Every game keeps asking a question like "is health 0?". The answer is always yes or no, which programmers call true or false.

In code that question is a condition, and if acts on it. If the condition is true, the indented lines under if run. If it is false, the computer skips them and runs the lines under else instead.

Only one of the two branches ever runs. Comparisons use signs like > (greater than), < (less than) and >= (greater or equal).