Package com.dragonboatrace.entities
Class Entity
- java.lang.Object
-
- com.dragonboatrace.entities.Entity
-
- Direct Known Subclasses:
Boat,Button,Collidable,FinishLine
public abstract class Entity extends java.lang.ObjectRepresents a generic Entity.
-
-
Field Summary
Fields Modifier and Type Field Description protected HitboxhitboxThe hit box of the entity.protected com.badlogic.gdx.math.Vector2positionThe position of the entity.protected com.badlogic.gdx.graphics.TexturetextureThe texture of the entity.protected EntityTypetypeWhat kind of entity it is.protected com.badlogic.gdx.math.Vector2velocityThe velocity of the entity.
-
Constructor Summary
Constructors Constructor Description Entity(com.badlogic.gdx.math.Vector2 position, com.badlogic.gdx.math.Vector2 velocity, EntityType type, java.lang.String texture)Creates a new Entity at a position with a starting velocity, a entity type and a texture.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Dispose of the texture used when finished.booleanequals(java.lang.Object obj)HitboxgetHitBox()The hit box of the entity.com.badlogic.gdx.graphics.TexturegetTexture()The texture of the entity.voidrender(com.badlogic.gdx.graphics.g2d.SpriteBatch batch)Render the entities texture.voidrestore(java.lang.String name)voidsave(java.lang.String name)
-
-
-
Field Detail
-
position
protected com.badlogic.gdx.math.Vector2 position
The position of the entity.
-
velocity
protected com.badlogic.gdx.math.Vector2 velocity
The velocity of the entity.
-
type
protected EntityType type
What kind of entity it is.
-
texture
protected com.badlogic.gdx.graphics.Texture texture
The texture of the entity.
-
hitbox
protected Hitbox hitbox
The hit box of the entity.
-
-
Constructor Detail
-
Entity
public Entity(com.badlogic.gdx.math.Vector2 position, com.badlogic.gdx.math.Vector2 velocity, EntityType type, java.lang.String texture)Creates a new Entity at a position with a starting velocity, a entity type and a texture.- Parameters:
position- The initial position of the entity.velocity- The initial velocity of the entity.type- The type of entity.texture- The texture of the entity.
-
-
Method Detail
-
dispose
public void dispose()
Dispose of the texture used when finished.
-
render
public void render(com.badlogic.gdx.graphics.g2d.SpriteBatch batch)
Render the entities texture.- Parameters:
batch- The SpriteBatch to be added to.
-
getTexture
public com.badlogic.gdx.graphics.Texture getTexture()
The texture of the entity.- Returns:
- A Texture that represents the entity.
-
getHitBox
public Hitbox getHitBox()
The hit box of the entity.- Returns:
- A hit box of the entity.
-
restore
public void restore(java.lang.String name)
-
save
public void save(java.lang.String name)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-