Introduction to Victory and Defeat

Get a brief introduction on victory and defeat.

We'll cover the following

After hours of searching the twisting dungeon halls, our brave hero notices the glistening Amulet of Yala in a corner. Raising the amulet in triumph, the hero slips its chain around their neck. Power courses through them, and the darkness that threatened their home is repelled. They’ve achieved a great victory and can rest, knowing that their friends and families are once again safe.

Meanwhile, in an alternate universe, our hero is surrounded by enemies. Fatigue weighs the hero down as they hew at a seemingly never-ending wave of monsters. Orcs and goblins fall, but the hero suffers increasingly devastating injuries as they fight to forestall the end. Finally, a vicious orc lands a telling blow and our hero sinks to the ground, defeated.

These are common endings in role-playing games: the player has either won or lost the game. The two go hand-in-hand; victory with no chance of failure isn’t really a game, and failure with no chance of winning is just depressing.

What will we learn?

In this chapter, we’ll give the monsters some intelligence and introduce the real possibility of failure. We’ll add a game-over screen with an option to try again.

Once we have that working, we’ll add the code necessary to spawn the Amulet of Yala somewhere within the dungeon, as far away from the adventurer as possible. We’ll also add a victory screen that displays after the player reaches the amulet.

Get hands-on with 1400+ tech skills courses.