Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Adding a turn counter to a Twine game

Are you using Twine to write interactive fiction? Do you want to add a sense of urgency, making your players think they have to play smartly? Consider adding a turn counter to your game.

Three bits of code are needed:

Code 1: (set: $TurnCount to 0) 

Put this on the first scene of the game. Make sure the player cannot access this page.

Code 2: (set: $TurnCount to $TurnCount+1) 

Put this at the beginning of each scene. This advances the turn counter.

Code 3: (if: $TurnCount > 12)[Display endgame text] (else:)[Text that normally happens if timer hasn't run out.] 

Put this near a hub world, or near the end branches of the game. This is the check that determines if time runs out.

Step by step video walkthrough:

I used this type of turn counter in my submission to the Interactive Fiction competition 2022, "You Feel Like You've Read This In a Book". Play my game here: https://ifdb.org/viewgame?id=j10f35m2va268msd

Support this post

Did you like this post? Tell us

Leave a comment

Log in with your itch.io account to leave a comment.