| 1 | local v2 = require 'dokidoki.v2' |
| 2 | |
| 3 | callback = callback or function () end |
| 4 | |
| 5 | local counter = 5 |
| 6 | |
| 7 | function reset_counter() |
| 8 | counter = 5 |
| 9 | end |
| 10 | |
| 11 | function update() |
| 12 | counter = counter - 1/60 |
| 13 | self.sprite.color = {1, 1, 1, math.sin(math.mod(counter, 1) * math.pi)} |
| 14 | |
| 15 | if counter <= 0 then |
| 16 | self.dead = true |
| 17 | callback() |
| 18 | else |
| 19 | self.sprite.image = game.resources.number_sprites[math.ceil(counter)] |
| 20 | end |
| 21 | end |