Game update not working?

Trying to help a student troubleshoot a problem. Before I start re-building their code from the start. Does any one know why any on Game Update may not be working? Thanks is advance!

1 Like

Ah, this is sort of a subtle issue; it’s a little more obvious if you look at the code in JavaScript/TypeScript.

The problem here is that they are pausing inside of on start. Most events in MakeCode arcade (including on game update) don’t register until on start has finished running.

We do it this way to make sure that any variables that are set inside of on start are initialized before the on game update event actually runs. Otherwise, any events that reference a sprite set in on start could potentially be accessing an undefined variable.

Easiest fix is to use an on game update every 5000 ms event to spawn the zombies instead

Thanks, Yes after I started to rebuild their code I came across the Repeat 1000 and pauses that were causing the issue.