Module hanyaeger

Interface YaegerScene

All Superinterfaces:
Activatable, Clearable, Destroyable, com.github.hanyaeger.core.scenes.DimensionsProvider, DragRepositoryAccessor, Effectable, GameNode, Initializable
All Known Implementing Classes:
DynamicScene, ScrollableDynamicScene, SplashScene, StaticScene

public interface YaegerScene extends GameNode, com.github.hanyaeger.core.scenes.DimensionsProvider, Destroyable, Initializable, Activatable, Clearable, Effectable, DragRepositoryAccessor
A YaegerScene encapsulates a scene or level from a Yaeger Game.
  • Method Details

    • setupScene

      void setupScene()
      Set up the YaegerScene. Use this method to set up all properties of the YaegerScene. The following methods are available: If a ScrollableDynamicScene is used, the following methods are also available:
    • setupEntities

      void setupEntities()
      Use this method to set up all instances of YaegerEntity that should be added to the YaegerScene before activation.

      If not only instances of YaegerEntity, but also of EntitySpawner or Timer should be added to the YaegerScene, respectively the interface EntitySpawnerContainer and TimerContainer should be implemented. These two interface will provide their own setup methods. Note that the order in which these methods are called is not deterministic.

    • postActivate

      void postActivate()
      Use this method to trigger behaviour that should be set after the YaegerScene has been completely set up.
    • setBackgroundColor

      void setBackgroundColor(javafx.scene.paint.Color color)
      Set the background color of the YaegerScene. When both the background color and a background image are set, the color is not visible.
      Parameters:
      color - the Color of the background
    • setBackgroundImage

      void setBackgroundImage(String url)
      Set the background image file. This image full be placed as the background for the entire YaegerScene and thus stretched horizontally and vertically, if necessary.

      The url of the image is relative to the resources/ folder, where all resources should be placed. If the resource is placed in a subfolder of resources/, this folder should be opened explicitly from the module descriptor.

      Parameters:
      url - the name of the image file, including extension. Although many file types are supported, the following types are preferred:
      • jpg, jpeg
      • png
    • setBackgroundImage

      void setBackgroundImage(String url, boolean fullscreen)
      Set the background image file.

      The url of the image is relative to the resources/ folder, where all resources should be placed. If the resource is placed in a subfolder of resources/, this folder should be opened explicitly from the module descriptor.

      Parameters:
      url - the name of the image file, including extension. Although many file types are supported, the following types are preferred:
      • jpg, jpeg
      • png
      fullscreen - a boolean that states whether the provided image should be displayed as fullscreen or tiled. If fullscreen is set to false the image will be its original size and tiled both horizontally and vertically.
    • setBackgroundAudio

      void setBackgroundAudio(String url)
      Set the background audio file. Currently, only *.mp3 files are supported. The audio file will be looped indefinitely, until the YaegerScene is destroyed.

      Set the background image file. The url of the image is relative to the resources/ folder, where all resources should be placed. If the resource is placed in a subfolder of resources/, this folder should be opened explicitly from the module descriptor.

      Parameters:
      url - the name of the audio file, including extension
    • setBackgroundAudioVolume

      void setBackgroundAudioVolume(double volume)
      Set the playback volume of the background audio.
      Parameters:
      volume - the volume
    • getBackgroundAudioVolume

      double getBackgroundAudioVolume()
      Return the playback volume of the background audio. This is a value between [0, 1.0], where 0 means it is not audible and 1.0 it is played at its original volume level.
      Returns:
      the volume as a double
    • stopBackgroundAudio

      void stopBackgroundAudio()
      Stop playing the background audio.
    • getScene

      javafx.scene.Scene getScene()
      Return the Scene that is encapsulated by this YaegerScene
      Returns:
      the Scene that is encapsulated by this YaegerScene
    • getStage

      javafx.stage.Stage getStage()
      Return the Stage to which this YaegerScene will be added.
      Returns:
      the Stage to which this YaegerScene will be added
    • setStage

      void setStage(javafx.stage.Stage stage)
      Set the Stage on this YaegerScene. A YaegerScene will only be added to the Stage when the YaegerScene is the one that is being shown. Only when a YaegerScene is added, its width and height are available. Thus, to make it possible to request the width and height during the YaegerScene#setupEntities() methods, we need the Stage at an earlier stage. That is why we actively set the Stage on each YaegerScene that is created.
      Parameters:
      stage - the current Stage
    • setCursor

      default void setCursor(javafx.scene.Cursor cursor)
      Set the Cursor.
      Parameters:
      cursor - the Cursor that should be used
    • getWidth

      default double getWidth()
      Return the width of this YaegerScene.
      Specified by:
      getWidth in interface com.github.hanyaeger.core.scenes.DimensionsProvider
      Returns:
      the width of this YaegerScene
    • getHeight

      default double getHeight()
      Return the height of this YaegerScene.
      Specified by:
      getHeight in interface com.github.hanyaeger.core.scenes.DimensionsProvider
      Returns:
      the height of this YaegerScene
    • setConfig

      void setConfig(YaegerConfig yaegerConfig)
      Set the YaegerConfig to be used by this YaegerScene.
      Parameters:
      yaegerConfig - the YaegerConfig to be used by this YaegerScene