Class GameObject

java.lang.Object
GameObject
Direct Known Subclasses:
Board, Cell, Frog, Fruit, FruitGenerator, Snake, SnakePart, Sprite

public class GameObject extends Object
Game objects class, base of objects on the scenes.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static GameBase
    Reference to gameplay.
    protected float
    Timer value.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Like unity Awake (invoke on create of object or create gameplay).
    protected float
    Like Time.deltaTime in Unity.
    protected void
    Like unity OnDestroy (invoke after destroy object or on end of game).
    protected void
    Method who render a object on screen (invoke on begin of each frames).
    protected void
    setTimer​(float milliseconds)
    Set timer in milliseconds.
    protected void
    Like unity Start (invoke on first frame of object like or before begin main loop).
    protected boolean
    Clock down timer.
    protected void
    Like unity Update (invoke after render on each frames).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • game

      protected static GameBase game
      Reference to gameplay.
    • timer

      protected float timer
      Timer value.
  • Constructor Details

    • GameObject

      public GameObject()
  • Method Details

    • getDeltaTime

      protected float getDeltaTime()
      Like Time.deltaTime in Unity.
    • setTimer

      protected void setTimer(float milliseconds)
      Set timer in milliseconds.
    • timerClockDown

      protected boolean timerClockDown()
      Clock down timer.
    • awake

      protected void awake()
      Like unity Awake (invoke on create of object or create gameplay).
    • start

      protected void start()
      Like unity Start (invoke on first frame of object like or before begin main loop).
    • update

      protected void update()
      Like unity Update (invoke after render on each frames).
    • onDestroy

      protected void onDestroy()
      Like unity OnDestroy (invoke after destroy object or on end of game).
    • render

      protected void render(Graphics2D g)
      Method who render a object on screen (invoke on begin of each frames).