# Getting Started

Guidelines

TIP

Developer games take events as mainline, players fill in the corresponding logic in the events.

  1. Developer system provides some global objects for players by default. The global object for event monitoring is ScriptSupportEvent, check Wiki for other global objects.
  2. Players need to add event monitors manually. Game.Start event is executed when the game start.Detailed event types and return parameters are available in Event-System
ScriptSupportEvent:registerEvent([=[Game.Start]=], Game_StartGame) --function() end
  1. About game event, event monitoring are not necessary except Game.Star, players can choose accordingly.
  2. Trigger order of game events:
  • Trigger Player.Init event when player enter room
  • Trigger Game.Start event when game start
  • Game.Run event is triggered by each tick in game
  • Game.End is triggered after game ended, or call Game:doGameEnd() to end game.
  • Game.TimeOver event is triggered when game is timeout
  1. Data transfer between different scripts under the same game can be completed by _G, example as below:
-- Effect:Display chat when game start'Hello World!'
-- Filetest1.lua
_G.sayHello = 'Hello World!'

-- Filetest2.lua
Game_StartGame = function()
	Chat:sendChat(_G.sayHello, 1)
end
ScriptSupportEvent:registerEvent([=[Game.Start]=], Game_StartGame)
Last Update: 9/6/2019, 10:56:18 PM