public abstract class DisplayableElementModel
extends java.lang.Object
Constructor and Description |
---|
DisplayableElementModel(boolean destructible,
boolean moving,
java.lang.String spriteName,
int priority,
boolean impactExplosive,
boolean animate,
boolean falling,
java.lang.String collideSound) |
DisplayableElementModel(boolean destructible,
boolean moving,
java.lang.String spriteName,
int priority,
boolean impactExplosive,
boolean animate,
boolean falling,
java.lang.String collideSound,
boolean convertible)
Class constructor
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getCollideSound()
Gets the collide sound of the object
|
java.lang.String |
getGroupName()
Gets the group name value
|
java.lang.String |
getPathToSprite()
Gets the path to the sprite file in storage
|
int |
getPriority()
Gets the priority of the object
|
java.awt.image.BufferedImage |
getSprite()
Gets the sprite
|
java.lang.String |
getSpriteName()
Gets the sprite name value
|
java.lang.String |
getStateValue()
Gets the state value
|
java.awt.image.BufferedImage |
grabSprite(java.awt.image.BufferedImage spriteSheet,
int x,
int y,
int width,
int height)
Grabs the sprite from the large image containing all the static sprites items
|
boolean |
isAnimate()
Gets the 'animate' value
|
boolean |
isConvertible()
Gets the convertible value of the object
|
boolean |
isDestructible()
Gets the 'destructible' value
|
boolean |
isFalling()
Gets the falling state of the object
|
boolean |
isImpactExplosive()
Gets the 'impact explosive' value
|
boolean |
isMoving()
Gets the 'moving' value
|
java.awt.image.BufferedImage |
loadSprite(java.lang.String spriteName)
Loads the target sprite
|
void |
setAnimate(boolean animate)
Sets the 'animate' value
|
void |
setCollideSound(java.lang.String collideSound)
Sets the collide sound of the object
|
void |
setConvertibleValue(boolean convertible)
Sets the convertible value of the object
|
void |
setFalling(boolean falling)
Sets the falling state of the object
|
void |
setImpactExplosive(boolean impactExplosive)
Sets the 'impact explosive' value
|
void |
setPriority(int priority)
Sets the priority of the object
|
void |
setSprite(java.awt.image.BufferedImage sprite)
Sets the sprite
|
void |
update(long currentTimeMillis)
Function to update the sprites
|
public DisplayableElementModel(boolean destructible, boolean moving, java.lang.String spriteName, int priority, boolean impactExplosive, boolean animate, boolean falling, java.lang.String collideSound, boolean convertible)
destructible
- Object destructible?moving
- Object is moving?spriteName
- Object sprite name?priority
- Object priority?impactExplosive
- Object explodes on impact?animate
- Object can be animated?public DisplayableElementModel(boolean destructible, boolean moving, java.lang.String spriteName, int priority, boolean impactExplosive, boolean animate, boolean falling, java.lang.String collideSound)
public boolean isDestructible()
public boolean isMoving()
public java.lang.String getGroupName()
public java.lang.String getStateValue()
public java.lang.String getSpriteName()
public java.lang.String getPathToSprite()
public int getPriority()
public void setPriority(int priority)
priority
- Object prioritypublic boolean isAnimate()
public void setAnimate(boolean animate)
public boolean isImpactExplosive()
public void setImpactExplosive(boolean impactExplosive)
public void setSprite(java.awt.image.BufferedImage sprite)
sprite
- Sprite objectpublic java.awt.image.BufferedImage getSprite()
public java.awt.image.BufferedImage loadSprite(java.lang.String spriteName)
spriteName
- Sprite namepublic java.awt.image.BufferedImage grabSprite(java.awt.image.BufferedImage spriteSheet, int x, int y, int width, int height)
spriteSheet
- Sprite sheet instancex
- Sub image horizontal offset on sprite sheety
- Sub image vertical offset on sprite sheetwidth
- Sub image width on sprite sheetheight
- Sub image height on sprite sheetpublic boolean isFalling()
public void setFalling(boolean falling)
falling
- Whether object is falling or notpublic java.lang.String getCollideSound()
public void setCollideSound(java.lang.String collideSound)
collideSound
- Collide soundpublic boolean isConvertible()
public void setConvertibleValue(boolean convertible)
convertible
- Convertible valuepublic void update(long currentTimeMillis)
currentTimeMillis
- Current time in milliseconds