public class RenderBlock extends AbstractGameObject
CoreData
,
Serialized FormGAME_DIAGLENGTH, GAME_DIAGLENGTH2, GAME_EDGELENGTH, GAME_EDGELENGTH2, OBJECTTYPESNUM, VALUESNUM, VIEW_DEPTH, VIEW_DEPTH2, VIEW_DEPTH4, VIEW_HEIGHT, VIEW_HEIGHT2, VIEW_HEIGHT4, VIEW_WIDTH, VIEW_WIDTH2, VIEW_WIDTH4, ZAXISSHORTENING
Constructor and Description |
---|
RenderBlock(byte id) |
RenderBlock(byte id,
byte value) |
Modifier and Type | Method and Description |
---|---|
static com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion |
getBlockSprite(int id,
int value,
Side side)
Returns a sprite sprite of a specific side of the block
|
static com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion[][][] |
getBlocksprites() |
char |
getCategory()
Get the category letter for accessing sprites.
|
int |
getDimensionZ() |
java.lang.String |
getName()
Returns the name of the object
|
Coordinate |
getPosition()
Return the coordinates of the SelfAware object.
|
static com.badlogic.gdx.graphics.Color |
getRepresentingColor(byte id,
byte value)
Returns a color representing the block.
|
boolean |
hasSides()
Is the block a true block with three sides or does it get rendered by a single sprite?
|
boolean |
hidingPastBlock()
hides the block after it?
|
boolean |
isClipped()
a block is only clipped if every side is clipped
|
boolean |
isObstacle()
Is this object an obstacle or can you pass through?
|
boolean |
isTransparent()
Can light travel through object?
|
void |
onDestroy()
Overwrite to define what should happen (view only) if the block is getting destroyed?
|
void |
render(GameView view,
Camera camera)
Draws an object in the color of the light engine and with the lightlevel.
|
void |
render(GameView view,
int xPos,
int yPos)
Render the whole block at a custom position.
|
void |
render(GameView view,
int xPos,
int yPos,
com.badlogic.gdx.graphics.Color color,
boolean staticShade)
Renders the whole block at a custom position.
|
void |
renderSide(GameView view,
Camera camera,
AbstractPosition coords,
Side side,
boolean staticShade)
Render a side of a block at the position of the coordinates.
|
void |
renderSide(View view,
int xPos,
int yPos,
Side side)
Ignores lightlevel.
|
void |
renderSide(View view,
int xPos,
int yPos,
Side side,
com.badlogic.gdx.graphics.Color color)
Draws a side of a block at a custom position.
|
void |
setClippedLeft() |
void |
setClippedRight() |
void |
setClippedTop() |
static void |
setDestructionSound(java.lang.String destructionSound)
set the sound to be played if a block gets destroyed.
|
void |
setHasSides(boolean hasSides)
Is the block a true block with three sides or does it get rendered by a single sprite?
|
void |
setPosition(AbstractPosition pos)
Set the coordinates without safety check.
|
RenderBlock |
spawn(Coordinate coord)
places the object on the map.
|
static void |
staticDispose() |
CoreData |
toStorageBlock()
gets the identifier and stores them in the map
|
void |
update(float dt)
Update the block.
|
getAtlasRegion, getColor, getCoreData, getDepth, getDrawCalls, getHealth, getId, getLightlevel, getPixmap, getRotation, getScaling, getSprite, getSpriteId, getSprites, getSpritesheet, getSpritesheetPath, getTextureDiffuse, getTextureNormal, getValue, increaseDrawCalls, isHidden, loadSheet, render, render, resetDrawCalls, setColor, setCustomSpritesheet, setGraphicsId, setHealth, setHidden, setLightlevel, setRotation, setScaling, setValue
public RenderBlock(byte id)
id
- public RenderBlock(byte id, byte value)
public boolean isObstacle()
HasID
public void setClippedLeft()
public void setClippedRight()
public void setClippedTop()
public boolean isClipped()
public static com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion[][][] getBlocksprites()
public static void setDestructionSound(java.lang.String destructionSound)
destructionSound
- public static void staticDispose()
public java.lang.String getName()
AbstractGameObject
getName
in interface HasID
getName
in class AbstractGameObject
public RenderBlock spawn(Coordinate coord)
coord
- the position on the mappublic static com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion getBlockSprite(int id, int value, Side side)
id
- the id of the blockvalue
- the value of teh blockside
- Which side?public static com.badlogic.gdx.graphics.Color getRepresentingColor(byte id, byte value)
id
- id of the RenderBlockvalue
- the value of the block.public boolean hasSides()
public void setHasSides(boolean hasSides)
hasSides
- true if it has sides, false if is rendered as a single spritepublic void render(GameView view, Camera camera)
AbstractGameObject
render
in class AbstractGameObject
view
- the view using this render methodcamera
- The camera rendering the scenepublic void render(GameView view, int xPos, int yPos)
render
in class AbstractGameObject
view
- the view using this render methodxPos
- rendering position (screen)yPos
- rendering position (screen)public void render(GameView view, int xPos, int yPos, com.badlogic.gdx.graphics.Color color, boolean staticShade)
view
- the view using this render methodxPos
- rendering positionyPos
- rendering positioncolor
- when the block has sides its sides gets shaded using this color.staticShade
- makes one side brighter, opposite side darkerpublic void renderSide(GameView view, Camera camera, AbstractPosition coords, Side side, boolean staticShade)
view
- the view using this render methodcamera
- coords
- the coordinates where to renderside
- The number identifying the side. 0=left, 1=top, 2=rightstaticShade
- public void renderSide(View view, int xPos, int yPos, Side side)
view
- the view using this render methodxPos
- rendering positionyPos
- rendering positionside
- The number identifying the side. 0=left, 1=top, 2=rightpublic void renderSide(View view, int xPos, int yPos, Side side, com.badlogic.gdx.graphics.Color color)
view
- the view using this render methodxPos
- rendering positionyPos
- rendering positionside
- The number identifying the side. 0=left, 1=top, 2=rightcolor
- a tint in which the sprite gets rendered. If null lightlevel gets ignoredpublic void update(float dt)
dt
- time in ms since last updatepublic char getCategory()
AbstractGameObject
getCategory
in class AbstractGameObject
public int getDimensionZ()
getDimensionZ
in class AbstractGameObject
public void onDestroy()
public Coordinate getPosition()
AbstractGameObject
getPosition
in class AbstractGameObject
public void setPosition(AbstractPosition pos)
AbstractGameObject
setPosition
in class AbstractGameObject
pos
- the coordinates you want to setpublic CoreData toStorageBlock()
public boolean hidingPastBlock()
public boolean isTransparent()
HasID