JSM Developer API Documentation
    Preparing search index...

    Class Game

    This class contains functions for general game management.

    Index

    Methods

    • Saves the level and exits the game cleanly.

      Returns void

    • Retrieve the current game frames per second (FPS)

      Returns number

      The frame rate

    • Check if a key is being held down

      Parameters

      • key: Key

        The key to check

      Returns boolean

    • Check if the world was just generated. This can be used to make sure custom world generation won't override a saved level.

      Returns boolean

      True if the world was generated on the same launch, otherwise false

    • Change the currently selected block. The selected block is what is used when the player places a block.

      Parameters

      • block: Block

        The new selected block

      Returns void