Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Flipper 6.0 Help File - <b>obj_move()</b> c_demo,c_exam11 http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
OBJ_MOVE()                                                 C_DEMO,C_EXAM11
   Moves the specified object with mouse control.

   Syntax
         nIndex = OBJ_MOVE(nIndex [,nXOffset,nYOffset])

   Arguments
         nIndex      Number of the object to move.
         OPTIONAL PARAMETERS
         nXOffset    Horizontal movement in world coordinates.
         nYOffset    Vertical movement in world coordinates.

   Returns
         nIndex      Returns the object number if successful, a 0 if there was
                     no object with that number or the move was cancelled, or
                     a negative of the object number if it overlaps another
                     object.

   Description
         OBJ_MOVE() moves an object specified by nIndex to a new location on
         the screen. If nXOffset and nYoffset are passed, the object will move
         and the function will return the object number that it moved.

         If the optional parameters are not passed, the object will follow
         the mouse until the left mouse button is pressed. Clicking the
         right mouse button will snap the cursor to the nearest object hot
         point or grid marker.

         If CHECK_OLAP() is called after moving an object, it will also check
         to see if the object's coordinates directly overlay another object of
         its same type. If it does, OBJ_MOVE() will return the negative of the
         object's number.

   Examples

         Section of code that moves object under mouse control:

         DO WHILE .T.
            KEY_PRESS()
            IF KP_MSTATE(2) = 1
               IF OBJ_HOT() > 0
                  OBJ_MOVE(KP_ITEM_NO())
                  EXIT
               ENDIF
            ENDIF
         ENDDO

See Also: CHECK_OLAP() OBJ_COPY() OBJ_MOVPNT() OBJ_SNAP() OBJ_SNAPNT()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson