How do I compare two sprites to see if they are the same

Get help using Construct 2

Post » Thu Feb 26, 2015 7:35 am

Hi all, can anyone tell me- I am making a little game where I have a random sprites appearing on the screen.
At the bottom of the screen I have another sprite that you will press if the sprites are the same as each other.
It's probably simple but late last night just couldn't work it out.
Cheers.
Matthew
B
34
S
3
G
1
Posts: 46
Reputation: 1,670

Post » Thu Feb 26, 2015 7:52 am

Put them in a Family, add a Family instance variable ID, and for each Sprite type have a different ID (1, 2, etc), and check the pressed one's ID is the same as the displayed one. I think that will work.

match_sprites.capx

edit: after doing this I thought you might just use the Nickname plugin..

2 families, a little more setup (2 lines per object) but scales better
match_sprites_2.capx
You do not have the required permissions to view the files attached to this post.
Last edited by codah on Thu Feb 26, 2015 9:13 am, edited 1 time in total.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Thu Feb 26, 2015 8:53 am

HI thanks, I am at work at the moment but when i get home later I will give it a try.
I will let you know how i get on.
Cheers.
Matthew
B
34
S
3
G
1
Posts: 46
Reputation: 1,670

Post » Thu Feb 26, 2015 11:11 am

HI again, just had a look at both of your examples. They are both very useful and have made it much more clear for me to achieve what I am trying to do. The second cap.x is what I was trying to do. To try to understand it all I have written it all out again in my project rather than just using yours and changing sprites etc.
Thank you.
B
34
S
3
G
1
Posts: 46
Reputation: 1,670

Post » Thu Feb 26, 2015 11:26 am

No problem, if it helped in any way that's cool. I probably could've commented it more :D
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: dop2000, StillSarah and 19 guests