Class Entity

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Hitbox hitbox
      The hit box of the entity.
      protected com.badlogic.gdx.math.Vector2 position
      The position of the entity.
      protected com.badlogic.gdx.graphics.Texture texture
      The texture of the entity.
      protected EntityType type
      What kind of entity it is.
      protected com.badlogic.gdx.math.Vector2 velocity
      The 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
      void dispose()
      Dispose of the texture used when finished.
      boolean equals​(java.lang.Object obj)  
      Hitbox getHitBox()
      The hit box of the entity.
      com.badlogic.gdx.graphics.Texture getTexture()
      The texture of the entity.
      void render​(com.badlogic.gdx.graphics.g2d.SpriteBatch batch)
      Render the entities texture.
      void restore​(java.lang.String name)  
      void save​(java.lang.String name)  
      • Methods inherited from class java.lang.Object

        clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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:
        equals in class java.lang.Object