Class: Task

b5. Task


new b5.Task(){b5.Task}

core/tasks.js, line 26

A Task is a function that is ran every game update that can be paused, played and stopped.

Name Type Description
name string

The name of the task

func function

The function to call each update

data object

User supplied data which is passed back

state number

Current state of the task

running_time number

The amount of time the task has been running in seconds

delay number

Amount of time in seconds to wait before running, pass -1 to not start at all

loops number

The number of times the task has been ran

repeat number

Number of times to run task, pass 0 to run forever, note that the task will be removed from the list when it runs out

last_time number

The amount of time that has passed since the last time the task was ran

wait number

The amount of time to wait before calling this task again

Type Description
  • The created task



The task is in a dormant state (waiting to be ran)


The task is in a paused state


The task is in a running state


The task is in astopped state