Wait
By default a processor works without stopping: it runs its instructions for the tick and carries on from the same place on the next one. A three-line program gets through an iteration several hundred times a second — and almost always that is wasted.
wait says “not right now”. The processor gives up the rest of the tick and comes back to the
same line later, when the time is up.
Its neighbours in the category do something similar in their own ways:
end starts the iteration over, stop halts the
processor altogether.
Lessons
Section titled “Lessons”- A pause in secondsWait this many seconds — and spend not a single instruction on the waiting
- A program's rhythmSixty iterations a second are rarely needed. How to choose a rhythm and how to set it
What you need first
Section titled “What you need first”«How the processor works» — about the tick and @ipt. Without
that, a conversation about what exactly wait gives up hangs in the air.
Unofficial fan project, not affiliated with Anuke. Mindustry sprites, fonts and translations © Anuke, used under GPL-3.0; Fira Code under OFL-1.1. Site code is GPL-3.0.