Game- Matching Pairs
Hi
Im creating a game of snap/match the pairs for children. There will be 5 pair, where they are positioned will never change, but.... how do i reveal two at a time? how do i make the pairs recognise that they are the same? and keep them visible? how do a make two mis-matches 'un-reveal' themselves
The imagery is ready....what next... Any ideas?
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 05-25-2007, 11:46 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Matching Pairs Game
Does anyone have or know of a place where i can get the Actionscript for a matching pairs game, its the kind of game where there are a set number of picture cards lying face down and when the player turns over one they must try to match it with the same card which is located somewhere else. If the player gets it wrong then both cards are turned back over, if the player gets it right then both cards stay face up.
Any help would be much appreciated, thanks!
Game- Matching Pairs
Im creating a game of snap/match the pairs for children.
There will be 5 pair, where they are positioned will never change, but....
how do i reveal two at a time?
how do i make the pairs recognise that they are the same? and keep them visible?
how do a make two mis-matches 'un-reveal' themselves
Any ideas?
HELP :: Matching Pairs Game Needed
Hi All
Anyone got a good example of a matching pairs game? I need to learn how to code the bugga.
SWF, FLA examples or a tutorial would be fantastic assistance.
You seen one anywhere?
onefinedave.
“Matching Pairs Card Game” But With 48 Cards
Hi I’m trying to modrate this memory game
http://www.flashkit.com/movies/Games...7285/index.php
I want it to be able to pair a picture to fx. a card with a word on. Only tested it on photo1 so far, but seems to work.
I also want it to have 48 cards instead of 24, but for some reson
it only shows 36 cards...and i have no clue why.
Can any one help me or give me a hint of whats wrong.
(I’m a newb at this actionsripting )
I've attached the file I'm working on.
/Heidi
Matching Pairs Game - Can't Find Error
Hi all, i've been making a matching pairs game. you know the one where you pick 2 cards and if they are the same then its a match although i want to do this with questions and answers.
Basically if a card is selected it is assigned the value of "2". When both corredt cards are selected the total is set to "4" and they remain turned over. wrong selections reset the cards.
when selecting correct answers it works fine and on some selections of wrong answers but theres an error somewhere and I can't find it. When you turn over the 2 diagonal cards which are not matched the total goes to"4" and marks them as correct.
I have attached the file .. please help i've been on this hours now:
Matching Pairs: A Flash Game In Which I'm Well Over My Head.
How-do folks!
I always hate to sign up to forums for rather self-indulgent reasons, but I'm hoping someone can help me. At present I'm creating a matching pairs game using cards dynamically attached to the stage, with each card featuring a movieClip which holds in itself a symbol with its own instance name for each unique graphic contained in that. Essentially, at this stage I have the task of coding the core gameplay, where it seems to be ActionScript nuances that have me bamboozled.
What I have inside the cardFace movieClip looks as follows (but obviously doesn't work):
Code:
this.onRelease = function() {
_global.clickCount++;
if (_global.clickCount<3) {
this.image._visible = true;
_parent.clickedSquares.push (this.image, _child._name);
}
if (_global.clickCount == 2) {
_global.clickCount = 0;
}
trace (_parent.clickedSquares)
};
clickCount is pretty self explanatory, but image is the instance name of the movieClip that is child to the card, generated in the following on the main stage:
Code:
var randomGen = random(imagesArray.length);
this._parent["cardFace"+i].attachMovie(imagesArray[randomGen], "image", this._parent["cardFace"+i].getNextHighestDepth());
clickedSquares is at present an empty array, which is designed to store the instance names of the sprites which are attached to the cards under the image *gaasp*. At current I'm tracing this and either get undefined values or the value 'image', derived from that aforementioned instance name higher up the chain. The overall aim of this is to provide a point where the two instance names can be compared, thus making pretty much the only gameplay involved here.
I really hope this makes sense to someone, but of course will be happy to post more of what I have if it's needed. I just get the impression there's either something catastrophically wrong with my concept, or I'm missing a couple of naming conventions to get the right sort of value out.
Thanks in advance!
Creating A Matching Pairs Game In Flash5
I want to create a matching pairs card game within flash.
I have found actionscript for a matching pairs game but it does not work the way i want it to. I would like to be able to match a Picture with a word as opposed to 2 pictures the same.
If anybody knows how to do this or knows any excellent websites that have tutorials for writing actionscript for games, please reply.
cheers!
Matching Pairs Game, Check If All Movieclips Have Been Removed?
I have been creating a flash game which is a matching pairs game based on the Super Mario Kart player select screen. My code creates as many or little cards with names of "card0", "card1" etc... It all works fine, select difficulty, turn ouver the cards, find pairs, remove pairs... blah blah blah. But now I'm stuck. I cant get it to know when the game has ended. I cant use a counter as the number of cards vary from difficulty, I was wondering if there was a function I could write to check if there are any movieclips on the stage with "card" in there name and then go to the end
estart screen?
Thanks for reading this and I hope one of you clever programmers can help (I'm mainly a design student.)
Pairs Game
I have a project to make a game, you know.. pairs game where you choose a card, it opens up to a picture, you choose another.. if its the same picture both stay face up, but if its a different picture then both flip face down hiding pictures.. and as 2 pictures found the same a side animation of a star plays for a few seconds.. any help with this one?
Pairs Game
I have a project to make a game, you know.. pairs game where you choose a card, it opens up to a picture, you choose another.. if its the same picture both stay face up, but if its a different picture then both flip face down hiding pictures.. and as 2 pictures found the same a side animation of a star plays for a few seconds.. any help with this one?
(using flashMX)
Pairs Game Problem
hey all,
greatly in need of some help!
i'm creating a game of pairs that displays 16 buttons in all. A player has to click on buttons until they click on two consecutively that show the same number on them, then these buttons will disappear.
the problem is thou, i don't kno how to compare the two button texts to see if they are the same or not??
this is my code
function drawButtons()
{
//sounds array
soundArray = new Array("1", "1", "2", "2", "3", "3", "4", "4", "5", "5", "6", "6", "7", "7", "8", "8");
trace(soundArray);
function sortRand() {
if (random(2) == 0) {
return -1;
trace(-1);
}
if (random(2) == 0) {
return 1;
trace(1);
}
}
soundArray.sort(sortRand);
i = Math.round(15*Math.random());//number used to choose a random element
//trace(i);
var b;
xPos +=16;
for(var c = 0; c < 16; c++)
{
b = this.attachMovie("button", "btn" + c, c,{_x:xPos, _y:yPos});
xPos += 70;
if (xPos>230)
{
yPos += 30;
xPos = 16;
}
b.onRelease = this.buttonRelease;
b.field.text = soundArray[c];
//trace(b.field.text + 'is equal to ' + b._name);
}
}
function buttonRelease()
{
trace(this._name);
trace('button writing = ' + this._name);
}
this.drawButtons();
any help would be rrrrrrreally appreciated,
from an exhausted and confused beginner programmer!
x
Flash 5 Pairs Game
Hello! I'm in the care industry supporting people with learning difficulties and I'm trying to teach makaton sign language. As most the people I help have very limited attention I thought I would try making a computer game to hold their interest! The only problem is i'm not very good at the programming side of things so could anyone possible help me?
I need to be able for them to select a picture, try and find the same one to match it and select that, then go back to the beginning of the animation with the selected ones disapeared ready to choose the next pair? Is this possible without running huge amount of animation?
Also two other things real quick, sorry hehe.
1. is there a command to make the animation appear full screen on opening or would i have to do that through html?
2. When i import a jpg it seems to instantly decrease in quality if theres more than one frame of animation. I tried messing about with the quality of jpg etc but no luck.
Thank you so much in advance! Any help would be appreciative.
Tris
PEXESO - PAIRS Game
Hello all,
I am doing a minigame for the website and it is pairs game (you click on cards, they reveal, if the pair matches the stay facing the image up, if not they turn so that player cant see image again)
I have done this by placing the movieclips on stage, have a onclick actions setup and variable for each pair.
can anyone suggest a better way how to do this? I mean maybe placing the images from XML file or make it more generic.
Many thanks
Pairs Game - Timer Issue
Hello,
Ive made a game of pairs where the user must turn over a card on the left of the screen and find the matching card on the right. This must all be done within a time limit.
There are 5 levels on 5 different frames. All are identical except the cards are in a different position on each level.
For the time im using this script:
_global.timed=210 (very first frame)
_global.timer = setInterval(this,"resume",_global.timed*1000);
function resume() {
clearInterval(_global.timer);
gotoAndPlay("gameover");
}
On level one this works perfectly. When the time is up it will say gameover. However, on levels 2-5, the timer wont finish and it will all of a sudden go to the level complete page. This means the timer still has 5 or 6 seconds left on it which it shouldnt have.
i clear the interval after every level and the problem reoccurs even when i start on level 2, 3,4 or 5 and skipping one. As i said, each frame is identical so why does it only occur on these? Also the time varies, sometimes it can jump 2 seconds early, 6 seconds early or 2 seconds late (doesnt go lower or higher than these figures)
Any ideas?
[F5] Pairs Memory Game Issues
Can anyone help with a script to get me out of a hole?
I am revisiting a pairs memory game that I worked on a few years ago. Long story short is that I am a designer who originally took over the design of this game, not the scripting. I have a basic level of Flash but not much AS. The client now wishes to use this 'xmas' game again this year (see attached) but with a few additions:
I need to create additional pairs from the current 12 to 18, so 36 cards in total.
I also need a text message (with small accompanying image) popping up when a pair is matched. A different message needs to be shown when each specific pair is matched.
The game was created in Flash 5 so I assume that the additional or modified scripts needs to match or the game won't work when published. Please advise?
Note that I’m probably going to need a step by step guide on how to set this up in flash. I hope it isn't too difficult.
Paul
Use A Shared Object In A Game To Store Pairs Player_name - Player
If I want to use a Shared Object in a game for a local computer to store
pairs player_name - player_score (a string and a number) what would be the
best approach to push the data in and retrieve them out as a table?
Flash Help says that the properties created in a SO can enumerated in a
for..in loop - how do I use this?
Matching Game
I've been trying to modify William Warby action script so that I can match two different photos. I was thinking of having an array with 1a, 1b, 2a, and so on. The problem is I don't know how your script get the corresponding photo to turn over. If you have any suggestion I would greatly appreciate it.
http://www.flashkit.com/movies/Games....php:confused:
Matching Game
I'm trying to develop a matching word game for children using Flash 5.
I plan to use about 15 squares and have 7 matching words which are randomly generated hidden under them. I hope to have a message saying well done underneath the 15th square. If you click on two matching words they remain revealed. If they don’t match they remain hidden until clicked on later.
I know the basics of Flash 5 but am not competent enough to alter an existing game. I would appreciate some advice as to how I might go about it.
Matching Game.
I need help with the code for a matching game i am making. how do u get it so that when you click on the card it flips over to the other side. also i need help to make it notice when 2 similar cards are flipped over. thanks a bunch.
SoccerStarAJOB.
Matching Game..
I need help with the code for a matching game i am making. how do u get it so that when you click on the card it flips over to the other side. also i need help to make it notice when 2 similar cards are flipped over. thanks a bunch.
SoccerStarAJOB.
[CS3] Matching Game
I have this matching game and I have trouble to add a simple score system. But after finish I notice an error that I can fix:
The class or interface 'MouseEvent' could not be loaded.
I have the link for the FLA file (I believe without that will be difficult to see).
http://melicio.com/memory_game7.fla
I will appreciate any help!
thanks
sergio
Matching Game
Merry Xmas to all!
Need some help with my matching game. I have this matching game that require player to match the pic of fruits to their names.
Thus i have 9 fruits to 9 names in a 36grids(where by total of 18pairs)
however, i am not able to get the inidividual clips to repeat not more than 2 times. please take a look at my fla file. still trying to debug.... =(
in advance, thanx a billion!
Matching Game
Merry Xmas to all!
Need some help with my matching game. I have this matching game that require player to match the pic of fruits to their names.
Thus i have 9 fruits to 9 names in a 36grids(where by total of 18pairs)
however, i am not able to get the inidividual clips to repeat not more than 2 times. please take a look at my fla file. still trying to debug.... =(
in advance, thanx a billion!
[F8] Matching Game Difficulty
I'm refactoring the code (using a for loop) for a matching game and it works for the most part, except when it comes to recognizing the drop targets. Each dragger has a unique drop target. Even though each drop target instance has a unique name (drop1, drop2, drop3, ...etc), the draggers will recognize any drop target as its own.
Here is the code. The fla was too big to upload. I'll try and describe how it should work.
There are 7 draggers and 7 drop targets. Each dragger should go into its corresponder drop target (drag1 goes to drop1). If the user makes a mistake, the dragger returns to its original position.
What's happening with this code:
I can stop dragging any dragger anywhere on the stage that is not a drop zone, and that will register as "correct." It will register as "wrong" when I drop the dragger in ANY drop target.
I'm not sure why this isn't working. Any help will be soooo much appreciated.
Code:
// Dragger Lables
var sentence = new Array();
sentence[0] = "50 Domestic Minutes Per Month";
sentence[1] = "Domestic State-to-State (after initial 50 minutes are used)";
sentence[2] = "Unlimited Calls Between Home and Wireless Phone";
sentence[3] = "Local Toll and In-State";
sentence[4] = "Monthly Recurring Charge (MRC) - Home Phone";
sentence[5] = "Monthly Recurring Charge (MRC) - Cell Phone";
sentence[6] = "International Savings";
for(var i=0;i<sentence.length;i++){ //---------------------------Start Loop
// Dragger Labels
this["drag"+i].textbox = sentence[i];
// Counts Array Placement
this["drag"+i].arrayLocation = i;
this["drag"+i].onPress = function () {
dragXPos = this._x;
dragYPos = this._y;
startDrag(["drag"+this.arrayLocation]);
}
this["drag"+i].onRelease = function () {
this.stopDrag();
if (eval(this._droptarget) == this["drop"+this.arrayLocation]) {
//Trouble seems to be with the conditional statement
trace("Correct");
}
else {
this._x = dragXPos;
this._y = dragYPos;
trace("wrong");
}
}
} //-------------------------------------------------End Loop
And PS - this will be loaded into another movie clip, so eval() must stay.
Dynamic Matching Game
Hi, i'm trying to adapt and simplify some code for a card match game created in Flash 5 using Actionscript 1. Basically the cards are created from 18 images in a single movie clip called 'card'. This is located in the library and linked to the code (ie not physically put on the stage')
What I want to do is make it work using Actionscript 2 and MX 2004- So far only certain parts work in my MX 2004 version unless i change the settings to actionscript 1 and flash 5. The cards turn over but do not reset if there is not a pair, they just remain turned over.
Any help would be greatly appreciated. i've also posted the code below:
Code:
initGame();
stop();
function initGame() {
// make sorted list of cards
cardsListOrdered = [];
for(i=1;i<=18;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<36;i++) {
attachMovie("Card","Card"+i,i);
_root["Card"+i].picture = cardsListSorted[i];
_root["Card"+i]._x = x*60+200;
_root["Card"+i]._y = y*60+50;
// move to next card spot
x++;
if (x > 5) {
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 = 0;
secondClip = 0;
}
}
}
Help With Memory Matching Game
Hi to all.
I'm programming a matching game, and I downloaded a sample from this site: memory.fla. The sample is nice, but I want to match two different images (a word and the matching image). The game is made only for matching two identical images.
What changes I have to do to the ActionScript code to do this?
Please help...
Thanks in advance...
Tha
Matching Game For Kids
HI ,
I know how to draw pictures in flash but I don't know how to program in flash, that's why I need your help guys. I want to make a matching game for kids. For example , the kid will see three words like apple , orange , strawberry and on the other side he will see pictures for each fruit. I want the kid to be able to draw a line between the picture and the word it belongs to :)
That's all I need , can someone help me please :)
Thanking you all . .
Matching Game Problem
Here's the game http://www.sandmanmedia.com/question5b.swf
right now you see a picture and a word below it. I want one to show just the picture and the corresponding matching object to show just the text.
I added 4 new keyframes to the MC in the fla to make the graphics with just text (not pic) and I got them appearing but it does not matchin anymore. You'll notice the array is matching 1 with 1 .... 2 with 2
But I have 1, 5, 2, 6, etc b/c I can't load the same graphic twice .... the deadline is today so any help would be great
Here's the fla
http://www.sandmanmedia.com/question5b.fla.zip
Sandman9
Matching Game Troubles
I've been desperately trying to make a matching game, but can't seem to get it to work properly.
The Game:
A matching game where you have to match the spanish word with the english word. I'm using Gary Rosenzweig's code ("Actionscript for Fun & Games") and adjusting it for my purposes.
http://hills.ccsf.org/~jdrake01/games/game.html
The Problem:
1. Trying to make movieClipA == movieClipB
2. Can only click tiles once. When you try to click a second time the buttons freeze.
The Code:
Scene 1
actions for frame 1
initGame();
stop ();
function initGame () {
// make sorted list of cards
cardsListOrdered = [];
for (i=1; i<=4; i++) {
cardsListOrdered.push(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<4; i++) {
attachMovie("Card", "Card"+i, i);
_root["Card"+i].picture = cardsListSorted[i];
_root["Card"+i]._x = x*60+200;
_root["Card"+i]._y = y*60+50;
// move to next card spot
x++;
if (x>5) {
x = 0;
y++;
}
}
firstclip = 0;
}
function clickCard (clip) {
// see if two card are showing
if (secondclip != 0) {
// turn those two cards back over
firstclip.gotoAndStop(1);
secondclip.gotoAndStop(1);
firstClip = 0;
secondClip = 0;
}
// see if same card was clicked
if (firstclip == clip) {
// turn card back over
firstclip.gotoAndStop(1);
firstClip = 0;
// see if 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 if two cards match
if (firstclip.picture == secondClip.picture) {
// remove both cards
firstClip.removeMovieClip();
secondClip.removeMovieClip();
firstClip = 0;
secondClip = 0;
}
}
}
Code on Button (card movieClip timeline):
// Send click info to main timeline
on (press){
_root.clickCard(this);
}
Code on movieClip:
There are five movieClips:
card
card.forest
card.forest2
card.rock
card.rock2.
The code attached to card.forest and card.forest2:
_parent.picture = "forest";
The code attached to card.rock and card.rock2:
_parent.picture = "rock";
Thanks in advance for your help!!
Help With Ceating Simple Matching Game
Hi Folks,
I am trying to build a simple matching game.
I have three option in column "a" and 3 options in column "b".
Are there any exisitng models that I can look at and reverse engineer?
I dont want to have to build it from the ground up (actionscript).
thanks,
ab
Memory Game Matching Problem
I'm doing a memory flip & match card game. Right now my problem in the script is every 2 cards I clicked the result is also "correct" How could I fix this problem?
Code:
private function cardLoaded(e:Event):void {
var bmp:Bitmap=Bitmap(l.content);
//create a var to hold the loaded cards
var bmpd:BitmapData=bmp.bitmapData.clone();
var bmp2:Bitmap=new Bitmap(bmpd);
allCardsArray.push(bmp);
allCardsArray2.push(bmp2);
//send the loaded cards to an array
l.contentLoaderInfo.removeEventListener(Event.COMPLETE,cardLoaded);
l.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,cardNotLoaded);
if (allCardsArray.length == 30) {
// if cards loaded into the array = 30
trace("All cards were loaded!");
for (var i:int=0; i < allCardsArray.length; i++) {
bmp=allCardsArray[i];
//current bmp = what ever card in array
card=new Card ;
addChild(card);
card.addEventListener(MouseEvent.CLICK,checkCards);
cardsRandom.push(card);
card.setType(allCardsArray[i]);
card.y=10 + i % 6 * 92;
card.x=10 + Math.floor(i / 6) * 72;
bmp2=allCardsArray2[i];
card=new Card ;
addChild(card);
card.addEventListener(MouseEvent.CLICK,checkCards);
cardsRandom.push(card);
cardArray.push(allCardsArray[i]);
card.setType(allCardsArray2[i]);
card.y=10 + i % 6 * 92;
card.x=370 + Math.floor(i / 6) * 72;
}
} else {
loadCardNum(allCardsArray.length);
}//run the loadCardNum() function if no card is loaded
}
//--------------------------------------------------------------------------------------------------
private function checkCards(event:MouseEvent):void {
var card:MovieClip=event.currentTarget as MovieClip;
card.removeEventListener(MouseEvent.CLICK,checkCards);
// get how many cards is opened
var size:int=cardArray.length;
// we check whether there is already card opened
if (size == 1) {// yes there is 1 card is opened
// do all the matching process here
if (String(cardArray[0]._type) == String(card._type)) {
trace("match!");
cardArray=new Array ;
} else {
trace("wrong!");
}
} else {
// if there is no card opened yet, add current card to cardArray
addCardArray(card);
}
}
// method that will add all card that is currently opened into an array
private function addCardArray(card:MovieClip) {
// check if there are already 2 cards in our cardArray, if it does... we close them first and then clear them from array.
if (cardArray.length > 1) {
// use a variable to mark down the length;
var size:int=cardArray.length;
// loop through cardArray to close the card.
for (var i:int=0; i < size; i++) {
var c:MovieClip=cardArray[i];
// close the card, you can call your own function that will close the card or can call gotoAndPlay function straightaway here.
c.gotoAndPlay("flipBack");
c.addEventListener(MouseEvent.CLICK,checkCards);
}
// clear the array index starting from index 0; so you will get a blanked array again.
cardArray.splice(0,size);
}
// add a new card to the array
cardArray.push(card);
}
Code:
cardArray.push(card);
the problem now is where is the best place to put this code in. I've tried put it in the loop, but no luck. Any ideas?
Memory Game Matching Problem.
I'm doing a memory flip & match card game. Right now my problem in the script is every 2 cards I clicked the result is also "correct" How could I fix this problem?
ActionScript Code:
private function cardLoaded(e:Event):void {
var bmp:Bitmap=Bitmap(l.content);
//create a var to hold the loaded cards
var bmpd:BitmapData=bmp.bitmapData.clone();
var bmp2:Bitmap=new Bitmap(bmpd);
allCardsArray.push(bmp);
allCardsArray2.push(bmp2);
//send the loaded cards to an array
l.contentLoaderInfo.removeEventListener(Event.COMPLETE,cardLoaded);
l.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,cardNotLoaded);
if (allCardsArray.length == 30) {
// if cards loaded into the array = 30
trace("All cards were loaded!");
for (var i:int=0; i < allCardsArray.length; i++) {
bmp=allCardsArray[i];
//current bmp = what ever card in array
card=new Card ;
addChild(card);
card.addEventListener(MouseEvent.CLICK,checkCards);
cardsRandom.push(card);
card.setType(allCardsArray[i]);
card.y=10 + i % 6 * 92;
card.x=10 + Math.floor(i / 6) * 72;
bmp2=allCardsArray2[i];
card=new Card ;
addChild(card);
card.addEventListener(MouseEvent.CLICK,checkCards);
cardsRandom.push(card);
cardArray.push(allCardsArray[i]);
card.setType(allCardsArray2[i]);
card.y=10 + i % 6 * 92;
card.x=370 + Math.floor(i / 6) * 72;
}
} else {
loadCardNum(allCardsArray.length);
}//run the loadCardNum() function if no card is loaded
}
//--------------------------------------------------------------------------------------------------
private function checkCards(event:MouseEvent):void {
var card:MovieClip=event.currentTarget as MovieClip;
card.removeEventListener(MouseEvent.CLICK,checkCards);
// get how many cards is opened
var size:int=cardArray.length;
// we check whether there is already card opened
if (size == 1) {// yes there is 1 card is opened
// do all the matching process here
if (String(cardArray[0]._type) == String(card._type)) {
trace("match!");
cardArray=new Array ;
} else {
trace("wrong!");
}
} else {
// if there is no card opened yet, add current card to cardArray
addCardArray(card);
}
}
// method that will add all card that is currently opened into an array
private function addCardArray(card:MovieClip) {
// check if there are already 2 cards in our cardArray, if it does... we close them first and then clear them from array.
if (cardArray.length > 1) {
// use a variable to mark down the length;
var size:int=cardArray.length;
// loop through cardArray to close the card.
for (var i:int=0; i < size; i++) {
var c:MovieClip=cardArray[i];
// close the card, you can call your own function that will close the card or can call gotoAndPlay function straightaway here.
c.gotoAndPlay("flipBack");
c.addEventListener(MouseEvent.CLICK,checkCards);
}
// clear the array index starting from index 0; so you will get a blanked array again.
cardArray.splice(0,size);
}
// add a new card to the array
cardArray.push(card);
}
ActionScript Code:
cardArray.push(card);
the problem now is where is the best place to put this code in. I've tried put it in the loop, but no luck. Any ideas?
Memory Game Matching Problem
I'm doing a memory flip & match card game. Right now my problem in the script is every 2 cards I clicked the result is also "correct" How could I fix this problem?
"cardArray.push(card);" or "cardArray.push(event.currentTarget);" or "cardArray.push(cardArray);"
the problem now is where is the best place to put this code in. I've tried put it in the loop, but no luck. Any ideas?
Attach Code
private function cardLoaded(e:Event):void {
var bmp:Bitmap=Bitmap(l.content);
//create a var to hold the loaded cards
var bmpd:BitmapData=bmp.bitmapData.clone();
var bmp2:Bitmap=new Bitmap(bmpd);
allCardsArray.push(bmp);
allCardsArray2.push(bmp2);
//send the loaded cards to an array
l.contentLoaderInfo.removeEventListener(Event.COMPLETE,cardLoaded);
l.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,cardNotLoaded);
if (allCardsArray.length == 30) {
// if cards loaded into the array = 30
trace("All cards were loaded!");
for (var i:int=0; i < allCardsArray.length; i++) {
bmp=allCardsArray[i];
//current bmp = what ever card in array
card=new Card;
addChild(card);
card.addEventListener(MouseEvent.CLICK,checkCards);
cardsRandom.push(card);
card.setType(allCardsArray[i]);
card.y=10 + i % 6 * 92;
card.x=10 + Math.floor(i / 6) * 72;
bmp2=allCardsArray2[i];
card=new Card;
addChild(card);
card.addEventListener(MouseEvent.CLICK,checkCards);
cardsRandom.push(card);
cardArray.push(allCardsArray[i]);
card.setType(allCardsArray2[i]);
card.y=10 + i % 6 * 92;
card.x=370 + Math.floor(i / 6) * 72;
}
} else {
loadCardNum(allCardsArray.length);
}//run the loadCardNum() function if no card is loaded
}
private function checkCards(event:MouseEvent):void {
var card:MovieClip=event.currentTarget as MovieClip;
card.removeEventListener(MouseEvent.CLICK,checkCards);
// get how many cards is opened
var size:int=cardArray.length;
// we check whether there is already card opened
if (size == 1) {// yes there is 1 card is opened
// do all the matching process here
if (String(cardArray[0]._type) == String(card._type)) {
trace("match!");
cardArray=new Array;
} else {
trace("wrong!");
}
} else {
// if there is no card opened yet, add current card to cardArray
addCardArray(card);
}
}
// method that will add all card that is currently opened into an array
private function addCardArray(card:MovieClip) {
// check if there are already 2 cards in our cardArray, if it does... we close them first and then clear them from array.
if (cardArray.length > 1) {
// use a variable to mark down the length;
var size:int=cardArray.length;
// loop through cardArray to close the card.
for (var i:int=0; i < size; i++) {
var c:MovieClip=cardArray[i];
// close the card, you can call your own function that will close the card or can call gotoAndPlay function straightaway here.
c.gotoAndPlay("flipBack");
c.addEventListener(MouseEvent.CLICK,checkCards);
}
// clear the array index starting from index 0; so you will get a blanked array again.
cardArray.splice(0,size);
}
// add a new card to the array
cardArray.push(card);
}
AS3 - Memory Game Matching Problem.
I'm doing a memory flip & match card game. Right now my problem in the script is every 2 cards I clicked the result is also "correct" How could I fix this problem?
ActionScript Code:
private function cardLoaded(e:Event):void {
var bmp:Bitmap = Bitmap(l.content);
//create a var to hold the loaded cards
var bmpd:BitmapData = bmp.bitmapData.clone();
var bmp2:Bitmap = new Bitmap(bmpd);
allCardsArray.push(bmp);
allCardsArray2.push(bmp2);
//send the loaded cards to an array
l.contentLoaderInfo.removeEventListener(Event.COMPLETE, cardLoaded);
l.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, cardNotLoaded);
if (allCardsArray.length == 30) {
// if cards loaded into the array = 30
trace("All cards were loaded!");
for (var i:int=0; i<allCardsArray.length; i++) {
bmp = allCardsArray[i];
//current bmp = what ever card in array
card = new Card;
addChild(card);
card.addEventListener(MouseEvent.CLICK,checkCards);
cardsRandom.push(card);
card.setType(allCardsArray[i]);
card.y = 10+((i%6)*92);
//each colum have 6 card, with the height of 90
card.x = 10+(Math.floor(i/6)*72);
//x distance = 70, for 6 columns
bmp2 = allCardsArray2[i];
card = new Card;
addChild(card);
card.addEventListener(MouseEvent.CLICK,checkCards);
cardsRandom.push(card);
card.setType(allCardsArray2[i]);
card.y = 10+((i%6)*92);
card.x = 370+(Math.floor(i/6)*72);
}
cardArray.push(card);
randomizeCards(cardsRandom);
//randomize cards sent to cardsRandom array
timer();
} else {
loadCardNum(allCardsArray.length);
}//run the loadCardNum() function if no card is loaded
}
ActionScript Code:
cardArray.push(card)
the problem now is where is the best place to put this code in. I've tried put it in the loop, but no luck. Any ideas?
Memory Game Matching Problem
I'm doing a memory flip & match card game. Right now my problem in the script is every 2 cards I clicked the result is also "correct" How could I fix this problem?
Code:
private function cardLoaded(e:Event):void {
var bmp:Bitmap=Bitmap(l.content);
//create a var to hold the loaded cards
var bmpd:BitmapData=bmp.bitmapData.clone();
var bmp2:Bitmap=new Bitmap(bmpd);
allCardsArray.push(bmp);
allCardsArray2.push(bmp2);
//send the loaded cards to an array
l.contentLoaderInfo.removeEventListener(Event.COMPLETE,cardLoaded);
l.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,cardNotLoaded);
if (allCardsArray.length == 30) {
// if cards loaded into the array = 30
trace("All cards were loaded!");
for (var i:int=0; i < allCardsArray.length; i++) {
bmp=allCardsArray[i];
//current bmp = what ever card in array
card=new Card ;
addChild(card);
card.addEventListener(MouseEvent.CLICK,checkCards);
cardsRandom.push(card);
card.setType(allCardsArray[i]);
card.y=10 + i % 6 * 92;
card.x=10 + Math.floor(i / 6) * 72;
bmp2=allCardsArray2[i];
card=new Card ;
addChild(card);
card.addEventListener(MouseEvent.CLICK,checkCards);
cardsRandom.push(card);
cardArray.push(allCardsArray[i]);
card.setType(allCardsArray2[i]);
card.y=10 + i % 6 * 92;
card.x=370 + Math.floor(i / 6) * 72;
}
} else {
loadCardNum(allCardsArray.length);
}//run the loadCardNum() function if no card is loaded
}
//--------------------------------------------------------------------------------------------------
private function checkCards(event:MouseEvent):void {
var card:MovieClip=event.currentTarget as MovieClip;
card.removeEventListener(MouseEvent.CLICK,checkCards);
// get how many cards is opened
var size:int=cardArray.length;
// we check whether there is already card opened
if (size == 1) {// yes there is 1 card is opened
// do all the matching process here
if (String(cardArray[0]._type) == String(card._type)) {
trace("match!");
cardArray=new Array ;
} else {
trace("wrong!");
}
} else {
// if there is no card opened yet, add current card to cardArray
addCardArray(card);
}
}
// method that will add all card that is currently opened into an array
private function addCardArray(card:MovieClip) {
// check if there are already 2 cards in our cardArray, if it does... we close them first and then clear them from array.
if (cardArray.length > 1) {
// use a variable to mark down the length;
var size:int=cardArray.length;
// loop through cardArray to close the card.
for (var i:int=0; i < size; i++) {
var c:MovieClip=cardArray[i];
// close the card, you can call your own function that will close the card or can call gotoAndPlay function straightaway here.
c.gotoAndPlay("flipBack");
c.addEventListener(MouseEvent.CLICK,checkCards);
}
// clear the array index starting from index 0; so you will get a blanked array again.
cardArray.splice(0,size);
}
// add a new card to the array
cardArray.push(card);
}
Code:
cardArray.push(card);the problem now is where is the best place to put this code in. I've tried put it in the loop, but no luck. Any ideas?
Simple Matching Game Problems (newbie) :P
This is a matching button in my flash files! i have six buttons in my matching game! So can anyone teach me. How to show a win message, when all the six buttons is correctly match to each other? thanks!
The Code:
onClipEvent (load) {
origX = this._x;
origY = this._y;
}
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.startDrag();
}
}
onClipEvent (mouseUp) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.stopDrag();
if (this.hitTest(_parent.eye)) {
this._x = _parent.eye._x;
this._y = _parent.eye._y;
} else {
this._x = origX;
this._y = origY;
}
}
}
Flash MX - Matching Word With Picture Game
I am trying to create a teaching game like snap or fishes, where there are about 20 cards face down and when clicked they turn over and when you get the matching picture card followed by the matching word card something appears to say that its a correct pair. I know how to create the game if its a straight forward picture snap. (Flash creates another matching image) However I dont know how to do it with different cards (Word + Picture)
If anyone can help or point me in the direction of a file to download to see how its done, that would be great - THANKS!
Trying To Create Simple Vocab Matching Game
Hello all!
i'm very new to Flash (i have Swish and have created some animations but nothing like what i'm trying now).
i'm hoping to create a simple matching program for Spanish vocab words. Something similar to Concentration only with all the cards face up. All i need the game to do is match the correct word pairs. Does anyone know of a program or utility i could use to help create this? i know, i know, it's probably sacrilegious to come to a coding site and ask for a program but i know nothing about scripting.
Any help at all would be greatly appreciated!
Also, i did try searching the forums but didn't find anything and i reviewed the guidelines and FAQ and didn't see anything about not asking for utilities. If i'm in the wrong place or out of line with this post i'm very sorry and if you let me know i'll fix it. Thanks again,
Zoe
Create A 4x4 Tile Word Matching Game
I am a .net developer, but I was asked to create a 4x4 tile word matching game.
It's like a memory game where you flip two tiles to match the words. And it gives the percentage and time at the end.
Is there any template that I can find to start this mini-project?
Thank you.
Drag & Drop Matching Location Quiz Game
I am producing a simple game and this is my first time using actionscript.
The problem is surrounding a word game with drag and drop zones, I have achieved dragging and dropping onto zones, but I also have a button to check the locations match correctly, this worked well until I have two drags ( the same letter) being able to be dropped into two different drop zones and still be a correct match.
I have attached the .fla file this obviously works when you hit the 'check' button but ony if the letters are placed in the order shown, if the 'a' is put the other 'a' position there would be an incorrect result.
Thanks for any help in advance.
My Game....matching Game.
this my example for my game that i have create,can anyone help me and what really wrong with my game,coz the picture not appear went i execute this file.......really need help on this
Name/Value Pairs
Hello,
What am I doing wrong?
FLASH:
Code:
var saveLV:LoadVars = new LoadVars();
var loadLV:LoadVars = new LoadVars();
saveLV.myContent = "&myContent=This is a test";
loadLV.onLoad = function (success:Boolean){
if(success){
trace(this.test);
}else{
trace("FAILED");
}
}
saveLV.sendAndLoad("admin/test.php", loadLV);
PHP:
Code:
<?php
$testvar = 'HELLO THERE'
echo "&test=$testvar";
?>
Thanks
LoadVariables() - More Than Name/value Pairs?
I would like to be able to load from an external ASCII file data that consists of more than name/value pairs, ideally in array format. For example:
-- begin data.txt --
incidents[0] = new incident(1020046, 'On Fifth Ave., traffic lights are out btwn. Thackeray St. & Meyran Ave.', 'OAKLAND', 2, '', 'Defective traffic lights', 'ADVISORY');
incidents[1] = new incident(1020157, 'Jammed Green Tree to the Fort Pitt Tunnel', 'PARKWAY WEST', 2, 'Inbound', 'Unspecified', 'ADVISORY');
-- end data.txt --
Is there a way I can load more than name/value pairs without writing a complex parser to decode my array information?
Thanks
XML Name Value Pairs +++++ Urgent
Can anyone help me by suggesting a script which can locate all XML nodes in an xml document with labels and check their associated node values, returning the two as name-value pairs.
Name=value Pairs To An Array - Please Help
I have a string as follows:
=============================
ad3=5&ad2=4&ad1=4&mover=4&mortgage=5&broker=0
=============================
Before declaring the array below I want to check the string for existing "counts".
I want to take the values above and adjust the "counts" in the following array:
============================
ad0 = {name:"broker", count:0};
ad1 = {name:"mortgage", count:0};
ad2 = {name:"mover", count:0};
ad3 = {name:"ad1", count:0};
ad4 = {name:"ad2", count:0};
ad5 = {name:"ad3", count:0};
adArray = [ad0, ad1, ad2, ad3, ad4, ad5];
=============================
One caveat is that the string may not exist - in which case the "counts" should obviously be set to zero.
Looking for a kind soul....
SNAP/Pairs
Hello All,
Im creating a game of snap/match the pairs for children.
There will be 5 pair, where they are positioned will never change, but....
how do i reveal two at a time?
how do i make the pairs recognise that they are the same? and keep them visible?
how do a make two mis-matches 'un-reveal' themselves
Any ideas?
How Do I Get Name/values Pairs In URL?
My flash movie is part of my PHP page.
I want to be able to read the URL and do something with the flash movie. How?
Example:
URL: HTTP://www.mydomain.com/myPage.php?var=test
Flash logic: If var = "test" then start the movie in a different location
Please help...
Trouble With Making Pairs
Am trying to make a game of pairs (the old game where you have to match two cards that are the same) and i have done a function to turn over the card and check if you have two the same but there is a problem. It seams to remember the path for the First movie clip but once i have clicked on a second clip, it doesn't seam to store do anything with that. I'll post the function and then see if i can explain better.
Code:
function CardCheck(num){
//This Checks what card you have clicked on
_root.mc.Card.gotoAndStop(7);
_root.mc.Card.CardFront.gotoAndStop(_root.CardArray[num]);
if (_root.CardClicks == 0){
_root.CardA = _root.CardArray[num];
_root.CardClicks = 1;
_root.PathA = _root.mc;
}
else if (_root.CardClicks == 1){
_root.CardB = _root.CardArray[num];
_root.CardClicks = 0;
_root.PathB = _root.mc;
if (_root.CardA == _root.CardB){
_root.PathA.Card.gotoAndPlay(2);
_root.PathB.Card.gotoAndPlay(2);
}
else
{
_root.PathA.Card.play();
_root.PathB.Card.play();
}
}
}
Now, _root.mc is where set to be 'this' on the code for the movie clip in question so that should be the route of that clip. PathA should store the path for the first card movie object and PathB should be the second. Card is the name of a movie clip instead that clip which has the animations and such for the cards. Num is the number of the card and it checks with an array to what card image is set there. CardFront is the image that will be displayed on the card then it is turned. I don't think much more needs to be explained in that function. Just ask if you think i need to.
For some reason, it works fine goes though the code BUT only seam to have the 'PathA' lines taking effect. PathB card just stays still as if nothing happens. When i debug, even the first line of changing the card's frame doesn't work. Any ideas? i am clueless.
Well.. there is one clue. The code in the Movie clips that is being click on is:
Quote:
onClipEvent(mouseDown){
if (hitTest( _root._xmouse, _root._ymouse, false)) {
if (this.Card._currentframe == 1) {
_root.mc = this;
_root.CardCheck(1);
}
}
}
The number to pass to the CardCheck changes with whatever card number it is. I put the mouse checking that it is that clip being clicked because if i didn't, it fired no matter what has been clicked on.
|