java.lang.Object
fr.paris.saclay.sidescroller.drawables.Drawable
fr.paris.saclay.sidescroller.drawables.Terrain

public class Terrain extends Drawable
Drawable responsible for creating the terrain.
  • Constructor Details

    • Terrain

      public Terrain(GamePanel gamePanel, String theme)
      Creates a Terrain instance, saves the GamePanel reference and sets the theme (tile related to the level selected in the initial menu).
      Parameters:
      gamePanel - reference.
      theme - theme types: grass, mushroom, castle (each one related to a different level).
  • Method Details

    • update

      public void update()
      Description copied from class: Drawable
      This method is called by the GamePanel every time a new frame has to be generated. Each Drawable object is responsible for calculating its position, state and aspect (such as sprite animations) for every new frame.
      Specified by:
      update in class Drawable
    • draw

      public void draw(Graphics2D graphics2D)
      Draws the component.
      Specified by:
      draw in class Drawable
      Parameters:
      graphics2D - the rendering environment.