ScriptApp

Event Listeners

  • App.onUpdate(delta: number)
    • executed every 0.1 second
  • App.onSay(player: ScriptPlayer, text: string)
    • executed when a player chats
  • App.onJoinPlayer(player: ScriptPlayer)
    • executed when a player connects to the map
  • App.onLeftPlayer(player: ScriptPlayer)
    • executed when a player leaves the map
  • App.onPlayerTouched(sender: ScriptPlayer, target: ScriptPlayer)
    • executed when a player collides with another player
  • App.onObjectTouched(sender: ScriptPlayer, tileX: number, tileY: number, tileID: number)
    • executed when a player collides with an object

Methods

  • App.httpGet(url: string, headers: object, callback: ((string) => void))
    • executes an HTTP Get request to the applicable URL
  • App.httpPost(url: string, headers: object, body: object, callback: ((string) => void))
    • executes an HTTP Get post
  • App.getPlayerByID(id): ScriptPlayer
    • calls the player object for the given ID
  • App.sayToAll(text: string, color: number = 0xFFFFFF0)
    • sends the chat message to all players
  • App.showCenterLabel(txt: string)
    • displays the Center Label to all players
  • App.showWidget(fileName: string, align: string, width: number, height: number)
    • displays the Widget to all players
  • App.showYoutubeWidget(link: string, align: string, width: number, height: number)
    • plays the YouTube video in the link for all players
  • App.spawnPlayer(playeID, tileX: number, tileY: number)
    • spawns player as defined by playerID to coordinate tileX, tileY
  • App.getWidgetByID(id: number)
    • gets Widget for the given ID
  • App.loadSpritesheet(fileName: string, frameWidth: number, frameHeight: number, anims: array, frameRate: number): ScriptDynamicResource
    • loads the Spritesheet for the given file and creates an object from it
  • App.addOnTileTouched(x: number, y: number, callback)
    • executes when a player collides with the tile
  • App.addOnLocationTouched(name: string, callback)
    • executes when a player collides with the location
  • App.playSound(fileName: string, loop: boolean = false)
    • plays the sound file to all players
  • App.stopSound()
    • stops the sound for all players
  • App.playSoundLink(link: string, loop: boolean = false)
    • plays the sound in the provided link to all players
  • App.runLater(callback, time: number)
    • sets the callback to be executed after the defined time

Fields

  • App.players: ScriptPlayer[]
    • gets the player list for all players in the map
  • App.playerCount: number
    • gets the player count for all players in the map