home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / SirTommy.dxr / Internal_6_tableau cards.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  2.3 KB  |  87 lines

  1. property spriteNum, motion, location, row
  2. global tableau, getlist, equal, currentsel, godlist, foundation, points, stock
  3.  
  4. on beginSprite me
  5.   if not listp(tableau) then
  6.     tableau = [:]
  7.   end if
  8.   row = determinerow()
  9.   tableau.addProp(row, new(script("card pile")))
  10.   location = sprite(spriteNum).loc
  11. end
  12.  
  13. on mouseDown me
  14.   if tableau[row].getcardcount() > 0 then
  15.     if spriteNum = tableau[row].getlastcard().spnum then
  16.       puppetSound(3, member("pick card", "100GPak Generic SFX"))
  17.       sprite(spriteNum).locZ = spriteNum + 1000
  18.       getlist = tableau[row]
  19.       motion = timeout(string(spriteNum) && "motion").new(5, #moving, me)
  20.     end if
  21.     if sprite(spriteNum).member = member("empty", "playing cards") then
  22.       sendSprite(spriteNum - 1, #mouseDown)
  23.     end if
  24.   end if
  25. end
  26.  
  27. on moving me
  28.   if the mouseDown then
  29.     sprite(spriteNum).loc = the mouseLoc
  30.   else
  31.     if the mouseUp then
  32.       sprite(spriteNum).locZ = spriteNum
  33.       motion.forget()
  34.       abort()
  35.     end if
  36.   end if
  37. end
  38.  
  39. on mouseUp me
  40.   if equal then
  41.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  42.     sprite(currentsel).member = member(sprite(spriteNum).member.name, "playing cards")
  43.     sprite(spriteNum).member = member("empty", "playing cards")
  44.     godlist.addCard(currentsel)
  45.     sprite(spriteNum).loc = location
  46.     tableau[row].cards.deleteOne(tableau[row].getlastcard())
  47.     if objectp(foundation[sprite(currentsel).row]) then
  48.       points = points + 10
  49.     end if
  50.     equal = 0
  51.     currentsel = 0
  52.     godlist = VOID
  53.     getlist = VOID
  54.     repeat with i = 71 to 74
  55.       if tableau[sprite(i).row].getcardcount() = 0 then
  56.         next repeat
  57.       end if
  58.       sprite(i).loc = tableau[sprite(i).row].getlastcard().location
  59.     end repeat
  60.     checkwin()
  61.   else
  62.     if not equal then
  63.       puppetSound(3, member("drop card", "100GPak Generic SFX"))
  64.       getlist = VOID
  65.       sprite(spriteNum).loc = location
  66.     end if
  67.   end if
  68. end
  69.  
  70. on determinerow me
  71.   if (spriteNum >= 15) and (spriteNum <= 28) then
  72.     return #one
  73.   else
  74.     if (spriteNum >= 29) and (spriteNum <= 42) then
  75.       return #two
  76.     else
  77.       if (spriteNum >= 43) and (spriteNum <= 56) then
  78.         return #three
  79.       else
  80.         if (spriteNum >= 57) and (spriteNum <= 70) then
  81.           return #four
  82.         end if
  83.       end if
  84.     end if
  85.   end if
  86. end
  87.