Class: Task

b5. 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.

Properties:
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

Returns:
Type Description
b5.Task
  • The created task

Members

static,constantb5.Task.Dormant

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

static,constantb5.Task.Paused

The task is in a paused state

static,constantb5.Task.Running

The task is in a running state

static,constantb5.Task.Stopped

The task is in astopped state