Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

I'd like to make a "search" game system, so players type something into the bar, then click on a card that contains the term (so far I've had no problems!). 

But to put an end to the game, I'd like their number of moves to be limited, so they can view say 10 documents (so 10 different cards) before automatically arriving at a new card that forces them to turn in an investigation report. What would be the easiest way to do this? 

The other idea I have would be to set up a countdown visible from all the maps, at the end of which you arrive at a final map, but I imagine that's a lot more complicated...

I'd make a locked and/or invisible field (or maybe a slider) somewhere to track the number of moves the player has remaining.

If you're displaying search results as a bunch of links in a field, you could make clicking a link count down the remaining moves by overriding the "link" event for the field. The default handler for link events is

on link x do
 go[x]
end

So you could instead give the field something like

on link x do
 moves.text:moves.text-1
 if moves.text=0
  go[theGameOverCard]
 else
  go[x]
 end
end

Side note: you can also write that conditional as:

go[if moves.text=0 theGameOverCard else x end]

This approach might be a little weird, though, since it ignores the user's final selection and surprises them with a game over.

If the cards you can get to via search have a "back" button, maybe it would make sense to test for game overs there, and navigate to the final card instead of the search page?

I'm using SearchEngine contraption, I'm not sure if I can "override" the links displayed in this prototype?

You'd need to modify the contraption prototype, but it's a very simple change. In the SearchEngine the results are displayed in a rich-text field named "o". It doesn't currently contain any scripts and simply relies upon the default "on link" behavior.

The main thing to be aware of is that within a Contraption you won't auto-magically have cards and widgets of the deck in scope as variables; You do have access to "deck", though, so you can use fully-qualified paths to reach out to a specific widget. e.g. "deck.cards.theSearchCard.widgets.theSearchCounter", and if you use go[] you can refer to cards by name (as strings) instead of value (as cards).

I've tried to make all the contraptions in the bazaar as generic and reusable as possible, but don't be afraid of hacking them up or making changes to suit a specific application. In the worst case you can always delete the prototype and re-import the reference copy.

I think I'm close to the solution, but I don't understand why when I write "moves.text:moves.text-1" -> the field displays "-1" instead of doing a calculation...