Class GameObject

  • Direct Known Subclasses:
    Bullet, Entity, StatBar, WaterStream

    public abstract class GameObject
    extends java.lang.Object
    Basic object for all displayable objects
    Author:
    Riju De
    • Constructor Summary

      Constructors 
      Constructor Description
      GameObject​(com.badlogic.gdx.math.Vector2 spawnPos, com.badlogic.gdx.graphics.Texture image, com.badlogic.gdx.math.Vector2 imSize)  
    • Method Summary

      Modifier and Type Method Description
      void changePosition​(com.badlogic.gdx.math.Vector2 v)
      changes current position by vector v
      void die()  
      com.badlogic.gdx.math.Vector2 getCentre()
      Return centre of GameObject
      float getHeight()  
      float getOriginX()  
      float getOriginY()  
      com.badlogic.gdx.math.Vector2 getPosition()  
      float getRotation()  
      com.badlogic.gdx.graphics.g2d.Sprite getSprite()  
      com.badlogic.gdx.graphics.Texture getTexture()  
      int getTextureHeight()  
      int getTextureWidth()  
      float getWidth()  
      float getX()  
      float getXScale()  
      float getY()  
      float getYScale()  
      boolean isDisplayable()  
      java.lang.Boolean isRemove()  
      void render​(com.badlogic.gdx.graphics.g2d.SpriteBatch batch)
      Render the object.
      void setPosition​(com.badlogic.gdx.math.Vector2 pos)  
      void setRemove​(java.lang.Boolean x)  
      void setRotation​(float degrees)
      sets direction "degrees" to the direction currently facing
      abstract void update()
      Called every frame.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GameObject

        public GameObject​(com.badlogic.gdx.math.Vector2 spawnPos,
                          com.badlogic.gdx.graphics.Texture image,
                          com.badlogic.gdx.math.Vector2 imSize)
    • Method Detail

      • update

        public abstract void update()
        Called every frame. Update the game object.
      • render

        public void render​(com.badlogic.gdx.graphics.g2d.SpriteBatch batch)
        Render the object.
        Parameters:
        batch - Batch to render
      • changePosition

        public void changePosition​(com.badlogic.gdx.math.Vector2 v)
        changes current position by vector v
        Parameters:
        v - Vector to move
      • getTexture

        public com.badlogic.gdx.graphics.Texture getTexture()
      • getHeight

        public float getHeight()
      • getWidth

        public float getWidth()
      • getX

        public float getX()
      • getY

        public float getY()
      • isRemove

        public java.lang.Boolean isRemove()
      • getOriginX

        public float getOriginX()
      • getOriginY

        public float getOriginY()
      • getXScale

        public float getXScale()
      • getYScale

        public float getYScale()
      • getRotation

        public float getRotation()
      • getTextureWidth

        public int getTextureWidth()
      • getTextureHeight

        public int getTextureHeight()
      • getSprite

        public com.badlogic.gdx.graphics.g2d.Sprite getSprite()
      • getPosition

        public com.badlogic.gdx.math.Vector2 getPosition()
      • isDisplayable

        public boolean isDisplayable()
      • getCentre

        public com.badlogic.gdx.math.Vector2 getCentre()
        Return centre of GameObject
        Returns:
        Centre of GameObject
      • setPosition

        public void setPosition​(com.badlogic.gdx.math.Vector2 pos)
      • setRotation

        public void setRotation​(float degrees)
        sets direction "degrees" to the direction currently facing
        Parameters:
        degrees - direction to face
      • setRemove

        public void setRemove​(java.lang.Boolean x)
      • die

        public void die()