Fandom

Project Spark Wiki

BT Countdown Timer

233pages on
this wiki
Add New Page
Comments3 Share
Countdown Timer

In-game descriptionEdit

The [countdown timer] executes a line or set of lines when the amount of time specified has passed. Immediately after you place [countdown timer], you’ll want to place a number to specify how long the countdown is. The game interprets this number as being in seconds, although you can add a modifier [in frames] afterwards to change that.

UseEdit

It’s important to realize that lines governed by [countdown timer] will run continually after the time specified is elapsed. That means that a simple WHEN [countdown timer] [5] DO [jump] is placed, the brain will wait 5 seconds then jump, jump, jump etc. (continually). You can, however, introduce more interesting behaviors by utilizing the modifiers [hold] and [loop]. Check those tiles out after you've placed [countdown timer] in your line!

You can also use the logic tiles like [started to], [no longer], [until] or [after] with the countdown timers. For example, WHEN [started to] [countdown timer] [number] will only execute once the number of seconds elapse (and only once).

This tile must have a [number] as a parameter. If no number is specified, it defaults to 1. This number is measured in seconds unless the [in frames] tile is present (note that there are 30 frames in a second).

ModifiersEdit

  • Hold 2
    Hold:  Pauses a completed timer for a specified amount of time.





  • Loop 2
    Loop: Tells a timer to start over once it has completed.





ExamplesEdit

Example: Time bombEdit

Countdown Timer Example 1





This tells the brain: after 3 seconds, destroy self.


Example: Church BellEdit

Countdown Timer Example 2





This tells the brain: After 3 seconds, play the "bell" sound and then loop. That means that it will play the sound every 3 seconds, starting with a 3 second delay. 

Advanced ModifiersEdit

  • In frames
    Tells the timer to measure in frames of game time instead of seconds. This is particularly useful when you want to count less than a second easily or loop something really fast. Project Spark framerate is 30 frames per second (FPS).




  • Trigger on start
    Triggers the action to run immediately, and then begin the timer.





Advanced ExamplesEdit

Example: The Telephone RingEdit

Taking the Church bell example from above and adding a few more tiles we can create a more complex mechanism that will make the sound of the bell look like a telephone ring. Here is how:

Countdown Timer Example 5
What this will do is tell the brain to play continually the bell sound for one second (30 frames), then wait one second and then loop. The sound will start immediately, because we entered the [trigger on start] tile. So, this will simulate a telephone ring (try it for yourself with different sounds for better results). 


OutputsEdit

  • Timer seconds remaining
    The number of seconds that the timer will remain on or off. 





  • The number of seconds that the timer has been on or off.
    Timer seconds complete





  • The ratio of time that the timer will remain on or off.
    Timer ratio remaining





  • Timer ratio complete
    The ratio of time that the timer has been on or off.







Output examplesEdit

Example: Displaying a countdown timer on screen

Countdown Timer Example 6
Using the outputs will always display the figure with four decimals. To avoid that, simply use the [round] function, as seen in this example. This brain will display on screen a countdown timer from 100. In order to do this, we used a number variable, called "Timer variable" to hold the rounded seconds and then display them.. 

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.