tickUntil

suspend fun tickUntil(stopAt: IntPredicate): Int

Ticks with stopAt until it returns true. The elapsed ticks (starting from 1) will be passed to stopAt.

Resumes on Render thread.

Example:

  • tickUntil { true } -->1

  • tickUntil { it >= 2 } -->2

Exceptions thrown by stopAt are delivered to the waiting coroutine.

Return

the times of stopAt to be executed (equals to elapsed ticks)

Parameters

stopAt

the callback of elapsed ticks. Will be called on game tick.