# Snap card game

**URL:** <https://forum.kirupa.com/t/snap-card-game/188709>\
**Category:** Uncategorized\
**Created:** [May 10, 2006, 8:50am UTC](https://forum.kirupa.com/t/snap-card-game/188709 "2006-05-10T08:50:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![iflashtrated](https://avatars.discourse-cdn.com/v4/letter/i/c0e974/32.png) [@iflashtrated](https://forum.kirupa.com/u/iflashtrated)\
**Post date:** [May 10, 2006, 8:50am UTC](https://forum.kirupa.com/t/snap-card-game/188709/1 "2006-05-10T08:50:26Z")

</div>

[CENTER][CENTER]**[FONT=Times New Roman]Snap Game[/FONT]**[/CENTER]  
[CENTER]**[FONT=Times New Roman] [/FONT]**[/CENTER][/CENTER]  
[FONT=Times New Roman][SIZE=3]Hi everyone/anyone[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]I’m about to start creating a snap card game. Was wondering if anyone could point me in the direction of any examples. Haven’t really had much luck finding any.[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]So my strategy is below, could anyone confirm I’m heading in a logical direction with this since im kind of new to the action script side of flash since I spent my previous life working with the time line and attaching simple script to buttons and the like?? I could get the snap game working this way but not with the sequence of cards changing… I know that flash can be “Dynamic” and want to move in this direction.[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]MY PLAN:\*\*\*\*[/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]Two movieclips to hold the images for each pile of cards. Contained on frames 1 – 10 within each movieclip.i.e.[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]mc\_chooseCard1[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]mc\_chooseCard2[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]Generate 2 random numbers between 1 and 10 (10 being the number of individual images to display for each card)[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]

[FONT=Times New Roman][SIZE=3]Code for this:[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
_[SIZE=3][FONT=Times New Roman]function myRandom (minVal, maxVal) {[/FONT][/SIZE]_  
_[SIZE=3][FONT=Times New Roman] return minVal + Math.floor(Math.random()_(maxVal + 1 - minVal));[/FONT][/SIZE]\*  
_[SIZE=3][FONT=Times New Roman]}[/FONT][/SIZE]_  
_[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]_  
_[SIZE=3][FONT=Times New Roman]chooseCard1 = myRandom(1, 10);[/FONT][/SIZE]_  
_[SIZE=3][FONT=Times New Roman]chooseCard2 = myRandom(1, 10);[/FONT][/SIZE]_  
_[SIZE=3][FONT=Times New Roman]trace (chooseCard1);[/FONT][/SIZE]_  
_[SIZE=3][FONT=Times New Roman]trace (chooseCard2);[/FONT][/SIZE]_  
_[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]_  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]Then jump to the frame number that is randomly generated within mc\_chooseCard1&2.[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
_[SIZE=3][FONT=Times New Roman]pics1.gotoAndStop(chooseCard+1);[/FONT][/SIZE]_  
_[SIZE=3][FONT=Times New Roman]pics2.gotoAndStop(chooseCard2+1);[/FONT][/SIZE]_  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]If random no mc\_chooseCard1 == mc\_chooseCard2 then snapCount = snapCount +1 if snap button is pressed during this match.[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]I will also need to include a time delay controller allowing to speed up or slow down the speed that the cards change. I assume I can control the speed that it jumps to the next frame, but this is again something I’m looking into.[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]Thanx,[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]New flasher[/SIZE][/FONT]
