Commit e084f5a
committed
Add deliberately-broken enemy spawner
This adds a SpawnerBroken script, and an enemy_spawner_broken scene
using that script configured to spawn enemy.tcsn.
The intention is that it spawns the given scene periodically, but
something is wrong: it spawns the scene way too frequently, which makes
the game unplayably slow.
The bug – signposted with a FIXME comment – is intentional and
contrived. It's meant to be a simplified version of a very common class
of bug: if you specify a time internal as a `float`, the type alone
doesn't tell you whether the units are seconds, milliseconds, etc., and
if you get it wrong you will only find out through testing.
The idea is that a learner can fix the issue in at least 4 ways:
1. Increase the spawn_interval property on the instance of the scene in
main.tscn.
2. Increase the spawn_interval property in enemy_spawner_broken.tscn.
3. Increase the spawn_interval property in spawner_broken.gd.
4. (The correct fix) Address the FIXME in the code by removing the
erroneous conversion to milliseconds.1 parent 0e24cbc commit e084f5a
3 files changed
Lines changed: 40 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments