Class GameScript

java.lang.Object
de.gurkenlabs.litiengine.scripting.AbstractScript<Object>
de.gurkenlabs.litiengine.scripting.GameScript
All Implemented Interfaces:
ScriptInstance

public abstract class GameScript extends AbstractScript<Object>
Base class for scripts attached to the game lifecycle.
  • Constructor Details

    • GameScript

      public GameScript()
  • Method Details

    • attached

      protected final void attached() throws Exception
      Description copied from class: AbstractScript
      Called after the context is installed and the script becomes active.
      Overrides:
      attached in class AbstractScript<Object>
      Throws:
      Exception - if initialization fails.
    • detached

      protected final void detached() throws Exception
      Description copied from class: AbstractScript
      Called before context-owned resources are released.
      Overrides:
      detached in class AbstractScript<Object>
      Throws:
      Exception - if cleanup fails.
    • onStarted

      protected void onStarted() throws Exception
      Called after the binding enters the running game lifecycle.
      Throws:
      Exception
    • onStopped

      protected void onStopped() throws Exception
      Called before the binding leaves the game lifecycle.
      Throws:
      Exception
    • loadMap

      public void loadMap(String mapName)
      Loads an environment map by map name.
    • loadMap

      public void loadMap(IMap map)
      Loads an environment map.
    • playSound

      public void playSound(String soundName)
      Plays a sound effect by resource name.
    • playMusic

      public void playMusic(String musicName)
      Plays a background music track by resource name.
    • stopMusic

      public void stopMusic()
      Stops currently playing music.
    • exit

      public void exit()
      Exits and terminates the game.