home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / TowerHanoy.dxr / 00047_knight.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  616 b   |  25 lines

  1. property pKnight, spriteNum, pOriginalLoc, pDirection
  2.  
  3. on beginSprite me
  4.   pKnight = sprite(spriteNum)
  5.   pOriginalLoc = pKnight.loc
  6. end
  7.  
  8. on enterFrame me
  9.   if not pKnight.flipH then
  10.     if pKnight.loc[1] < (((the stage).rect.width / 2) - (pKnight.width / 2)) then
  11.       pKnight.locH = pKnight.loc[1] + 1
  12.     else
  13.       pKnight.flipH = not pKnight.flipH
  14.     end if
  15.   else
  16.     if pKnight.flipH then
  17.       if (pKnight.loc[1] > pOriginalLoc[1]) or (pKnight.loc[1] < pOriginalLoc[1]) then
  18.         pKnight.locH = pKnight.loc[1] - 1
  19.       else
  20.         pKnight.flipH = not pKnight.flipH
  21.       end if
  22.     end if
  23.   end if
  24. end
  25.