deckShuffle 600 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. # deckShuffle
  2. killvar 'deckFace'
  3. killvar '$deckImg'
  4. i = 0
  5. :loop1
  6. if i < 4:
  7. i += 1
  8. if i = 1: $text = 'Spades'
  9. if i = 2: $text = 'Hearts'
  10. if i = 3: $text = 'Clubs'
  11. if i = 4: $text = 'Diamonds'
  12. j = 0
  13. :loop2
  14. if j < 13:
  15. j += 1
  16. deckFace[] = j
  17. $deckImg[] = 'images/casino/cards/<<$text>>/<<j>>.png'
  18. jump 'loop2'
  19. end
  20. jump 'loop1'
  21. end
  22. i = 0
  23. :loop3
  24. if i < 52:
  25. j = rand(0, 51)
  26. temp = deckFace[i]
  27. deckFace[i] = deckFace[j]
  28. deckFace[j] = temp
  29. $text = $deckImg[i]
  30. $deckImg[i] = $deckImg[j]
  31. $deckImg[j] = $text
  32. i += 1
  33. jump 'loop3'
  34. end
  35. --- deckShuffle ---------------------------------