|
|
|
#1 |
|
Junior Member
Join Date: Apr 2004
Posts: 10
|
shuffle card game
Hi all! I am posting an .fla of what I am trying to do, perhaps someone can help me figure it out.
I am creating a card game, and at the end of the game if the player wants to replay the game, I want my cards to shuffle. What I have managed so far in this demo file, is when the game starts the movie clips are placed in certain positions on the stage, and when you press the button instead of shuffeling...all movie clips are placed behind the other and they all move along. What I want instead is on each mouse press, the cards to swap places and only one movie clip per place! Appreciate anyone's wisdom! P.s. I HAVE flash Mx...NOT...flash MX 2004. |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
|
Here's a modified version of your code that will do it. I was able to shorten your code a bit by using the same function for shuffling the cards to perform the initial placement.
- Jim Bumgardner EDIT: I've modified the code a few times as I thought of optimizations. Last edited by jbum; 09-28-2004 at 06:11 PM. |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
|
You may enjoy the following card trick, which I made in Flash a few weeks ago.
Mind Power Instructions. A wheel of cards will appear. Mentally choose one of the cards, and also choose a 4 letter word of your choosing. Let's say you choose the 7 of hearts, and the word "BARN". Using the handle, rotate the wheel so that your card is under the first letter of your word. So you'd rotate it so the seven of hearts is under the B. Then press the red-button in the middle. At this point, there's no way to know either your card, or the word chosen, since each card is under a different letter. Then rotate the wheel so the seven is under the "A" in "BARN", and press the button again. Repeat for the remaining two letters. You'll be astonished at what happens next. - Jim |
|
|
|
|
|
#4 |
|
Jolene
Join Date: Jul 2005
Posts: 1
|
You rocks!
Jbum,
your code for shuffling an array rocks!!! I have been working it for so long, yet cannot find an answer... but i modified your codes and place it into my application and it works!!! Cool !!! |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Mar 2008
Posts: 5
|
Great code, Jim.
Almost bang-on what I was looking for. My cards are 2 frame movieclips. Frame 1 is the "backing", Frame 2 is the "face". They start out face down and when clicked on, the cards switch to Frame 2 (showing their value). With your code above, it rearranges the order of the cards (which is great) but it doesn't flip the ones showing Frame 2 back to Frame 1. Is there a way to do it? |
|
|
|
![]() |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|