Discuss Scratch

tween55
Scratcher
9 posts

lists

I am trying to figure out how to assign a sprite to a list item. I can make a list but I want each value on the list to be associated with a sprite. As an example I am looking at a blackjack project (http://scratch.mit.edu/projects/472525/). Each of the cards is associated with a value from a list. I can't figure out how the card is associated with the item in the list. Why does item 39 call up the king of hearts?
karmanhof
Scratcher
41 posts

lists

In the list you can store the number of the relevant costume of one specific sprite. So with this number you can display the right costume:
switch costume to (CardNumber)
UniMog
Scratcher
58 posts

lists

tween55 wrote:

I am trying to figure out how to assign a sprite to a list item. I can make a list but I want each value on the list to be associated with a sprite. As an example I am looking at a blackjack project (http://scratch.mit.edu/projects/472525/). Each of the cards is associated with a value from a list. I can't figure out how the card is associated with the item in the list. Why does item 39 call up the king of hearts?

Look at sprite3 holding the card “costumes”. costumes 1 to 13 are Clubs (Ace to King), costumes 14 to 26 are Diamonds (Ace to King), 27 to 39 are Hearts (Ace to King), etc.

Costume 39 is the King of Hearts.

The value of any card can be found from the costume number

value = #costume mod 13

Powered by DjangoBB