public abstract class AbstractGameObject extends java.lang.Object implements java.io.Serializable, HasID
Modifier and Type | Field and Description |
---|---|
static int |
GAME_DIAGLENGTH
The game space dimension size's aequivalent to VIEW_DEPTH or VIEW_WIDTH.
|
static int |
GAME_DIAGLENGTH2
Half (1/2) of GAME_DIAGLENGTH.
|
static int |
GAME_EDGELENGTH
The game spaces dimension in pixel (edge length). 1 game meter ^= 1 GAME_EDGELENGTH
The value is calculated by VIEW_HEIGHT*sqrt(2) because of the axis shortening.
|
static int |
GAME_EDGELENGTH2
Half (1/2) of GAME_EDGELENGTH.
|
static int |
OBJECTTYPESNUM
the max. amount of different object types
|
static int |
VALUESNUM
the max. amount of different values
|
static int |
VIEW_DEPTH
Screen depth of a block/object sprite in pixels.
|
static int |
VIEW_DEPTH2
The half (1/2) of VIEW_DEPTH.
|
static int |
VIEW_DEPTH4
A quarter (1/4) of VIEW_DEPTH.
|
static int |
VIEW_HEIGHT
The height (y-axis) of the sprite size.
|
static int |
VIEW_HEIGHT2
The half (1/2) of VIEW_HEIGHT.
|
static int |
VIEW_HEIGHT4
A quarter (1/4) of VIEW_HEIGHT.
|
static int |
VIEW_WIDTH
The width (x-axis) of the sprite size.
|
static int |
VIEW_WIDTH2
The half (1/2) of VIEW_WIDTH.
|
static int |
VIEW_WIDTH4
A quarter (1/4) of VIEW_WIDTH.
|
static float |
ZAXISSHORTENING
Some magic number which is the factor by what the Z axis is distorted because of the angle pf projection.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractGameObject(byte id,
byte value)
Creates an object.
|
Modifier and Type | Method and Description |
---|---|
com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion |
getAtlasRegion()
Should i.g. not be used for rendering.
|
abstract char |
getCategory()
Get the category letter for accessing sprites.
|
com.badlogic.gdx.graphics.Color |
getColor()
get the tint of the object.
|
CoreData |
getCoreData() |
int |
getDepth(GameView view)
Returns the depth of the object.
|
abstract int |
getDimensionZ() |
static int |
getDrawCalls()
Maybe not quite correct.
|
float |
getHealth() |
byte |
getId()
returns the id of a object
|
float |
getLightlevel()
How bright is the object?
|
abstract java.lang.String |
getName()
Returns the name of the object
|
static com.badlogic.gdx.graphics.Pixmap |
getPixmap() |
abstract AbstractPosition |
getPosition()
Return the coordinates of the SelfAware object.
|
float |
getRotation()
Returns the rotation of the object.
|
float |
getScaling()
Returns the scale factor of the object.
|
static com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion |
getSprite(char category,
int id,
int value)
Returns a sprite texture.
|
int |
getSpriteId()
the id of the sprite. should be the same as id but in some cases some objects share their sprites.
|
static com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion[][][] |
getSprites() |
static com.badlogic.gdx.graphics.g2d.TextureAtlas |
getSpritesheet()
Returns the spritesheet used for rendering.
|
static java.lang.String |
getSpritesheetPath()
path of the spritesheet
|
static com.badlogic.gdx.graphics.Texture |
getTextureDiffuse()
the diffuse map
|
static com.badlogic.gdx.graphics.Texture |
getTextureNormal()
the normal map
|
byte |
getValue()
Get the value.
|
protected void |
increaseDrawCalls()
When calling sprite.draw this hsould also be called for statistics.
|
boolean |
isHidden()
Returns true, when set as hidden.
|
static void |
loadSheet()
Load the spritesheet from memory.
|
void |
render(GameView view,
Camera camera)
Draws an object in the color of the light engine and with the lightlevel.
|
void |
render(GameView view,
Camera camera,
com.badlogic.gdx.graphics.Color color)
Draws an object if it is not hidden and not clipped.
|
void |
render(GameView view,
int xPos,
int yPos)
Renders at a custom position.
|
void |
render(GameView view,
int xPos,
int yPos,
com.badlogic.gdx.graphics.Color color)
Renders at a custom position with a custom light.
|
static void |
resetDrawCalls()
Reset couner for this frame
|
void |
setColor(com.badlogic.gdx.graphics.Color color)
give the object a tint.
|
static void |
setCustomSpritesheet(java.lang.String customPath)
Set your custom spritesheet path. the suffix will be added
|
void |
setGraphicsId(int id)
the id of the sprite. should be the same as id but in some cases some objects share their sprites.
|
void |
setHealth(byte health)
clamps to [0..1000]
|
void |
setHidden(boolean hidden)
Hide an object.
|
void |
setLightlevel(float lightlevel)
Set the brightness of the object.
|
abstract void |
setPosition(AbstractPosition pos)
Set the coordinates without safety check.
|
void |
setRotation(float rotation) |
void |
setScaling(float scaling) |
void |
setValue(byte value)
Set the value of the object.
|
static void |
staticDispose()
disposes static fields
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isObstacle, isTransparent
public static final transient int VIEW_DEPTH
public static final transient int VIEW_DEPTH2
public static final transient int VIEW_DEPTH4
public static final transient int VIEW_WIDTH
public static final transient int VIEW_WIDTH2
public static final transient int VIEW_WIDTH4
public static final transient int VIEW_HEIGHT
public static final transient int VIEW_HEIGHT2
public static final transient int VIEW_HEIGHT4
public static final transient int GAME_DIAGLENGTH
public static final transient int GAME_DIAGLENGTH2
public static final transient int GAME_EDGELENGTH
public static final transient int GAME_EDGELENGTH2
public static final transient float ZAXISSHORTENING
public static final transient int OBJECTTYPESNUM
public static final transient int VALUESNUM
protected AbstractGameObject(byte id, byte value)
id
- the id of the objectvalue
- public abstract char getCategory()
public abstract int getDimensionZ()
public abstract AbstractPosition getPosition()
public abstract void setPosition(AbstractPosition pos)
pos
- the coordinates you want to setpublic static com.badlogic.gdx.graphics.Texture getTextureDiffuse()
public static com.badlogic.gdx.graphics.Texture getTextureNormal()
public static void setCustomSpritesheet(java.lang.String customPath)
customPath
- format like "com/BombingGames/WurfelEngine/Core/images/Spritesheet" without suffixpublic static java.lang.String getSpritesheetPath()
public int getDepth(GameView view)
view
- public static com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion[][][] getSprites()
public static void resetDrawCalls()
public static int getDrawCalls()
protected void increaseDrawCalls()
public static void loadSheet()
public static com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion getSprite(char category, int id, int value)
category
- the category of the sprite e.g. "b" for blocksid
- the id of the objectvalue
- the value of the objectpublic static com.badlogic.gdx.graphics.g2d.TextureAtlas getSpritesheet()
public static com.badlogic.gdx.graphics.Pixmap getPixmap()
public void render(GameView view, Camera camera)
view
- the view using this render methodcamera
- The camera rendering the scenepublic void render(GameView view, Camera camera, com.badlogic.gdx.graphics.Color color)
view
- the view using this render methodcamera
- The camera rendering the scenecolor
- custom blending colorpublic void render(GameView view, int xPos, int yPos)
view
- xPos
- rendering position, center of sprite in projection (?) spaceyPos
- rendering position, center of sprite in projection (?) spacepublic void render(GameView view, int xPos, int yPos, com.badlogic.gdx.graphics.Color color)
view
- xPos
- rendering position, center of sprite in projection space (?)yPos
- rendering position, center of sprite in projection space (?)color
- color which gets multiplied with the tint. No change ( multiply with 1) is RGBA 0x80808080.public CoreData getCoreData()
public byte getId()
HasID
public byte getValue()
HasID
public int getSpriteId()
public float getLightlevel()
HasID
getLightlevel
in interface HasID
public abstract java.lang.String getName()
public float getRotation()
public float getScaling()
public boolean isHidden()
public void setLightlevel(float lightlevel)
HasID
setLightlevel
in interface HasID
lightlevel
- 1 is default bright. 0 is black.public void setValue(byte value)
value
- public void setHidden(boolean hidden)
hidden
- public void setRotation(float rotation)
rotation
- set the rotation in degrees.public void setScaling(float scaling)
scaling
- 0 no scalingpublic void setGraphicsId(int id)
id
- public static void staticDispose()
public float getHealth()
public void setHealth(byte health)
health
- public void setColor(com.badlogic.gdx.graphics.Color color)
color
- public com.badlogic.gdx.graphics.Color getColor()
public com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion getAtlasRegion()