How do I compare 2 objects with error check and reset

Get help using Construct 2

Post » Tue Apr 05, 2016 6:02 pm

I have attached my capx
https://www.dropbox.com/s/2wp96wt7abbfv4u/Matching.capx?dl=0

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.
B
30
S
10
G
3
Posts: 75
Reputation: 3,558

Post » Thu Apr 07, 2016 1:35 am

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.
B
30
S
10
G
3
Posts: 75
Reputation: 3,558

Post » Thu Apr 07, 2016 2:41 am

I remade the entire thing in 6 events: https://dl.dropboxusercontent.com/u/395 ... 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
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Thu Apr 07, 2016 3:54 am

@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.
B
30
S
10
G
3
Posts: 75
Reputation: 3,558


Return to How do I....?

Who is online

Users browsing this forum: banquetburger and 47 guests