Skip to content
The Ghost in the Machine edited this page Jan 22, 2018 · 7 revisions

Ships

Every ship lives under the /moduleName/assets/ships directory, in it's own subfolder. To define a ship, you need to provide 3 files - a configuration file (shipName.json), a ship icon (shipNameIcon.png) and a texture (shipName.png). As things stand, the texture is a power-of-two (128x128, 256x256 or 512x512, depending on the size of ship) colored sprite with transparency, whereas the ship icon is a scaled down (32x32) black-and-white version of the texture.

Here is the JSON file for Imperial Tiny, we'll be using it as an example.

The configuration is a JSON file, consisting of the following attributes:

  • size: A float representing the scale of the ship sprite in-game.
  • maxLife: An integer representing the maximum hp of the ship.
  • type: A string representing the class of the ship. All ships will have the "std" type, whereas the Capital ships will have the "big" type.
  • price: An integer representing how expensive the costs ship in-game.
  • ability: A JSON object of the form described in this wiki page.
  • e1Pos, e2Pos: Where the particles should come out for the engine. You can get the positions for this by dividing the x coordinate of the pixel you choose by the length of the texture and the y by the height. Example: "e1Pos": "0.1 0.2"
  • displayName: A string representing the user-friendly name of the ship.
  • engine: A fully qualified (for instance, core:implerialEngine) engine name.
  • gunSlots: The gun slots are where the guns for the ship should be placed. You can find the position that same way you did for the e1Pos and e2Pos attributes. There can be up to two gun slots.
  • rigidBody: The collision hull of the ship. Can be exported via the Physics Body Editor.