org.deken.game.background
Class ParallaxBackground

java.lang.Object
  extended by org.deken.game.background.ParallaxBackground
All Implemented Interfaces:
Background, Parallax, Updateable

public class ParallaxBackground
extends java.lang.Object
implements Background, Parallax

Title: ParallaxBackground

Description: A Background that scrolls as the controlling sprite moves. The background's limits is the full size of the image, as in it does not wrap.

Copyright: Copyright (c) Aug 16, 2014

Version:
1.0
Author:
Gary Deken

Constructor Summary
ParallaxBackground(Animation animation)
           
 
Method Summary
 void addAnimation(Animation animation)
           
 void draw(java.awt.Graphics2D graphics, int xOffset, int yOffset)
          Draws the back ground based on the current offset of the map, and the Backgrounds equation for calculating its position.
 java.lang.String getName()
           
 void setControllingSprite(Sprite controlingSprite)
           
 void setMapSize(MapSize mapSize)
          Set the map size, so the back ground can be adjusted accordingly.
 void setParallaxOffset(ParallaxOffset offset)
           
 void setScreenSize(int width, int height)
          Set the screen size, so the back ground can be adjusted accordingly.
 void update(long elapseTime)
          This method takes the elapse time, and calculates the new current frame of the animation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParallaxBackground

public ParallaxBackground(Animation animation)
Method Detail

addAnimation

public void addAnimation(Animation animation)
Specified by:
addAnimation in interface Background

draw

public void draw(java.awt.Graphics2D graphics,
                 int xOffset,
                 int yOffset)
Description copied from interface: Background
Draws the back ground based on the current offset of the map, and the Backgrounds equation for calculating its position.

Specified by:
draw in interface Background
xOffset - int
yOffset - int

getName

public java.lang.String getName()
Specified by:
getName in interface Updateable
Returns:

setControllingSprite

public void setControllingSprite(Sprite controlingSprite)

setScreenSize

public void setScreenSize(int width,
                          int height)
Description copied from interface: Background
Set the screen size, so the back ground can be adjusted accordingly.

Specified by:
setScreenSize in interface Background
Parameters:
width - int
height - int

setMapSize

public void setMapSize(MapSize mapSize)
Description copied from interface: Background
Set the map size, so the back ground can be adjusted accordingly.

Specified by:
setMapSize in interface Background
Parameters:
mapSize - int

setParallaxOffset

public void setParallaxOffset(ParallaxOffset offset)
Specified by:
setParallaxOffset in interface Parallax

update

public void update(long elapseTime)
Description copied from interface: Updateable
This method takes the elapse time, and calculates the new current frame of the animation.

Specified by:
update in interface Updateable
Parameters:
elapseTime - long