Class: Motion (of Obj)

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().

  • void doit()

    If b-moveCnt is equal to the client's moveSpeed, the xLast and yLast properties are set. It calls DoBresen(), and if it has moved to it's destination, calls it's moveDone() method.

  • void moveDone()

    Sets the completed property to TRUE. If the caller property is set, it sets the global variable gCastMotionCue to TRUE. Otherwise, it calls it's motionCue() method.

  • void setTarget([number newX, number newY])

    If specified, it sets the x and y properties to newX and newY.

  • bool onTarget()

    Returns TRUE if the client's x property is equal to the x property, and the client's y property is equal to the y property. Otherwise, it returns FALSE.

  • void motionCue()

    Sets the client's mover to NULL. If the completed property is TRUE and the caller property is set, it calls the cue() method of it's caller. It then disposes of itself.