org.deken.game.background
Class ParallaxWrapBackground

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

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

Title: ParallaxWrapBackground

Description: A Background that scrolls as the controlling sprite moves. The background wraps when it has moved beyond its size.

Copyright: Copyright (c) Aug 20, 2014

Version:
1.0
Author:
Gary Deken

Constructor Summary
ParallaxWrapBackground(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 setControllingActor(Actor controlingActor)
           
 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 setSpeed(double speed)
           
 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

ParallaxWrapBackground

public ParallaxWrapBackground(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

setControllingActor

public void setControllingActor(Actor controlingActor)

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

setSpeed

public void setSpeed(double speed)

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

getName

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

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