game.sendMessage

Section: Game / Entities

What it does

game.sendMessage sends Message on a game object. It takes targetId, msg and data. data is optional.

Signature

game.sendMessage(targetId, msg, data?)

Arguments

  • targetId
  • msg
  • dataoptional

Example · generated

function start() {  game.sendMessage('main', 'Hello');}

game.sendMessage 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