How do I compare 2 objects with error check and reset

  • I have attached my capx

    I tried to reverse engineer a memory match game but being new to construct I am missing some pieces that appear to be over my head.

    My ultimate needs are to

    1. Match two identical items and destroy them then add to a correct answer variable (the variable is not in the example but I can handle this) that will move user to next level once they correctly match all like objects and to be saved for tracking level completion to db

    2. Error check if two items clicked don't match and reset picked count for the object, so the user has to click two like items in succession and if not add to an incorrect answer variable that will be tracked and saved off to db

    My current problems are:

    It currently allows me to click on matching like items and destroy them but if I click on for example object 1 (purple dragonfly) and then a non-like object (purple worm) and then a like object of either of the previously clicked items (blue dragonfly or blue worm) it will destroy the two like items and keep the previously clicked item active as well

    I tried using "else" reset picked variable to zero if expression wasn't equal but it seems that if the expression is false the sub-event doesn't run if I read the manual correctly.

    My other issue is it will also let me click on the same object twice and will then destroy the two like items which doesn't work for me either as I want them to have to click on both like objects.

    In my searching I've seen using UID's to compare and some references to using a single sprite sheet and then comparing instances . The lower levels of this will be static

    but as levels increase I would like them to animate so i have avoided using x y comparing thus far.

    Any help would be greatly appreciated.

  • If I need to add any details or downsize the question please let me know. I'm mostly trying to sort out the click on matching items for multiple items without the other items counting towards total count and/or resetting the count if click one and click two don't match.

  • I remade the entire thing in 6 events: ... ching.capx

    I placed all bugs in a family and gave them a variable to identify the pairs (so bug 1 matches with other bug 1, etc) and global variables to hold the values while we compare them

    If there's anything you don't get, just post with 7Soul to send me a notification

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 7Soul thank you so much. I briefly looked into families and my lack of knowledge sent me other directions. The build you made works great for what I was looking for. Wish there was a way for newbies like me to give you all the props you deserve. putting my nose back into the book so I can hopefully help some others out down the road.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)