com.golden.gamedev.genre.platform
Class PlatformSprite

java.lang.Object
  |
  +--com.golden.gamedev.object.Sprite
        |
        +--com.golden.gamedev.genre.platform.PlatformSprite

public abstract class PlatformSprite
extends Sprite

Rush sprite development, for now this type of sprite is working perfectly, but it use some inefficient technique (and complex), maybe not supported in the future.

Designed to hold platform type of game sprite, there are sprite direction, state of the sprite, and the image frame is fully controlable by the subclass of this class.


Field Summary
 
Fields inherited from class com.golden.gamedev.object.Sprite
height, speedX, speedY, width
 
Constructor Summary
PlatformSprite(int w, int h)
           
PlatformSprite(int x, int y, int w, int h)
           
 
Method Summary
 Timer getAnimationTimer()
           
 int getDirection()
           
protected  int getFrame()
           
 BufferedImage getImage()
           
protected abstract  BufferedImage getImage(int direction, int status, int frame)
           
 int getStatus()
           
protected  boolean nextFrame(int end)
           
protected  boolean nextFrame(int start, int end)
           
protected  boolean prevFrame(int end)
           
protected  boolean prevFrame(int start, int end)
           
 void render(Graphics2D g, int x, int y)
           
 void setAnimationTimer(Timer t)
           
 void setDirection(int dir)
           
 void setDirection(int dir, int startFrame)
           
protected  void setFrame(int i)
           
 void setStatus(int stat)
           
 void setStatus(int stat, int startFrame)
           
 void update()
           
protected abstract  void updateAnimation(int direction, int status, int frame)
           
 
Methods inherited from class com.golden.gamedev.object.Sprite
forceX, forceY, getBackground, getHeight, getID, getLayer, getMovementTimer, getOldX, getOldY, getScreenX, getScreenY, getSpeedX, getSpeedY, getWidth, getX, getY, isActive, isOnScreen, isOnScreen, move, moveX, moveY, render, setActive, setBackground, setID, setImage, setLayer, setLocation, setMovementTimer, setSpeed, setSpeedX, setSpeedY, setX, setY, updateMovement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlatformSprite

public PlatformSprite(int x,
                      int y,
                      int w,
                      int h)

PlatformSprite

public PlatformSprite(int w,
                      int h)
Method Detail

update

public void update()
Overrides:
update in class Sprite

updateAnimation

protected abstract void updateAnimation(int direction,
                                        int status,
                                        int frame)

getImage

protected abstract BufferedImage getImage(int direction,
                                          int status,
                                          int frame)

getImage

public BufferedImage getImage()
Overrides:
getImage in class Sprite

render

public void render(Graphics2D g,
                   int x,
                   int y)
Overrides:
render in class Sprite

getFrame

protected int getFrame()

setFrame

protected void setFrame(int i)

nextFrame

protected boolean nextFrame(int start,
                            int end)

nextFrame

protected boolean nextFrame(int end)

prevFrame

protected boolean prevFrame(int start,
                            int end)

prevFrame

protected boolean prevFrame(int end)

getStatus

public int getStatus()

setStatus

public void setStatus(int stat)

setStatus

public void setStatus(int stat,
                      int startFrame)

getDirection

public int getDirection()

setDirection

public void setDirection(int dir)

setDirection

public void setDirection(int dir,
                         int startFrame)

setAnimationTimer

public void setAnimationTimer(Timer t)

getAnimationTimer

public Timer getAnimationTimer()