Module StageBuilder

Used to configure stage properties before the game starts. These functions do nothing after the stage's configure function completes execution.

Functions

addShip (shipFilename) Adds a ship to the stage.
addStart (x, y) Adds a start location to the stage.
addWall (left, bottom, width, height) Adds a wall to the stage.
addZone (left, bottom, width, height, tag) Adds a zone to the stage.
setBattleMode (enabled) Sets whether battle mode is enabled.
setSize (width, height) Sets the width and height of the stage.
setTeamSize (teamSize) Sets the team size.


Functions

addShip (shipFilename)

Adds a ship to the stage. The ship begins the match and each round as inactive - the stage must call reviveShip before it can be used. The isStageShip function (in Ship) or property (in EnemyShip) allow stages and ships to see which ships were loaded by the stage. Otherwise, stage-loaded ships function exactly like all other ships.

Parameters

  • shipFilename: The path/filename of the ship program, relative to the stage program.

See also:

addStart (x, y)

Adds a start location to the stage. Start locations are given to ships in the same order that they are added, at the start of the game and each round. In the absence of a pre-defined start location, a ship is placed in a random location. In either case, if the ship's location intersects with a wall, the location is shifted randomly until it doesn't.

Parameters

  • x: The x coordinate of the start location.
  • y: The y coordinate of the start location.
addWall (left, bottom, width, height)

Adds a wall to the stage. Lasers stop at walls, ships bounce off of walls, and ships cannot see ships or events through walls. Torpedos travel through walls.

Parameters

  • left: The x coordinate of the left side of the wall.
  • bottom: The y coordinate of the bottom side of the wall.
  • width: The width of the wall.
  • height: The height of the wall.

See also:

addZone (left, bottom, width, height, tag)

Adds a zone to the stage. Zones are displayed on the screen and ships are told where all zones are at the start of the game. Zones have no pre-defined behavior; a stage can use a zone in any way it likes as part of its gameplay. For instance, touching a zone is the goal of a maze stage, while it destroys a ship on a joust stage.

Parameters

  • left: The x coordinate of the left side of the zone.
  • bottom: The y coordinate of the bottom side of the zone.
  • width: The width of the zone.
  • height: The height of the zone.
  • tag: (optional) The tag string associated with this zone.

See also:

setBattleMode (enabled)

Sets whether battle mode is enabled. (Default: false.) When battle mode is disabled, laser guns, torpedo guns, and energy tracking are all disabled. Ships can only move around, and ships are only destroyed or revived directly by the stage program.

Parameters

  • enabled: true to enable battle mode, false to disable battle mode.
setSize (width, height)

Sets the width and height of the stage.

Parameters

  • width: The width of the stage.
  • height: The height of the stage.
setTeamSize (teamSize)

Sets the team size. Each user loaded ship program is given this many ships. Stage ship programs are loaded with one ship, regardless of team size.

Parameters

  • teamSize: The number of ships to assign to each user ship control program.

See also: