Skip to content

Asset Structure

LSon edited this page Jul 9, 2024 · 13 revisions

All CodePieces (The methods that are displayed in the Levels and can be changed) are loaded from files in the GitAssetLoader.

CodeVariant

For each method in the game, you define multiple CodeVariant's.

It contains:

  • initialCode: The code that is displayed at the beginning of the level. When hitting the Reset button, the user code will be replaced with this code
  • solutionCode: This acts as a guide if the user is stuck and presses the Show Solution button. The user code is not assessed by this. For user code assessment, refer to Adding a new Level.

For each CodeVariant, you set a Chapter number and Level number that refer to a level, from which onwards the CodeVariant is used. If a 'newer' CodeVariant exists for a game method, this is used instead.

If a CodeVariant needs do be displayed but not changed, it should be set to readOnly you can set it in your file for the CodePiece. A CodeVariant is automatically set to readOnly if it only has initialCode.

Defining a CodePiece

We define all CodeVariants for a CodePiece in a single plaintext file.

The separator for this file format is ° (the degrees symbol).

The structure of the files is as follows.

  • method head (this is set per-CodePiece and cannot be changed in a CodeVariant)

  • °°°°° (separator five times)

  • CodeVariant

  • °°°°° (separator five times)

  • CodeVariant

  • ...

  • °°°°° (separator five times)

Defining a CodeVariant

  • Chapter number

  • Level number

  • °°

  • initialCode

  • °°

  • solutionCode(This part, as well as the "°°" before is missing in a CodeVariant that is readOnly)

Adding a new CodePiece

Don't forget to add your new assets to /assets/methodIndex.txt. A CodePiece for it will then be automatically created.