Commit 0b4e3b1
Fix sprite flicker broken with multi-camera setups (#1357)
* Fix sprite flicker broken with multi-camera setups
The flicker visibility was toggled per draw() call, so with 2 cameras
(e.g., default + minimap) it toggled twice per frame, canceling out.
Replace the per-frame boolean toggle with time-based flickering:
- Track elapsed time in update() instead of toggling state
- Compute visibility in draw() from elapsed time (read-only, no mutation)
- Consistent ~15 flashes/sec regardless of frame rate or camera count
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Address review: extract constant, fix initial visibility, reset elapsed
- Extract FLICKER_INTERVAL_MS constant (33ms, ~15 flashes/sec)
- Invert parity check so first frame starts visible, not invisible
- Always reset elapsed when flicker() is called (even if already flickering)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 5ebd52e commit 0b4e3b1
2 files changed
+22
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
34 | 41 | | |
35 | 42 | | |
36 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
141 | 144 | | |
142 | 145 | | |
143 | 146 | | |
144 | | - | |
| 147 | + | |
145 | 148 | | |
146 | 149 | | |
147 | 150 | | |
| |||
329 | 332 | | |
330 | 333 | | |
331 | 334 | | |
332 | | - | |
| 335 | + | |
| 336 | + | |
333 | 337 | | |
| 338 | + | |
334 | 339 | | |
335 | 340 | | |
336 | 341 | | |
| |||
677 | 682 | | |
678 | 683 | | |
679 | 684 | | |
680 | | - | |
681 | | - | |
| 685 | + | |
| 686 | + | |
682 | 687 | | |
683 | 688 | | |
684 | 689 | | |
| |||
696 | 701 | | |
697 | 702 | | |
698 | 703 | | |
699 | | - | |
700 | | - | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | | - | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
705 | 710 | | |
706 | 711 | | |
707 | 712 | | |
| |||
0 commit comments