Class: MoveTo (of Motion)

The Motion class is the base class for motion. Objects such as actors use this to move.

Properties

  • client
  • caller
  • x
  • y
  • dx
  • dy
  • b-moveCnt
  • b-i1
  • b-i2
  • b-di
  • b-xAxis
  • b-incr
  • completed
  • xLast
  • yLast

Methods

  • void init([heapPtr theClient, heapPtr theX, heapPtr theY, heapPtr theCaller])

    Sets up the Motion object.

    If specified, it sets the client property to theClient, x property to theX, y property to theY and caller property to theCaller. It sets b-moveCnt to 0, completed to FALSE and xLast and yLast to 0. It the client's cycler property is set, it sets the client's cycler's cyclerCnt to 0. It sets up the client's looper, then calls InitBresen().

  • bool onTarget()

    Returns TRUE if the client is on target with the mover. This is similar to Motion's method, but more advanced. It returns TRUE is the difference between it's x property and the client's x property is less than or equal to the client's xStep property and it's y property and the client's y property is less than or equal to the client's yStep property. Otherwise, it returns FALSE.