This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-08-21 18:31:04

mb1350
Scratcher
Registered: 2009-03-25
Posts: 9

'Switch to Costume' problem

Never mind, I figured out a way around this problem.

It's going to be hard explaining my problem, but I will give it a shot:

I'm working on a solitaire program which is going well up until now. I was able to make a script that shuffles the deck, and started working on the program to deal the shuffled deck. I made the program for the first 'stack' as i call them (the first stack is the single card bellow the deck in a game of solitaire) which worked up until when I have the sprite for the stack switch to the right costume as the card that should go there.

I have a notation system for the cards in a deck: the first letter states the suit: c for clubs, h for hearts, d for diamonds, and s for spades. after the suit comes the 'number'; 1-10 or j for jack, q for queen, and k for king.

I don't know if there is a way to translate an item on a list to a costume for the sprite.

<switch to costume[ <{ h10 }>

Instead of the variable command I have the 'item 1 of _____' command for lists. the first item for the stack's list is h10, which is also the title of the costume of the card it has to switch to.

In the drop-down menu for the 'switch to costume _____' command the costumes are listed as the notation i used. (h10 is an option to select manually)


Is there a way to translate an item in a list to a costume for a sprite?

I hope i explained this well enough.

Last edited by mb1350 (2009-08-21 21:08:37)

Offline

 

#2 2009-08-22 04:38:58

dav09
Scratcher
Registered: 2009-03-25
Posts: 1000+

Re: 'Switch to Costume' problem

i think variables dont work because it only understands numbers

Offline

 

#3 2009-08-22 13:18:16

weswesrock
Scratcher
Registered: 2009-06-25
Posts: 500+

Re: 'Switch to Costume' problem

dav09 wrote:

i think variables dont work because it only understands numbers

Yah, variables and list have problems with words. For example, I tried to use "on" and "off" on a variable, and it was a complete failure. Stick with numbers in your variables/lists  smile

Offline

 

#4 2009-08-22 17:16:57

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: 'Switch to Costume' problem

If you are making a project with a deck of cards, I highly recommend looking at one of my projects:

http://scratch.mit.edu/projects/BoltBait/480942

or

http://scratch.mit.edu/projects/BoltBait/472525

Both games use a deck of cards and have routines for shuffling, dealing, and managing a deck of cards.  Plus, they have the graphics for a deck of cards already there for you.


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

Board footer