game.spawn

Section: Game / Entities

What it does

game.spawn brings a game object into being: it is how the rest of the script comes to have one. It takes type and position. position is optional.

The API says: creates entity, returns id

Signature

game.spawn(type, position?)

Arguments

  • type
  • positionoptional

Example · generated

function start() {  game.spawn('default');}

game.spawn is called with values of the shape its signature asks for. The code sits in start(), which the engine calls once, when the entity spawns.

12 members in game