home *** CD-ROM | disk | FTP | other *** search
- property pileSize, pileList, firstSocket, x, y
-
- on birth me, socket, px, py
- set the firstSocket of me to socket
- set the x of me to px
- set the y of me to py
- reset(me)
- return me
- end
-
- on push me, castName
- if the pileSize of me = maxPileSize() then
- beep()
- put "error: pile full"
- else
- append(the pileList of me, castName)
- set the pileSize of me to the pileSize of me + 1
- set spriteNo to the firstSocket of me + the pileSize of me - 1
- set totalDepthOffset to PageDepthOffset() * (the pileSize of me - 1)
- InstallBitMap(spriteNo, castName, the x of me, the y of me + totalDepthOffset)
- end if
- end
-
- on pop me
- if the pileSize of me = 0 then
- beep()
- put "error: Popping from empty pile"
- set sendBack to EMPTY
- else
- set sendBack to getAt(the pileList of me, the pileSize of me)
- deleteAt(the pileList of me, the pileSize of me)
- set spriteNo to the firstSocket of me + the pileSize of me - 1
- KillBitMap(spriteNo)
- set the pileSize of me to the pileSize of me - 1
- end if
- return sendBack
- end
-
- on TopPage me
- if the pileSize of me = 0 then
- set sendBack to EMPTY
- else
- set sendBack to getAt(the pileList of me, the pileSize of me)
- deleteAt(the pileList of me, the pileSize of me)
- end if
- return sendBack
- end
-
- on TopSprite me
- set theSpr to -1
- if the pileSize of me > 0 then
- set theSpr to the firstSocket of me + the pileSize of me - 1
- end if
- return theSpr
- end
-
- on reset me
- set the pileList of me to []
- set the pileSize of me to 0
- repeat with i = 1 to maxPileSize()
- set spriteNo to the firstSocket of me + i - 1
- KillBitMap(spriteNo)
- end repeat
- end
-
- on FreeSprites me
- repeat with i = 1 to maxPileSize()
- set spriteNo to the firstSocket of me + i - 1
- puppetSprite(spriteNo, 0)
- end repeat
- end
-