home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 1998 November / maximum-cd-1998-11.iso / Truespace 4 / Data / PROGRAM / Scripts / GroundLock.py < prev    next >
Encoding:
Text File  |  1998-08-27  |  643 b   |  20 lines

  1. # (c) 1998 Simon Windmill, simon@wfmm.com
  2. # windmill fraser multimedia, inc.  http://www.wfmm.com/
  3. #
  4. # This is an object script.  Assign it to an object and press Play.
  5. # Whenever the object dips below the groundlevel, it pops back, so your
  6. # characters aren't running through the ground.
  7.  
  8.  
  9. # we want this to work interactively, so we check every tick change
  10. def ontimechanged():
  11.   # get the object's position
  12.   x = me.Position[0]
  13.   y = me.Position[1]
  14.   z = me.Position[2]
  15.   # if the z value is less than 1, we move the object's z position to 1
  16.   if z < 1:
  17.     me.Position = x, y, 1
  18.  
  19.     # and update the view
  20.     doc.Draw()