Class Background
java.lang.Object
fr.paris.saclay.sidescroller.drawables.Drawable
fr.paris.saclay.sidescroller.drawables.Background
Drawable responsible for creating the background.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionBackground
(GamePanel gamePanel, String theme) Creates a Background instance, saves the GamePanel reference and sets the theme (background related to the level selected in the initial menu). -
Method Summary
Modifier and TypeMethodDescriptionvoid
draw
(Graphics2D graphics2D) Renders the component into the scene.int
Gets delta x.void
update()
Handles Background movement.Methods inherited from class fr.paris.saclay.sidescroller.drawables.Drawable
getXPosition, updatePositionToCamera
-
Constructor Details
-
Background
Creates a Background instance, saves the GamePanel reference and sets the theme (background 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()Handles Background movement. The player cannot exceed xPosition = 0 to the left and the half of the screen when walking on the right. Since the player has different speed while jumping, the camera is updated differently. -
draw
Renders the component into the scene. -
getDeltaX
public int getDeltaX()Gets delta x.- Returns:
- the delta x
-