GTGE API

com.golden.gamedev.object.sprite
Class PatternSprite

java.lang.Object
  extended by com.golden.gamedev.object.Sprite
      extended by com.golden.gamedev.object.sprite.PatternSprite
All Implemented Interfaces:
Serializable

public class PatternSprite
extends Sprite

Sprite that its images is taken from another sprite (the pattern).

PatternSprite is used to make a number of sprite that share same images and to have same animation sequence.
A sprite that not created in a same time will have a different animation sequence (the new sprite will start with the first frame animation, and the old one perhaps at the last animation). This kind of sprite will assure that pattern sprites that have same pattern will animated in the same sequence.

Note: Don't forget to update the pattern sprite in order to keep the pattern animate.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.golden.gamedev.object.Sprite
height, width
 
Constructor Summary
PatternSprite(Sprite pattern)
          Creates new PatternSprite with specified pattern.
PatternSprite(Sprite pattern, double x, double y)
          Creates new PatternSprite with specified pattern and coordinate.
 
Method Summary
 Sprite getPattern()
          Returns the pattern sprite associates with this sprite.
 void render(Graphics2D g, int x, int y)
          Renders sprite image to specified graphics context and specified location.
 void setPattern(Sprite pattern)
          Sets the pattern of this sprite.
 
Methods inherited from class com.golden.gamedev.object.Sprite
addHorizontalSpeed, addVerticalSpeed, forceX, forceY, getBackground, getDataID, getDistance, getHeight, getHorizontalSpeed, getID, getImage, getLayer, getOldX, getOldY, getScreenX, getScreenY, getVerticalSpeed, getWidth, getX, getY, isActive, isImmutable, isOnScreen, isOnScreen, move, moveTo, moveX, moveY, render, setActive, setBackground, setDataID, setHorizontalSpeed, setID, setImage, setImmutable, setLayer, setLocation, setMovement, setSpeed, setVerticalSpeed, setX, setY, update, updateMovement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatternSprite

public PatternSprite(Sprite pattern,
                     double x,
                     double y)
Creates new PatternSprite with specified pattern and coordinate.


PatternSprite

public PatternSprite(Sprite pattern)
Creates new PatternSprite with specified pattern.

Method Detail

render

public void render(Graphics2D g,
                   int x,
                   int y)
Description copied from class: Sprite
Renders sprite image to specified graphics context and specified location.

Overrides:
render in class Sprite
Parameters:
g - graphics context
x - screen x-coordinate
y - screen y-coordinate

getPattern

public Sprite getPattern()
Returns the pattern sprite associates with this sprite.


setPattern

public void setPattern(Sprite pattern)
Sets the pattern of this sprite.


GTGE API

Copyright © 2003-2005 Golden T Studios. All rights reserved. Use is subject to license terms.
GoldenStudios.or.id