Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-06-2012, 05:30 PM   #1
Registered User
Join Date: Mar 2012
Posts: 2
Default [AS3] memory game


Its pretty simple but i cant seem to get it lol all i want to do is basiclly all i want to do is instead of matching two of the same colours i want to match two different colours, IE match red to green.

Since the colours are assinged to numbers, how do i basiclly say:

1=2 then remove cards or

2=1 then remove cards??

Any info would be great

thank you
trig0rz is offline   Reply With Quote
Old 03-06-2012, 06:14 PM   #2
Immma firing Ninnnnjaaa
Join Date: Aug 2011
Posts: 95

if(number1 == number2)
//Code insert here

I hope this is the information you need.

Tip: 1) Post the code you have, not from a tutorial.
2) Read you sentences.
3) Explain what you want, not 1 = 2 then remove cards.

4) Learn some basic AS3('How to write a hello world in as3', 'How to make a pong in as3', etc.).
Biodiscus is offline   Reply With Quote
Old 03-06-2012, 09:43 PM   #3
throw a trace() in there
Join Date: Dec 2006
Posts: 2,139

I might make an array of correlations between colours, like say red=1 and green=2, then I'd make:
var matches:Array = [];

then test with 
if (matches[first_tile.col] == second_tile.col) {
rrh is offline   Reply With Quote
Old 03-07-2012, 01:45 PM   #4
Registered User
Join Date: Mar 2012
Posts: 2

Thank you for your reply.

I can see whre you both are coming from and i will try them now as well.

As for the coding i have, this is it :

well basiclly i this array:

var abbr_array:Array = new Array(1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8);

the numbers represent a colour, IE 1= red and 2 = green.

So instead of the game removing the cards when 1=1, i want it to remove it when 1=2 or when 2=1. The code which removes 1=1 is this:

if (first_tile.col == second_tile.col){

then remove cards


Any more info would be the great.
trig0rz is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 04:04 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.