How To Set Win Conditions in Puzzle Script

Join the Discord. Talk about Game Dev. Talk about Gaming.

You can either watch this tutorial on Youtube below, or otherwise skip past it and read the text version (not all of the Puzzlescript tutorials are on Youtube yet but I plan to do that eventually).

You’re players want to be able to win. This tutorial covers how to program the win conditions of your game. It assumes no prior programming knowledge except the previous Puzzle Script tutorials I have written.

If you’re making a prototype for a bigger game, experiment with win conditions. I tried a few different win conditions for Puzzledorf, like removing all of a certain object, in this case collecting cherries:

But in the end I decided on a variation of classic Sokoban – get all of the blocks on the crosses, but use different colours to mix things up. A small change, but it created far more interesting puzzles.

So, experiment.

Win Conditions

Load the sample project and scroll down to the Win Conditions section of the code. You should see this:

All Target on Crate

The game is won if every target has a crate on it. If you had 3 crates and 2 targets, you would still win the game with only 2 crates on targets. If you swapped it around:

All crate on target

Every single crate would have to be on a target.

You can have one condition, or multiple conditions. For multiple conditions, they all have to be fulfilled. For example, you could have:

All Target on Crate
All Target2 on Crate2

If you have a target and target2 in a level, they both need a crate and crate2 on top of them, respectively. If you have none of the objects required for a specific win condition in a level, for example no target2’s, then the condition is fulfilled automatically.

Different types of Win Conditions

There are several different types of win conditions.

No Object 

In the case of the above, you win if there are none of that object in the level.

Some Object

You win if there is at least one of a particular object in the level.

Some Object1 on Object2

You only need at least one of Object1 on Object2.

No Object1 On Object2

This is a reverse of the all target on crate idea. In this case, you want to get all the specified objects off of each other, rather than on to each other. You can also combine as many different types of win conditions as you like with each other.


Experimenting with different win conditions. Try making a game where you win if all of the crates are off of the targets. Or try making a game where you have to destroy all of a particular type of crate, but other pushable crates are in your way.


You can see my finished sample project here. The next tutorial is on using the late command.

Next Tutorial >

Join the Discord. Talk about Game Dev. Talk about Gaming.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

Up ↑

%d bloggers like this: