Scoring in your document using Timelines


(Nick ) #1

This is one from the old forums but worth a look for an alternative way to create a scoring mechanism using timelines.
The link will let you download the saucer sheep example…this is a pretty unique way to do a simple hit/collision and uses “just Hype”

http://hype.desk.com/customer/portal/questions/1505604-going-to-scene-after-mutliple-buttons-are-clicked


#2

Thanks for pulling this out, @nick. I’m going to copy it below:

going to scene after mutliple buttons are clicked

Dear Hype,

How would I go about jumping to a scene only after 3 buttons are clicked? It’s sort of a multiple choice list, and after clicking on three specific answers, I want it to go to a different scene.

Any help is much appreciated!

Kind regards,
Wout

Adrian Thompson
SEP 02, 2013 01:24PM PDT
I’m thinking you’ll need to use some kinda of Javascript to perform this.

If you have a script put a value in a variable, one for each button then you could get it to check if all 3 variables (buttons) have been clicked and if so proceed to the different scene.
Up
-2
Down

Ryan Nielsen
SEP 02, 2013 02:45PM PDT
Tumult Hype Agent
Hi Wouter,

Adrian is correct in that JavaScript is commonly used for cases such as this. One creative trick we’ve seen others use, however, is to create a “counter” timeline which has timeline actions to pause the timeline the number of times something needs to be counted, and a final timeline action for the completion action. This document has an example:
http://tumult.com/support/examples/22452-timeline_counter/UFO.hype.zip

In the UFO document, notice that when each sheep is clicked it runs a timeline which animates its abduction and, at the very end of that timeline, there’s a timeline action which continues the Sheep Count timeline. The Sheep Count timeline, in turn, increments the number of sheep abducted and then has a timeline action to pause itself. There are as many timeline actions as there are sheep, and the final timeline action plays the ending timeline.

It’s a complex example, but you can use the same technique. Create a counter timeline, and add three timeline actions to that timeline. The first two should pause the counter timeline itself, and the third will invoke a Jump to Scene… action. Then have each correct answer click continue the counter timeline.

Either JavaScript or the counter timeline should meet your needs. The tack to take just depends on which approach you’re more comfortable with.

I hope this helps!