Home Tutorials Forums Articles Blogs Movies Library Employment Press

 ActionScript.org Forums Match Game help
 Register FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

 07-02-2008, 04:53 PM #1 bettypage222 Registered User   Join Date: Mar 2007 Posts: 39 Match Game help Hi, I have a program for a card match game... and I have a question... can anyone think of a solution for this? If two of the cards are matched, the code now removes the movie clips... I would like to change it so that when a match is made, the movie clips ARE NOT removed, however I want them to NOT BE ENABLED either... that the card match is unclickable... I'm not sure how to do that... thanks for any help // initGame(); stop(); function initGame() { // make sorted list of cards cardsListOrdered = []; for(i=1;i<=8;i++) { cardsListOrdered.push(i,i); } // shuffle list cardsListSorted = []; while (cardsListOrdered.length > 0) { r = int(Math.random()*cardsListOrdered.length); cardsListSorted.push(cardsListOrdered[r]); cardsListOrdered.splice(r,1); } // create card clips and assign their location and picture x = 0; y = 0; for(i=0;i<16;i++) { attachMovie("Card","Card"+i,i); _root["Card"+i].picture = cardsListSorted[i]; _root["Card"+i]._x = x*85+275; _root["Card"+i]._y = y*85+80; // move to next card spot x++; if (x > 3) { x = 0; y++; } } firstclip = 0; } function clickCard(clip) { // see whether two cards are showing if (secondclip != 0) { // turn those two cards back over firstclip.gotoAndStop(1); secondclip.gotoAndStop(1); firstClip = 0; secondClip = 0; } // see whether same card was clicked if (firstclip == clip) { // turn card back over firstclip.gotoAndStop(1); firstClip = 0; // see whether no cards are showing } else if (firstclip == 0) { // turn first card over clip.gotoAndStop(clip.picture+1); firstclip = clip; // must be one card showing } else { // turn second card over clip.gotoAndStop(clip.picture+1); secondClip = clip; // see whether two cards match if (firstclip.picture == secondClip.picture) { // remove both cards firstClip.removeMovieClip(); secondClip.removeMovieClip(); firstClip = 10; secondClip = 20; } } }
 07-02-2008, 06:56 PM #2 CobaltBlueDW Senior Member     Join Date: Jun 2008 Posts: 166 Some important code seems to be missing, but if I conjecture right using something like this would work: ActionScript Code: ```// remove both cards firstClip.onRelease = null; secondClip.onRelease = null;``` I don't know if you used onRelease, there are so many different possibilities for that, so hoefully you get the idea.
 07-02-2008, 07:28 PM #3 bettypage222 Registered User   Join Date: Mar 2007 Posts: 39 that worked perfect, thanks! Actually, there is no code missing... that's all of it...the mc in the library are being exported for AS, that's probably what you mean?
 07-02-2008, 08:16 PM #4 bettypage222 Registered User   Join Date: Mar 2007 Posts: 39 error actually, I'm getting this error with the code **Warning** The linkage identifier 'Card_Button' was already assigned to the symbol 'cbutton', and cannot be assigned to the symbol 'cbutton', since linkage identifiers must be unique. Here is the code: // initGame(); stop(); function initGame() { // make sorted list of cards cardsListOrdered = []; for(i=1;i<=8;i++) { cardsListOrdered.push(i,i); } // shuffle list cardsListSorted = []; while (cardsListOrdered.length > 0) { r = int(Math.random()*cardsListOrdered.length); cardsListSorted.push(cardsListOrdered[r]); cardsListOrdered.splice(r,1); } // create card clips and assign their location and picture x = 0; y = 0; for(i=0;i<16;i++) { attachMovie("Card","Card"+i,i); _root["Card"+i].picture = cardsListSorted[i]; _root["Card"+i]._x = x*85+275; _root["Card"+i]._y = y*85+80; // move to next card spot x++; if (x > 3) { x = 0; y++; } } firstclip = 0; } function clickCard(clip) { // see whether two cards are showing if (secondclip != 0) { // turn those two cards back over firstclip.gotoAndStop(1); secondclip.gotoAndStop(1); firstClip = 0; secondClip = 0; } // see whether same card was clicked if (firstclip == clip) { // turn card back over firstclip.gotoAndStop(1); firstClip = 0; // see whether no cards are showing } else if (firstclip == 0) { // turn first card over clip.gotoAndStop(clip.picture+1); firstclip = clip; // must be one card showing } else { // turn second card over clip.gotoAndStop(clip.picture+1); secondClip = clip; // see whether two cards match if (firstclip.picture == secondClip.picture) { // remove both cards firstClip.onRelease = null; secondClip.onRelease = null; firstClip = 0; secondClip = 0; } } }

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home ActionScript Forums Group     ActionScript 3.0     ActionScript 2.0     ActionScript 1.0 (and below)     Simple Stuff (Newbies) Flash General Questions     Flash 10 General Questions     Flash 9 General Questions     Flash 8 General Questions     Other Flash General Questions Flex     Flex 2, 3 & 4     Flex 1 Extensions and Plugins     Components     JSFL - Extending Flash Desktop, Mobile and non-browser Environments     AIR (Apollo)     FlashLite / Portable Devices Development     Projectors and CDs Supporting Technologies     HTML and JavaScript     haXe     Server-Side Scripting     Flash Remoting     Flash Media Server General     Best Practices     Gaming and Game Development     Animation and Effects     Flashants Support Forum Community Boards     General Chat     Just for Kicks Challenges     Detention Flash In Action     Site Check     Cool Sites     Widgets Decommissioned     Projects and Positions CMS Forums     Announcements Board     Content Postings / Updates     Product Review Requests     CMS Technical Questions     Process Questions     Collaboration & Suggested Articles

 Similar Threads Thread Thread Starter Forum Replies Last Post AdamSchroeder General Chat 0 12-18-2007 09:16 PM UzumakiJr Site Check 0 12-16-2006 08:48 PM neilmmm Gaming and Game Development 10 03-15-2006 04:12 PM Total Frigging Gaming and Game Development 4 02-21-2005 12:04 AM 550krokur Gaming and Game Development 0 03-27-2004 11:29 AM

All times are GMT. The time now is 09:25 PM.

///