Help Memory Game
Hi eryone, I am making a game where you watch the buttons on a trumpet go down then copy the pattern, but I can't get it to work. Here is the fla www.redtrumpet.info/games/tpt.fla
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 05-16-2006, 03:44 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Memory Game - Could You Help Me Out?
Hi,
I've downloaded subways F4 memory game:
http://www.flashkit.com/movies/Games...86/index.shtml
I'm having some difficulties with the code though.
I want to make a birthday card for my little brother and i want to add all the pictures of the family. We are with 10 members. would really want to add two more pairs to the game so there would be 20 cards (4*5 or 5*4). I would be very glad if someone could help me out and assist me in how I should alter the file so an extra column (or row) will appear.
Would someone help me? You would make me and my family very glad!
Thank you very much in advance,
Andries van der Leij
Help With Memory Game
i am trying to model my game after the one seen at:
http://www.flashhog.com/3guys
if you do not want to take a trip there, although its a funny game, its just three guys with beers sitting on a couch. a cat on the floor says "watch" and then the guys will randomly move. one guy burps, one farts, one spits, and the dog on the floor coughs. you will see a random pattern of these events. then the cat will say "your turn" and its up to the player to click the guys in the right order. every round another event is added.
i want to make a game like that. can anyone teach me how?
Memory Game Help
Im trying to create a memory game in flash mx. I have 15 white boxes total(3rows 5collums) that I converted to buttons. On the down state I want a picture to appear and stay. Then when you click on another box it is a match it disappears if not then they turn back to white boxes. What code will i need to make this work?
Anyone Try The BEF Memory Game Tut?
I was trying to make a simple memory game and wanted to use the BEF tut for this, but when I was working through it, I could not get the cards to turn over. Has anyone tryed to follow this tutorial and get it to work? I think I narrowed the problem to the following code snippet:
on (release)
{
if (((_root.cardsInPlay<2) && (this.theCard._currentframe<=1)))
{
if (_root.cardsInPlay == 1)
{
_root.card2Match = this.theCard.cardFace._currectframe;
}
this.theCard.play();
_root.attemptCount++;
_root.gameAttempts = "Attempts: "+Math.roun(_root.attemptCount/2);
}
}
Memory Game
I have to make memory game.
Can somebody send me .fla file which works for eny memory game.
Thank you...bye!
Memory Game
Hello,
I am trying to do a simple Memory Game in Flash 8. The examples I have found are much more complicated than what this game needs to be so I was trying to create my own from scratch. There is no random needed just 8 cards on the screen so 4 matches total. When they get a match the pair visibility turns off and when they are all matched it goes to a finished screen. I have all of that working great but I am having 2 problems.
Problem 1:
When the user selects the wrong card that isnt a match I need it to flip back over and set the variables back to 0. I cant figure out how to do this without writing a conditional statement for each possible order the user could select them in.
Problem 2:
When they select the second card and it is a match the match disappears which is good but it goes so quickly that the user doesnt even have time to see that they got the match. I would like it to delay so it doesnt disappear so fast.
I would really appreciate any help here. I have attached the FLA file so you can look at the functionality.
Thanks so much!!!
Movie Clips On Stage
card1a
card1b
card2a
card2b
card3a
card3b
card4a
card4b
card1a matches with card1b
card2a matches with card2b
card3a matches with card3b
card4a matches with card4b
Actions on Root Level
On Frame 1:
_global.match1=0
_global.match2=0
_global.match3=0
_global.match4=0
On Frame 5:
card1a.onRelease = function() {
_root.card1a.play();
};
card1b.onRelease = function() {
_root.card1b.play();
};
card2a.onRelease = function() {
_root.card2a.play();
};
card2b.onRelease = function() {
_root.card2b.play();
};
card3a.onRelease = function() {
_root.card3a.play();
};
card3b.onRelease = function() {
_root.card3b.play();
};
card4a.onRelease = function() {
_root.card4a.play();
};
card4b.onRelease = function() {
_root.card4b.play();
};
On Frame 6:
if ((_global.match1 == 2) && (_global.match2 == 2) && (_global.match3 == 2) && (_global.match4 == 2)) {
_root.gotoAndPlay(10);
} else {
_root.gotoAndPlay(_currentframe-1);
}
if (_global.match1 == 2) {
card1a._visible = false;
card1b._visible = false;
}
if (_global.match2 == 2) {
card2a._visible = false;
card2b._visible = false;
}
if (_global.match3 == 2) {
card3a._visible = false;
card3b._visible = false;
}
if (_global.match4 == 2) {
card4a._visible = false;
card4b._visible = false;
}
Actions within Movie Clips
card1a
Frame 1:
stop();
Frame 5:
_global.match1 = (_global.match1) + 1
trace(_global.match1);
stop();
Frame 10:
_global.match1 = (_global.match1) - 1
trace(_global.match1);
card1b
Frame 1:
stop();
Frame 5:
_global.match1 = (_global.match1) + 1
trace(_global.match1);
stop();
Frame 10:
_global.match1 = (_global.match1) - 1
trace(_global.match1);
card2a
Frame 1:
stop();
Frame 5:
_global.match2 = (_global.match2) + 1
trace(_global.match2);
stop();
Frame 10:
_global.match2 = (_global.match2) - 1
trace(_global.match2);
card2b
Frame 1:
stop();
Frame 5:
_global.match2 = (_global.match2) + 1
trace(_global.match2);
stop();
Frame 10:
_global.match1 = (_global.match2) - 1
trace(_global.match2);
card3a
Frame 1:
stop();
Frame 5:
_global.match3 = (_global.match3) + 1
trace(_global.match3);
stop();
Frame 10:
_global.match3 = (_global.match3) - 1
trace(_global.match3);
card3b
Frame 1:
stop();
Frame 5:
_global.match3 = (_global.match3) + 1
trace(_global.match3);
stop();
Frame 10:
_global.match3 = (_global.match3) - 1
trace(_global.match3);
card4a
Frame 1:
stop();
Frame 5:
_global.match4 = (_global.match4) + 1
trace(_global.match4);
stop();
Frame 10:
_global.match4 = (_global.match4) - 1
trace(_global.match4);
card4a
Frame 1:
stop();
Frame 5:
_global.match4 = (_global.match4) + 1
trace(_global.match4);
stop();
Frame 10:
_global.match4 = (_global.match4) - 1
trace(_global.match4);
Memory Game Help How To Do The Pop Up?
hi all..
actually the memory card i already created without problem.
What i facing is the pop up.
Its like when user have choose the correct pair. i wanna have a pop-up windows stating the user has won a prize.
http://www.sendspace.com/file/znr1z1
the link above is the flash memory card game.
i wanna do something like that.
When choosen the correct pair. there is a pop-up stating you have won something!
i hope you guys can help! Thanks in advance!
Memory Game Help
Hello
I wonder if someone could help me out with this memory game problem.
I have a working memory that loads 15 images random each time the game starts. That is 30 card with 15 images. They duplicate. When I find two equal images they stay open.
Now on to the problem.
What to do if Id like to replace a set of images for example:
image 1 x duplicate with image 1 x image2.
Instead of a duplicat Id like to get two images to belong to each other.
It must be inside the code and im not a master in actionscripting.
Someone....
best regards
micron
Memory Game Help
hi am making a simple memory game where the user has to remember a set pattern of movements e.g. four different colours user has to remember what order they are pressed
basically i need to know if it is possible to make this process random and how i would go about setting it up so the user can guess the process
all examples and pointers welcome
cheers
Memory Game
Hey!
I’m creating a “memory game” in flash 8. For now, I’m trying to do it with only 3 objects.
In these 3 objects, objA corresponds with objB. When objA and objB are selected, “nice” will appear in the main timeline.
I’m having trouble corresponding objA and objB. This is the code I have for each object, can anyone tell me what I’m doing wrong?
object1:
onClipEvent(load)
{
objA=1;
}
on (press)
{
objA=A;
gotoAndPlay("active");
}
on (release)
{
if (objA==A && objB==B)
{
_root.gotoAndPlay("nice");
} else{
this.gotoAndPlay("inactive");
}
}
object2:
onClipEvent(load)
{
objB=1;
}
on (press)
{
objB=B;
gotoAndPlay("active");
}
on (release)
{
if (objA==A && objB==B)
{
_root.gotoAndPlay("nice");
} else{
this.gotoAndPlay("inactive");
}
}
object3:
onClipEvent(load)
{
objC=1;
}
on (press)
{
objC=C;
gotoAndPlay("active");
}
on (release)
{
if (objC==C && objD==D)
{
_root.gotoAndPlay("nice");
} else{
this.gotoAndPlay("inactive");
}
}
Memory Game
I'd like to find a tutorial which teaches you how to create a memory game in Flash 5.
Thank you.
Memory Game
Hi
i am looking for some good memory tutorials made in newer flash version (e.g. flash mx 2004)
I have only found some stupid old game made in flash 4...
I prefer a game that uses xml to get the cards and involves a highscore.
Thanks for your links
Another Memory Game
can anyone help me with the codes?
i was able to code to make my cards shuffle. but how will i make the computer know if the cards match?
i have 20 cards.
Memory Game
Hello,
I am trying to do a simple Memory Game in Flash 8. The examples I have found are much more complicated than what this game needs to be so I was trying to create my own from scratch. There is no random needed just 8 cards on the screen so 4 matches total. When they get a match the pair visibility turns off and when they are all matched it goes to a finished screen. I have all of that working great but I am having 2 problems.
Problem 1:
When the user selects the wrong card that isnt a match I need it to flip back over and set the variables back to 0. I cant figure out how to do this without writing a conditional statement for each possible order the user could select them in.
Problem 2:
When they select the second card and it is a match the match disappears which is good but it goes so quickly that the user doesnt even have time to see that they got the match. I would like it to delay so it doesnt disappear so fast.
I would really appreciate any help here. I have attached the FLA file so you can look at the functionality.
Thanks so much!!!!!
Movie Clips On Stage
card1a
card1b
card2a
card2b
card3a
card3b
card4a
card4b
card1a matches with card1b
card2a matches with card2b
card3a matches with card3b
card4a matches with card4b
Actions on Root Level
On Frame 1:
_global.match1=0
_global.match2=0
_global.match3=0
_global.match4=0
On Frame 5:
card1a.onRelease = function() {
_root.card1a.play();
};
card1b.onRelease = function() {
_root.card1b.play();
};
card2a.onRelease = function() {
_root.card2a.play();
};
card2b.onRelease = function() {
_root.card2b.play();
};
card3a.onRelease = function() {
_root.card3a.play();
};
card3b.onRelease = function() {
_root.card3b.play();
};
card4a.onRelease = function() {
_root.card4a.play();
};
card4b.onRelease = function() {
_root.card4b.play();
};
On Frame 6:
if ((_global.match1 == 2) && (_global.match2 == 2) && (_global.match3 == 2) && (_global.match4 == 2)) {
_root.gotoAndPlay(10);
} else {
_root.gotoAndPlay(_currentframe-1);
}
if (_global.match1 == 2) {
card1a._visible = false;
card1b._visible = false;
}
if (_global.match2 == 2) {
card2a._visible = false;
card2b._visible = false;
}
if (_global.match3 == 2) {
card3a._visible = false;
card3b._visible = false;
}
if (_global.match4 == 2) {
card4a._visible = false;
card4b._visible = false;
}
Actions within Movie Clips
card1a
Frame 1:
stop();
Frame 5:
_global.match1 = (_global.match1) + 1
trace(_global.match1);
stop();
Frame 10:
_global.match1 = (_global.match1) - 1
trace(_global.match1);
card1b
Frame 1:
stop();
Frame 5:
_global.match1 = (_global.match1) + 1
trace(_global.match1);
stop();
Frame 10:
_global.match1 = (_global.match1) - 1
trace(_global.match1);
card2a
Frame 1:
stop();
Frame 5:
_global.match2 = (_global.match2) + 1
trace(_global.match2);
stop();
Frame 10:
_global.match2 = (_global.match2) - 1
trace(_global.match2);
card2b
Frame 1:
stop();
Frame 5:
_global.match2 = (_global.match2) + 1
trace(_global.match2);
stop();
Frame 10:
_global.match1 = (_global.match2) - 1
trace(_global.match2);
card3a
Frame 1:
stop();
Frame 5:
_global.match3 = (_global.match3) + 1
trace(_global.match3);
stop();
Frame 10:
_global.match3 = (_global.match3) - 1
trace(_global.match3);
card3b
Frame 1:
stop();
Frame 5:
_global.match3 = (_global.match3) + 1
trace(_global.match3);
stop();
Frame 10:
_global.match3 = (_global.match3) - 1
trace(_global.match3);
card4a
Frame 1:
stop();
Frame 5:
_global.match4 = (_global.match4) + 1
trace(_global.match4);
stop();
Frame 10:
_global.match4 = (_global.match4) - 1
trace(_global.match4);
card4a
Frame 1:
stop();
Frame 5:
_global.match4 = (_global.match4) + 1
trace(_global.match4);
stop();
Frame 10:
_global.match4 = (_global.match4) - 1
trace(_global.match4);
Memory Game
Is there a (semi) simple way to produce a memory game like this one?:
http://www.zefrank.com/memory/
I can draw all possible frames but there's bound to be a better way...
Memory Game
I'd like to find a tutorial which teaches you how to create a memory game in Flash 5.
Thank you.
Memory Game
hello,
i would like some help on building a memory game, you know the one with the cards faced down, and you have to pick two that have the same content.
i'm using a 6x6 board (36 cards), but i'm having problems writing the part of the code that attrib's the content to the cards, i can only give the same value to 2 diferent cards taken random from the deck, .... you know the game.
thanks anyway
Memory Game
hiya...
I wondered if anyone had a good simple example of a matching/memory game in Flash. I want the user to be able to click on a box and it will flip to show an image, and then click on another box to try and match. if they don't match then both cards flip back over, if they do match then they disappear. When the user matches all the cards, they get feedback.
If anyone has any work examples or some good suggestions to get me started it would be much appreciated.
thank-you
Memory Game Conflicts - Can You Pls. HELP
I am in dyer need of some scripting help if you can. I have a Memory game for kids. I am using 3 animals, and their corresponding (3) names. The game works fine [but only when the selcetions are made from top row to btm. row]. I have the animals across the top and their names that match below them. If the user starts of by clicking on a btm row card, the script gets confused and does not work. Just like me, confused... Below are 2 of the main frames of coding. There are 2 more frames with coding but I feel the trouble is somewhere below. If you can help me sort this out I sure would be grateful. Many thanks in advance for using your time to look this over for me.
//variables declaration
var sorted = new Array();
var words = new Array('dog','cat','bird');
var arrayPics = new Array();
var arrayNames = new Array();
var elements = 3;
var checkIndex;
var count;
var counter;
var obj1;
var obj2;
var element1;
var element2;
var imgs;
//Step to store picture names in the arrayPics
arraySort();
for(i=0;i<=sorted.length-1;i++){
arrayPics.push(words[sorted[i]]);
}
delete sorted;
//Step to store picture names in the arrayNames
var sorted = new Array();
arraySort();
for(i=0;i<=sorted.length-1;i++){
arrayNames.push(words[sorted[i]]);
}
//This function randomize the numbers that will be used to change the
//Pictures postion
function arraySort(){
var i = 0;
var n = elements;
var ni = elements;
while ( i<=n ) {
number=random(ni);
if (i==0) {
sorted.push(number);
i = i + 1;
}
for ( j=0; j<=(i - 1); j++ ) {
c=0;
for ( k=0; k<=(i-1); k++ ) {
if ( sorted[k]==number ) {
c=1;
}
}
if (c==1) {
break;
}
sorted.push(number);
i = i + 1;
}
if ( i == ni ) {
i = i + 1;
}
}
}
// Function to duplicate and place the movie Clips as well as assing
// some values to them
function start(){
xpos = 250;
ypos = 250;
for(i=0;i<=5;i++){
duplicateMovieClip(mc,'mc'+i,i);
newMc = eval('mc'+i);
with(newMc){
_x = xpos;
_y = ypos;
xpos = _x + _width + 10;
}
if(i==2){
xpos = 250;
ypos = newMc._y + newMc._height + 10;
}
if(i<=2){
newMc.value = arrayNames[i];
}
if(i>2){
newMc.value = arraypics[i-3];
newMc.word = arraypics[i-3];
}
newMc.index = i;
}
}
// This function will be called by click events that will be raised by the
// buttonswhere the images or the names will be placed
function checkIt(obj,name,index){
counter+=1;
checkIndex = index;
if(counter==2){
timeCounter.flag = true;
counter = 0;
checkIndex = ""
}
if(index<=2){
count+=1;
obj1 = obj;
element1 = name;
duplicateMovieClip(img,"img"+count,count+10);
block = eval("img"+count);
imgs = block;
with(block){
attachMovie(name,name,count+20);
_x = obj._x;
_y = obj._y;
_width = 78;
_height = 78;
}
obj._visible = 0;
}
if(index>2){
obj.gotoAndStop(2);
obj2 = obj;
element2 = name;
}
}
// This function will check the matching and will be called by the timerCount
// movie clip. This movie clip will delay one second for each click.
function analyse(){
if(element1<>element2){
imgs.removeMovieClip();
obj1._visible = 1;
obj2.gotoAndStop(1);
} else {
elements-=1;
}
if(elements==0){
count = 0;
gotoAndPlay("labEnd");
}
}
Memory Card Game
Hello all,
I am web designer; I am learner in action scripts
I wanted to create a flash game (memory card game) and score should be saved in to database. Please suggest me how use python/perl
Can u help me in this.. http://www.cleverpig.com/examples/memory.htm this is the sample url
I wanted to make same as this but result (score) will be saved in BD.
Warm Regards
Rajeev
Flash Memory Game Help
how could i make a memory game like this one
http://pbskids.org/caillou/games/memory/index.html
I just want it so when you choose a correct match then it will say at the bottom of the screen *whoo hoo* or whatever
Flash Memory Game
how could i make a memory game like this one
http://pbskids.org/caillou/games/memory/index.html
I just want it so when you choose a correct match then it will say at the bottom of the screen *whoo hoo* or whatever
Memory Game MX 2004
Trying to chance a matching game from making a pair of two eqal to making a pair of two different, but matching cards (ex.: mouse and cheese).
Have made a movieclip with 13 frames:
first frame = back of card.
frame 2 and 3 matches, 4 and 5 etc.
Tried to make the following code match the job:
Of couse it wont work, because I havent managed to tell the code to match frame 2 and 3 etc. The code is still looking for a match of two identical frames...
Is this getting too complicates?
initGame();
stop();
function initGame() {
cardsListOrdered = [];
for(i=1;i<=12;i++) {
cardsListOrdered.push()
}
cardsListSorted = [];
while (cardsListOrdered.length > 0) {
r = int(Math.random()*cardsListOrdered.lenght);
cardsListSorted.push(cardsListOrdered[r]);
cardsListOrdered.splice(r,1);
}
x = 0;
y = 0;
for(i=0;i<12;i++) {
attachMovie("Card","Card"+i,i);
_root["Card"+i].picture = cardsListSorted[i];
_root["Card"+i]._x = x*79+140;
_root["Card"+i]._y = y*72+130;
x++;
if (x > 3) {
x = 0;
y++;
}
}
firstclip = 0;
}
function clickCard(clip) {
if (secondclip != 0) {
firstclip.gotoAndStop(back);
secondclip.gotoAndStop(back);
firstClip = 0;
secondClip = 0;
}
if (firstclip == clip) {
firstclip.gotoAndStop(back),
firstClip = 0;
} else if (firstclip == 0) {
clip.gotoAndStop(clip.pair+1);
firstclip = clip;
} else {
clip.gotoAndStop(clip.pair+1+b);
secondClip = clip;
if (firstclip.pair1 == secondClip.pair1b) {
firstClip.removeMovieClip();
secondClip.removeMovieClip();
firstClip = 0;
secondClip = 0;
}
}
}
stop();
Memory Card Game (almost Done)
Hiya,
I'm trying to make a memory cards game but I am stuck...
I dont know why the game ismt working.
here is the fla-
http://members.lycos.co.uk/xtks/poke_m.fla
can u tell me pkease what do I need to add to make it work?
thanks
[F8] Memory Card Game
Hello there,
Im creating a card game and I'm having problems with the animation part. Here are the details:
I have:
1 movie clip call Carta that contains the animation for showing the card, this is the layer that I'm going to drag into the main stage. This mc is made of
-- 1 mc called cartaFrente instanciated as "cartaCara" that contains all the front images I would like to show to the user
-- 1 image containing the back part of the cards.
In the main stage I create an instance for Carta, in this case the instance name is "LaCarta"
in the firts frame I duplicate the instance LaCarta, then bring into the scene changin _x and _y also in this frame I'm trying to show the 2nd card in my Deck, here is the code:
duplicateMovieClip(_root.LaCarta,"mcCarta",1);
with(this["mcCarta"]){
_x = 100;
_y = 100;
_root.laCarta.cartaCara.gotoAndStop(2);
}
In the onRelease event for LaCarta I play the main mc:
on (release) {
_root.LaCarta.play();
}
when running this stuff I click on the mc but nothing happens! What I think it is suppose to run is that when I click then I would be able to see the 2nd card.
Please help me, I cannot find what I'm doing wrong, I'm using flash 8 and ActionScript 2.0
Thank you friends!
[F8] Help On Simple Memory Game...
Hi, im trying to create a simple memory game w/o the use of ARRAYs.
I haven't learned how to use Arrays yet.. anyways
im using a simple algorithm to try and make things work.
Code:
var a_counter:Number = 0;
var b_counter:Number = 0;
var click_counter:Number = 0;
//card 1 cover onRelease
c1_cover.onRelease = function(){
this._alpha = 0; //change alpha to 0
a_counter += 1; //add 1 to a_counter
click_counter += 1;
}
//card 1a cover onRelease
c1_acover.onRelease = function(){
this._alpha = 0; //change alpha to 0
a_counter += 1; //add 1 to a_counter
click_counter += 1;
}
//card 2 cover onRelease
c2_cover.onRelease = function(){
this._alpha = 0; //change alpha to 0
b_counter += 1; //add 1 to b_counter
click_counter += 1;
}
//card 2a cover onRelease
c2_acover.onRelease = function(){
this._alpha = 0; //change alpha to 0
b_counter += 1; //add 1 to b_counter
click_counter += 1;
}
//onEnterFrame
onEnterFrame = function(){
//hide cards aa_card and aa_1card when a_counter is equal to 2
if(a_counter == 2){
aa_card._alpha -= 10;
aa_1card._alpha -= 10;
}
//hide cards bb_card and bb_1card when a_counter is equal to 2
if(b_counter == 2){
bb_card._alpha -= 10;
bb_1card._alpha -= 10;
}
//hide cards aa_card and aa_1card when a_counter is equal to 2
if((click_counter==2)&&(a_counter==1)){
c1_cover._alpha += 10;
c1_acover._alpha += 10;
}
if((click_counter==2)&&(b_counter==1)){
c2_cover._alpha += 10;
c2_acover._alpha += 10;
}
}
here's the code im using...
now if you click on the top cards to match them, then the bottom ones you win. But if you dont match them , it will go to an error.
the problem is... if click_counter == 2, im suppose to reset it back to 0. but i cant simply write
if (click_counter == 2){
click_counter = 0;
}
because it wont reset the cards..
attached is the fla file im using..
very much appreciate it if someone can take a look at it..
thanks
Memory Game Script
New here.
I'm putting together a memory game for my boss with Flash 8 dynamically, and the AS I have does not have code to collect the back of the card jpg from the folder. My expertise is not as high as I would like it to be so an explanation, as well as a solution, would be fantastic.
My question is, "Does anyone know how I would go about attaching a simple .jpg to the back of all the cards instead of a blue box?"
this is the code that I'm using:
PHP Code:
card_w = 70;
card_h = 90;
card_wdistance = 10;
card_hdistance = 10;
card_dw = card_w + card_wdistance;
card_dh = card_h + card_hdistance;
row_card = Math.floor((Stage.width - card_wdistance) / card_dw);
col_card = Math.floor((Stage.height - card_hdistance) / card_dh);
n_card = col_card * row_card % 2 == 0 ? col_card * row_card : (col_card - 1) * row_card;
imgs_n = n_card / 2;
centerImage = function(target){
target.front._visible = false
target.front.container._x -= target.front.container._width / 2
target.front.container._y -= target.front.container._height / 2
}
empty = new Array();
function createCard(n, w, h) {
empty.push(n);
this.createEmptyMovieClip('card' + n, n);
with (this['card' + n]) {
lineStyle(0, 0x000000, 100);
beginFill(0x000099, 60);
moveTo(w / 2, 0);
lineTo(w / 2, h / 2);
lineTo(-w / 2, h / 2);
lineTo(-w / 2, -h / 2);
lineTo(w / 2, -h / 2);
lineTo(w / 2, 0);
endFill();
createEmptyMovieClip('front', 1);
front.createEmptyMovieClip('container', 2);
front.createEmptyMovieClip('backgr', 1);
with (front.backgr) {
moveTo(-w / 2, -h / 2);
lineStyle(0, 0x000000, 0);
beginFill(0x333333, 100);
lineTo(w / 2, -h / 2);
lineTo(w / 2, h / 2);
lineTo(-w / 2, h / 2);
lineTo(-w / 2, -h / 2);
endFill();
}
front.onEnterFrame = function() {
tot = this.container.getBytesTotal();
car = this.container.getBytesLoaded();
if (tot == car && tot > 200) {
this._parent._parent.centerImage(this._parent);
delete this.onEnterFrame;
}
};
}
}
selcards = [];
function placeImages() {
act_img = 0;
for (img = 0; img < imgs_n; img++) {
for (k = 0; k < 2; k++) {
act = Math.round(Math.random() * (empty.length - 1));
this['card' + empty[act]].img_id = act_img;
this['card' + empty[act]].front.container.loadMovie("imgs/img" + act_img + ".jpg");
this['card' + empty[act]].onRelease = function() {
this.rotateCard(0, 0);
this.enabled = false;
MovieClip.prototype.enabled = false;
};
empty.splice(act, 1);
}
act_img++;
}
}
MovieClip.prototype.rotateCard = function(v, i) {
this.operazione = v == 0 ? +0.1 : -0.1;
this.incremento = i == 0 ? 100 : 10;
selcards.push(this._name);
this.onEnterFrame = function() {
this.incremento += this.operazione;
this._xscale = (100 * Math.sin(this.incremento));
if (this._xscale > 0) {
this.front._visible = v == 1 ? false : true;
}
if (this._xscale >= 99) {
delete this.onEnterFrame;
selcards.length < 2 ? MovieClip.prototype.enabled = true : null;
v == 0 && selcards.length > 1 ? checkCards() : null;
}
};
};
function generateGameField(cards, distance, hdistance) {
Ypos = card_h / 2 + hdistance;
Xpos = card_w / 2 + distance;
for (c = 0; c < cards; c++) {
createCard(c, card_w, card_h);
if (c % row_card == 0 && c > 0) {
Ypos += this['card' + c]._height + hdistance;
Xpos = card_w / 2 + distance;
}
this['card' + c]._x = Xpos;
this['card' + c]._y = Ypos;
Xpos += this['card' + c]._width + distance;
}
placeImages();
}
generateGameField(n_card, card_wdistance, card_hdistance);
score = 0;
this.createTextField('punti', -1, 500, 380, 0, 0);
punti.autoSize = true;
punti.text = 0;
function checkCards() {
if (this[selcards[0]].img_id == this[selcards[1]].img_id) {
score++;
punti.text = score;
eval(selcards[0])._visible = eval(selcards[1])._visible = false;
} else {
eval(selcards[0]).rotateCard(1, 1);
eval(selcards[1]).rotateCard(1, 1);
eval(selcards[0]).enabled = eval(selcards[1]).enabled = true;
}
selcards = [];
MovieClip.prototype.enabled = true;
}
I would appreciate any help.
The Ol' Memory Game Question
Hello!
First time poster here, I've been having an issue with Actionscript 3.0 and figured this would be the best place to ask!
I am learning the program through Lynda.com's tutorials by Todd Perkins. After going over functions, custom classes, arrays, loops, and all that good stuff, he is working on coding an old fashioned memory game, you know, the kind where you flip two cards and hope they match!
So, I am following along and doing the same thing in my own files. Where the problem arises is getting the image to appear on the card.
To be more specific, the card is a movie clip. In the movie clip, the bottom layer is a shape tween to make the card look like it's turning. Above that is a movie clip, with alpha to 0, motion tweened to also "turn". This movie clip's instance is called "loader_mc", and, ideally, this movie clip is supposed to hold the graphic. However, though my code is identical to his, no graphic shows up.
So my question is, how can I get this movie clip to accept the graphic? Here is my code:
Card code
ActionScript Code:
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Card extends MovieClip
{
private var _type:*;
public function Card()
{
this.buttonMode = true;
this.addEventListener(MouseEvent.CLICK, onClick);
}
private function onClick(event:MouseEvent):void
{
this.play();
}
public function setType(type:*):void
{
_type = type;
loader_mc.addChild(_type);
}
}
}
Custom Class code
ActionScript Code:
package
{
import flash.display.MovieClip;
import Card;
import Kid;
import Baby1;
public class MemoryGame extends MovieClip;
{
private var _card:Card;
private var _kid:Kid;
private var _baby:Baby1;
public function MemoryGame()
{
createCards();
}
public function createCards():void
{
_card = new Card();
addChild(_card);
_kid = new Kid();
_card.setType(_kid);
}
}
}
I don't get error messages, but I don't get the proper result. I think the problem is not so much the code, but rather, how the movie clipc (loader_mc) is set up. In the tutorial, he just refers to it as a movie clip with the alpha on 0. But there's gotta be something more to that?
I thank you all so much in advance for helping me with this convoluted problem. I'm sorry it's such a long, drawn out, and specific one!
Thanks again!!
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
Advice On Memory Game
Okay, I'm working on creating a memory game for work, but I'm having a little trouble.
Specifically, I'm trying to work out the following sequence:
1. Select first tile. It has an animated flip to reveal the picture.
2. Select second tile. It also has the animated flip.
3. Wait about half a second.
a. If the tiles match, they disappear and a sidebar slides in from the side.
b. If the tiles do not match, they flip back over (again with the animation).
I'm really close, but I keep running into hitches if you click tiles too quickly, or other minor hiccoughs. I'm starting to think that my entire approach to the problem is flawed.
So my question is this: how would youwork this sequence out? I don't need any code, just the theory you'd use to keep everything running smoothly. I'd like to keep it object-oriented, and in AS 2.0, but I'm willing to try just about anything within those constraints. So how 'bout it?
Rys
How Do I Make A Game Like Memory ?
Hi , I am trying to prgrame a very simple game kinda like memory, where you match to movie clips, and than they are a pair and cannot be parted. but I have gotton stuck on the part after a movie clip is dragable.
I can make the movieclip cickable and dragable, I can even make it stop draging as soon as it has met the movieclip that it matches, but I only want it to stop draging after it has been released on top of the Movie clip it matches; it matches otherwise I want it to return to its starting poisition.
so how do i do this?
thaks for yor help.
Flash-Memory Game
I wondered if anyone knows how to do a memory game using Flash. I want the user to be able to click on a box and it will flip to show an image, and then click on another box to try and match. if they don't match then both cards flip back over, if they do match then they disappear. When the user matches all the cards, they get feedback.
I would appreciate very much if anybody could me help get started in any way.
Thank you so much for your help !!
Carol
Memory Game AS Show 2 Cards
Been working on a project, a Memory Game, I can only get it to show one card at a time and I would like it to show 2 cards a time.
Many Thanks,
__________________________________________________ _________
picArray = new Array("pic1","pic1","pic2","pic2","pic3","pic3","p ic4","pic4","pic5","pic5","pic6","pic6","pic7","pi c7","pic8","pic8");
trial = 0;
_root.p0._visible = 0;
countPic = 0
newArray = new Array();
function checkPicture(pic,bt,mc){
newArray.push(pic);
countPic++
if ( countPic ==1 ) {
pic1 = pic
bt1 = bt
mc_1 = mc
}
if (countPic ==2) {
trial += 1
pic2 = pic
bt2 = bt
mc_2 = mc
if ( pic2 == pic1 ) {
snd = new Sound();
snd.attachSound("ok");
snd.start(0,2);
countPic = 0
count = count + 2
CheckEnd(count);
} else {
countPic = 0
snd = new Sound();
snd.attachSound("bad");
snd.start(0,2);
var1 = eval(bt1);
removeMovieClip(var1);
var2 = eval(bt2);
removeMovieClip(var2);
var3 = eval(mc_1)
var3._visible = 1;
var4 = eval(mc_2)
var4._visible = 1;
for ( i=0; i<=newArray.length-1; i++ ) {
if ( newArray[i] == pic1 || newArray[i] == pic2 ) {
newArray.splice(i-1,1);
}
}
}
}
delete snd
}
stop();
Memory Game - Match 2 Different Cards
I am trying to change the actionsScript for a memory game matching a copy with the original card - to a memory game matching two different cards. I have place all the cards in a movieClip - first frame=back of card, second frame=first half of a pair, third frame=second half of a pair - contiuing with 6 pairs.
I have problems making the match :
The old code was easy:
if(firstclip.picture==secondclip.picture) {
firstClip.removeMovieClip();
secondClip.removeMovieClip();
firstClip=0;
secondclip=0;
}
How can I change it???
----
The whole script looks like this: (the movieClip with the cards is named: kort!
----
initGame();
stop();
function initGame() {
// make sorted list of cards
cardsListOrdered = [];
for(i=1;i<=12;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<12;i++) {
attachMovie("kort","kort"+i,i);
_root["kort"+i].pair = cardsListSorted[i];
_root["kort"+i]._x = x*83+145;
_root["kort"+i]._y = y*76+117;
// move to next card spot
x++;
if (x > 3) {
x=0;
y++;
}
}
firstclip = 0;
}
function clickKort(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.pair+1);
firstclip=clip;
// must be one card showing
} else {
// turn second card over
clip.gotoAndStop(clip.pair+1);
secondClip = clip;
// see whether two cards match
if(firstClip.pair == secondClip.pair){
// remove both cards
firstClip.removeMovieClip();
secondClip.removeMovieClip();
firstClip = 0;
secondClip = 0;
}
}
}
Building A Flash MX Memory Game
Hello All,
I used a tutorial off this site by Gant to build a Memory Card game in Flash MX. You know the type that displays so many cards...and you flip one over at a time and try and match it to another until all the cards are matched. I think we all have seen or played that game.
Anyways...it took me a long time to get it all put together-but in the end is not working because I do not know where to put the 'function coding'. Anyways....does anyone have a good tutorial on making this game?
Also...I am looking for a tutorial on making a 'sliding puzzle' game in Flash MX as well. You know....you have a simple picture--cut it into squares and scramble it up. Then the tiles have to be slid into place to make the picture appear.
If anyone has any good tutorials for these games or can direct me to them I would really appreciate it---I suck bad when it comes to games!
LOL
Thanks in advance...
Photographical Memory Help Modify This Game
hi all could you help meplease modify my game so that it can be
interactive it is a spelling games for kides
i want an array " not too good whith arrays " of 100 words to randomly choose 10 out of them
display them on after the other and between every word there sould be a word " photographical memory"
when the kides see this word they start writing the word be for it
hope that i made myself clear
Memory Card Game _ Need Some Help With Creating It
Hello Guys & Gals,
I had a tutorial I was using quite a while back to create a 'memoy card' game- You know- clcik a card it turns over-- you try to match that image with the same image on another card which then eliminates the pair- etc... until you have them all matched!
I know...simple game! Well... I am new to designing any game in Flash--so I am making a simple memory game for a kids site.
Is Anyone out there able to assess what is wrong with my code to this point?
It seems to add too many cards--and it doesn't match up an equal amount of paired graphics- it always seems like when you get to near the end- there is like 4 cards left- each with a different image on it that doesnt match any others!
If anyone can help- or direct me to some help that would be AWESOME!!
Thanks...I will include the code with this post...
Thanks in advance!
[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 Im 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
[MX04] Adding Memory To The Game?
Ok i have my levels working now but i want to add memory so that the user can close the window and when they want to play the game again, carry on from where they left off... eg they played my game to level 4 and then they had to restart computer and they come back, they dont want to play it all again, they want to carry on from level 4. Any ideas on how to do this?
Thanks in advance
[F8] Please Help Actionscript Memory Pair Game
Hey people! I am new to actionscript and I have been working on a memory pairs games on flash 8 pro. so far I got the game working, however, if you click on the cards too fast or too many times, the cards gets stuck face up and the game gets messed up. I have no idea what is wrong and I need help!! Ill paste code below, if anyone can give me guidance please do
PHP Code:
// Gamefield settings
// EDIT HERE
card_w = 90;
card_h = 110;
card_wdistance = 10;
card_hdistance = 10;
// STOP EDIT
card_dw = card_w + card_wdistance;
card_dh = card_h + card_hdistance;
row_card = Math.floor((Stage.width - card_wdistance) / card_dw);
col_card = Math.floor((Stage.height - card_hdistance) / card_dh);
n_card = col_card * row_card % 2 == 0 ? col_card * row_card : (col_card - 1) * row_card;
imgs_n = n_card / 2;
// CENTER THE IMAGE IN THE CARD
centerImage = function(target){
target.front._visible = false
target.front.container._x -= target.front.container._width / 2
target.front.container._y -= target.front.container._height / 2
}
// ---------------------------------------------
empty = new Array();
function createCard(n, w, h) {
empty.push(n);
this.createEmptyMovieClip('card' + n, n);
with (this['card' + n]) {
lineStyle(0, 0x000000, 100);
beginFill(0x000099, 60);
moveTo(w / 2, 0);
lineTo(w / 2, h / 2);
lineTo(-w / 2, h / 2);
lineTo(-w / 2, -h / 2);
lineTo(w / 2, -h / 2);
lineTo(w / 2, 0);
endFill();
createEmptyMovieClip('front', 1);
front.createEmptyMovieClip('container', 2);
front.createEmptyMovieClip('backgr', 1);
with (front.backgr) {
moveTo(-w / 2, -h / 2);
lineStyle(0, 0x000000, 0);
beginFill(0x333333, 100);
lineTo(w / 2, -h / 2);
lineTo(w / 2, h / 2);
lineTo(-w / 2, h / 2);
lineTo(-w / 2, -h / 2);
endFill();
}
front.onEnterFrame = function() {
tot = this.container.getBytesTotal();
car = this.container.getBytesLoaded();
if (tot == car && tot > 200) {
this._parent._parent.centerImage(this._parent);
delete this.onEnterFrame;
}
};
}
}
selcards = [];
function placeImages() {
act_img = 0;
for (img = 0; img < imgs_n; img++) {
for (k = 0; k < 2; k++) {
act = Math.round(Math.random() * (empty.length - 1));
this['card' + empty[act]].img_id = act_img;
this['card' + empty[act]].front.container.loadMovie("imgs/img" + act_img + ".jpg");
this['card' + empty[act]].onRelease = function() {
this.rotateCard(0, 0);
this.enabled = false;
MovieClip.prototype.enabled = false;
};
empty.splice(act, 1);
}
act_img++;
}
}
MovieClip.prototype.rotateCard = function(v, i) {
this.operazione = v == 0 ? +0.1 : -0.1;
this.incremento = i == 0 ? 100 : 10;
selcards.push(this._name);
this.onEnterFrame = function() {
this.incremento += this.operazione;
this._xscale = (100 * Math.sin(this.incremento));
if (this._xscale > 0) {
this.front._visible = v == 1 ? false : true;
}
if (this._xscale >= 99) {
delete this.onEnterFrame;
selcards.length < 2 ? MovieClip.prototype.enabled = true : null;
v == 0 && selcards.length > 1 ? checkCards() : null;
}
};
};
function generateGameField(cards, distance, hdistance) {
Ypos = card_h / 2 + hdistance;
Xpos = card_w / 2 + distance;
for (c = 0; c < cards; c++) {
createCard(c, card_w, card_h);
if (c % row_card == 0 && c > 0) {
Ypos += this['card' + c]._height + hdistance;
Xpos = card_w / 2 + distance;
}
this['card' + c]._x = Xpos;
this['card' + c]._y = Ypos;
Xpos += this['card' + c]._width + distance;
}
placeImages();
}
generateGameField(n_card, card_wdistance, card_hdistance);
score = 0;
this.createTextField('punti', -1, 600, 485, 0, 0);
punti.autoSize = true;
punti.text = 0;
function checkCards() {
if (this[selcards[0]].img_id == this[selcards[1]].img_id) {
score++;
punti.text = score;
eval(selcards[0])._visible = eval(selcards[1])._visible = false;
} else {
eval(selcards[0]).rotateCard(1, 1);
eval(selcards[1]).rotateCard(1, 1);
eval(selcards[0]).enabled = eval(selcards[1]).enabled = true;
}
selcards = [];
MovieClip.prototype.enabled = true;
}
Memory Game Checking Problem
I'm in the way of creating a memory game, and I've came to a part where I need to check whether my 1st card and 2nd card is the same.
Code:
private function createCards():void {
_cardX = 45;
_cardY = 31;
for (var i:Number = 0; i < 2; i++) {
_card = new Card();
addChild(_card);
_boarder = new Boarder();
_card.setType(_boarder);
_card.x = _cardX;
_card.y = _cardY;
_cardX += _card.width + 50;
_card.addEventListener(MouseEvent.CLICK, checkCards);
}
for (var j:Number = 0; j < 2; j++) {
_card = new Card();
addChild(_card);
_blueBoard = new BlueBoard();
_card.setType(_blueBoard);
_card.x = _cardX;
_card.y = _cardY;
_cardX += _card.width + 50;
_card.addEventListener(MouseEvent.CLICK, checkCards);
}
}
private function checkCards(event:MouseEvent):void {
if (_firstCard == undefined) {
_firstCard = event.currentTarget;
} else if (String(_firstCard._type) == String(event.currentTarget._type)) {
trace("match!");
} else {
trace("wrong!");
}
}
above is the coding I was following, and what I'm doing now is calling images from a folder
Code:
for (var i:Number = 0; i < 2; i++) {
var imageRequest:URLRequest=new URLRequest("cards/001.jpg");
var imageLoader:Loader=new Loader;
imageLoader.load(imageRequest);
card=new Card();
addChild(card);
card.setType(imageLoader);
card.x = cardX;
card.y = cardY;
cardX += card.width + 10;
card.addEventListener(MouseEvent.CLICK, checkCards);
}
for (var j:Number = 0; j < 2; j++) {
var imageRequest2:URLRequest=new URLRequest("cards/002.jpg");
var imageLoader2:Loader=new Loader;
imageLoader2.load(imageRequest2);
card=new Card();
addChild(card);
card.setType(imageLoader2);
card.x = cardX;
card.y = cardY;
cardX += card.width + 10;
card.addEventListener(MouseEvent.CLICK, checkCards);
}
}
now no matter what card i click, it will return "match". how could i solve this problem?
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?
Help With Flash Memory Match Game
I wanted to know if anyone can lend me a helping hand on this matching game. I've tried a few scenarios to get the cards to flip back and reset but the script continues to run through all of the cards.
I also got the matches to close when the pairs are selected.
The problem only happens with cards that do not match.
Aonther problem I have is when you press the same card twice. my variable previousVal does not reset to zero.
basically I want this to happen when you click on a non match.
if you press cardOneA
and then press cardTwoB
cardOneA flips and cardTwoB flips and goes back to it's reset state. i have a in animation and out animation made in "cardOneA" etc. cardOneB and cardTwoA do nothing and remain static. If you press the pairs they obviously disappear and if all four cards are removed the game concludes on the "finish" frame.
you can download the source here: match.zip
Thanks for the help
[CS3] [AS2] Loading Images In Memory Game
So I got this contract [internship] to make a memory card game for research purposes, and while I am not new to programming concepts, I am new to Flash. I've got source code from a previous programmer; only he didn't use comments. I can follow his work only so far. So basically this is the idea:
I know how to run timers, get buttons working, change screens, use arrays and other data types, and so on. My problem really revolves around how he loaded the images from file; they are not embedded in the SWF, they get loaded at runtime. Most of his code was very advanced, but with no comments, I can only understand all but the important parts. I don't even know where he handled the click events. But I don't need to; I know how to rebuild all of this, except load from file. Obviously, its doable, but I can't get it to work. I've tried searching around, no answers. I've found some places that describe how, but they don't work. I get errors like the file is not valid or something; meanwhile, I find no direct answers. So, in final, how do I get an image from a file externally and put it on an interactable device, like an object or symbol?
So I'm going for the object-oriented approach. I've got a flashcard object in the works. But when I try testing the loading from file part, I'm lost. Can anyone tell me directly, clearly, what the hey is going on?
BTW, Is the object-oriented part a good idea? FlashCard extends MovieClip, so I assume it still has its onClick events and so on? I'm close to getting there anyway, but can someone tell me directly what I must do to make FlashCard appear on the screen? I assume I make a symbol, and then attach it? Will it be attached at Flashcard's x-y variables? All these questions I will figure out eventually, but if someone could answer them as well, it would make my life a little bit easier.
---Edit
I have now learned how to create/destroy MovieClip FlashCards at runtime, but I still don't know how to load images from file. As said functionality is required for the final program, I cannot simply import the images to the library; I'll be stuck with a half-working prototype until then.
---Further Edit
I found the @#%$ problem, and it's infuriating! I looked through the help files for hours and hours, not knowing which of the hundred functions were what I wanted. I looked online, foud a tutorial after much searching, and found it didn't work. Spent days looking through more and more ends. Turns out, the tutorial wasn't broken, its just that Windows separates file path directory levels with a ''. Apparently, Flash uses '/'....
AAAAAAUURGH! WHY ISN'T THIS DOCUMENTED SOMEWHERE!?!?!?!? I BOUGHT A BEGINNERE'S BOOK WHICH SAID NOTHING OF THIS! HOW MANY OTHER POOR FOOLS HAVE MADE THIS MISTAKE? DARN IT ALL!!!!
(pant, pant)
Well, let this be a warning for all who come accross my post, here. I hope this is documented somewhere, 'cause I couldn't find it.
Can't Make Memory Game Work
Hi everybody,
I have been trying to make a game, sort of like simon. It is a trumpet, and when the valves go down you have to copy it, but I can't get it to work. Here is the fla www.redtrumpet.info/games/tpt.fla
Short-term Memory Game
Hey all,
Im in need of some pretty urgent help. Im trying to create a small game to help kids with dyslexia improve their short-term memory. I have come up with an idea based in a fictional school. Set outside a classroom the user must keep track of how many males or females enter and leave the classroom. This happens in two stages pupils enter the classroom then once inside some may decide to leave. At the end of these two stages the user is asked either how many males, females or both sexes are left in the classroom.
My problem is that although I am pretty experienced with flash I have never scripted a full game before. I have not really worked with variables in flash but have an idea what i want to do but not really the syntax.
I have created movie clips of a male entering a classroom, a female entering a classroom, a male exiting a classroom and a female exiting a classroom. No more than 5 males or 5 females can enter a room at any one time.
Here is some code I am using so far:
numberMaleEntered= Math.floor(Math.random() * (6 - 0)) + 0;
numberFemaleEntered= Math.floor(Math.random() * (6 - 0)) + 0;
// Creates a random number between 0-5 for males and females entered
numberMaleLeaving= Math.floor(Math.random() * (numberMaleEntered - 0)) + 0;
numberFemaleLeaving= Math.floor(Math.random() * (numberFemaleEntered - 0)) + 0;
// creates a random number between 0 - number of pupils entered for males and females leaving the class room(NOT SURE ABOUT SYNTAX HERE)
I am not really sure where to go after this. I have tried using a for loop to play the entering animations but I don't really think this is the right way of doing this. I am confused about how to get, for example the "male walking into the classroom" clip to play the number of times created by the random number script above.
Can someone please give me some guidance on where to go from here. I understand basic programming syntax and concepts but not really the syntax in actionscript. Any help would be much appreciated.
Thanks
mrstyles
|