home *** CD-ROM | disk | FTP | other *** search
- property pKnight, spriteNum, pOriginalLoc, pDirection
-
- on beginSprite me
- pKnight = sprite(spriteNum)
- pOriginalLoc = pKnight.loc
- end
-
- on enterFrame me
- if not pKnight.flipH then
- if pKnight.loc[1] < (((the stage).rect.width / 2) - (pKnight.width / 2)) then
- pKnight.locH = pKnight.loc[1] + 1
- else
- pKnight.flipH = not pKnight.flipH
- end if
- else
- if pKnight.flipH then
- if (pKnight.loc[1] > pOriginalLoc[1]) or (pKnight.loc[1] < pOriginalLoc[1]) then
- pKnight.locH = pKnight.loc[1] - 1
- else
- pKnight.flipH = not pKnight.flipH
- end if
- end if
- end if
- end
-