Class SpriteBasedEntity<T extends SpriteBasedEntity<?>>
java.lang.Object
com.codingame.gameengine.module.entities.Entity<T>
com.codingame.gameengine.module.entities.BlendableEntity<T>
com.codingame.gameengine.module.entities.TextureBasedEntity<T>
com.codingame.gameengine.module.entities.SpriteBasedEntity<T>
- All Implemented Interfaces:
Mask
- Direct Known Subclasses:
Sprite
,TilingSprite
public abstract class SpriteBasedEntity<T extends SpriteBasedEntity<?>>
extends TextureBasedEntity<T>
implements Mask
A Sprite is a graphical entity which displays an image. That image must be loaded into the viewer's texture cache, which you can configure by
adding files to the
assets
folder of your game's project.-
Nested Class Summary
Nested classes/interfaces inherited from class com.codingame.gameengine.module.entities.BlendableEntity
BlendableEntity.BlendMode
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the image base height for thisSprite
.Returns the image base width for thisSprite
.getImage()
Returns the name of the image used for thisSprite
.Returns the scale mode of thisTextureBasedEntity
.setBaseHeight
(int baseHeight) Sets the image base height for thisSprite
.setBaseWidth
(int baseWidth) Sets the image base width for thisSprite
.Sets the image for thisSprite
.setScaleMode
(ScaleMode scaleMode) Sets the scale mode of thisTextureBasedEntity
.Methods inherited from class com.codingame.gameengine.module.entities.TextureBasedEntity
getAnchorX, getAnchorY, getTint, setAnchor, setAnchorX, setAnchorX, setAnchorY, setAnchorY, setTint, setTint
Methods inherited from class com.codingame.gameengine.module.entities.BlendableEntity
getBlendMode, setBlendMode
Methods inherited from class com.codingame.gameengine.module.entities.Entity
getAlpha, getId, getMask, getParent, getRotation, getScaleX, getScaleY, getSkewX, getSkewY, getX, getY, getZIndex, isVisible, requireValidAlpha, requireValidColor, self, set, set, setAlpha, setAlpha, setMask, setMask, setRotation, setRotation, setScale, setScale, setScaleX, setScaleX, setScaleY, setScaleY, setSkewX, setSkewX, setSkewY, setSkewY, setVisible, setX, setX, setY, setY, setZIndex
-
Constructor Details
-
SpriteBasedEntity
public SpriteBasedEntity()
-
-
Method Details
-
setImage
Sets the image for thisSprite
.You must either:
- use the filename of an image relative to the assets folder of the Java project.
- use the a player's nickname token.
- Parameters:
image
- the name of the image to use for thisSprite
.- Returns:
- this
Sprite
.
-
setBaseWidth
Sets the image base width for thisSprite
. If not set, the image base width is the real image width.- Parameters:
baseWidth
- image width- Returns:
- this
Sprite
.
-
setBaseHeight
Sets the image base height for thisSprite
. If not set, the image base height is the real image height.- Parameters:
baseHeight
- image height- Returns:
- this
Sprite
.
-
getImage
Returns the name of the image used for thisSprite
.Can be a player's nickname token.
- Returns:
- the name of the image used for this
Sprite
-
getBaseWidth
Returns the image base width for thisSprite
. If not set, the image base width is the real image width, but this will return null.- Returns:
- the image base width for this
Sprite
.
-
getBaseHeight
Returns the image base height for thisSprite
. If not set, the image base height is the real image height, but this will return null.- Returns:
- the image base height for this
Sprite
.
-
setScaleMode
Sets the scale mode of thisTextureBasedEntity
.Default is LINEAR.
- Parameters:
scaleMode
- the scale mode of thisTextureBasedEntity
.- Returns:
- this
TextureBasedEntity
.
-
getScaleMode
Returns the scale mode of thisTextureBasedEntity
.Default is LINEAR.
- Returns:
- the scale mode of this
TextureBasedEntity
.
-