This zho is about the block. For more information on the value this block holds, see Timer (value).
 計時器 計時器 類別 偵測類積木 形狀 橢圓形積木

The Timer 積木 is a 偵測類積木 and a 橢圓形積木. The block starts at 0 when Scratch is launched and increases gradually; every second it will have increased by 1. This block is almost always used with the 計時器重置 block — usually the timer must be reset at the beginning of a 專案 for the Timer block to hold the right value.

This block can be displayed as a 舞台監控視窗.

## 用法示例

— in One Sprite One Script 專案, in order to keep it single frame (scroll to see the whole script)

造型換成 [Mouse pointer v]
定位到 x: (滑鼠游標的 x) y: (滑鼠游標的 y)
蓋章
造型換成 [Hiding person v]
定位到 x: (PersonX) y: (PersonY)
如果 <<碰到 [mouse pointer v] ?> 且 <滑鼠鍵被按下？>> 那麼
顯示
說出 [You found me!] (2) 秒
停止 [這個程式 v]

如果 <(計時器) > (5)> 那麼
計時器重置
變數 [PersonX v] 設為 (隨機取數 (-240) 到 (240))
變數 [PersonY v] 設為 (隨機取數 (-180) 到 (180))
end
end
end
• Showing how long a Scratcher is taking in a project (a 變量 can also be used for this, but it is not as accurate)

• Checking if an amount of time is acceptable for advancing to another stage of the project

說出 [You beat the level! Let's move onto the next one.] (3) 秒
廣播訊息 [new level v]

說出 [You didn't finish in 30 seconds. Maybe next time.] (3) 秒
停止 [全部 v]
end
• Reacting to the length a button is held down by changing a variable faster:

變數 [points v] 改變 (1) // add points faster
等待 (.1) 秒 // wait a small amount of time
end

### Multiple timers

Multiple timers can be simulated with variables which record the time at the beginning of the session.

## 參見

Cookies help us deliver our services. By using our services, you agree to our use of cookies.