matching pairs memory game

RVvDRVvD Member, PRO Posts: 36

Hi everyone, I have had a few problems along the way with this game. But now I have a problem with telling the game how to respond when a card isn't matched.

For the matching coding I used 2 game attributes(integers) CardID and CardIDA so each letter pair changes these attributes e.g: A changes them to CardID 1 and CardIDA 1. Then B changes them to CardID 2 and CardIDA 2. So as shown below the coding for A (once actor had been spawned):

Change Att: game.CardID to: 1
Change Att: game.CardIDA to: 1
Rule: if: game.CardID =1 and if: game.CardIDA = 1 do: Destroy

Is there a simple way of coding like above for a non match? So far I have tried many different ways but the one I have tried (for letter A) most recently which still doens't seem to work is adding a game attribute called nomatch (boolean) and the coding I used below:

Rule: if:game.CardID>1, if:game.CardIDA>1
Change Att:game.nomatch to: true
Rule: if:game.nomatch is true do: Destroy

Any Suggestions?
Thanks Rachel

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Yep! It's actually pretty simple once you know what to do. You can duplicate your rule that checks for a match and change the "=" to "≠". This will trigger the rule when the two attributes do not match. Be careful, though, this rule will trigger when it's not supposed to check so you will need to put in a condition so the rule only checks when the two attributes have been populated with data.

    You also have another option - inside your original rule, open the "otherwise" second. This part of the rule and all logic within will fire when the condition is the rule is not met. So for example, the otherwise in your example will fire when the two conditions do not equal each other.

    Hope that helps,
    Braydon

  • RVvDRVvD Member, PRO Posts: 36

    Thankyou so much Braydon_SFX, that sounds pretty simple.

    I will go and give it a go. Is that symbol, you have there, this: !=
    ...as I cant see a symbol with an equals sign and a backslash through it. (sorry if that sounds like a dumb question, still getting used to it all).

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    @RVvD said:
    Thankyou so much Braydon_SFX, that sounds pretty simple.

    I will go and give it a go. Is that symbol, you have there, this: !=
    ...as I cant see a symbol with an equals sign and a backslash through it. (sorry if that sounds like a dumb question, still getting used to it all).

    Correct. Since you're using Windows Creator, "Not equal" is != . My apologies.

Sign In or Register to comment.