How To Set Win Conditions in Puzzle Script

Everybody likes to win. You’re players want 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.

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.

Experiment

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 >

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s