Doubt about Pairs game(Solved)

I was analyzing the events of this game “Pairs” and I noticed that if my sprites are not an animation, it wont work?
I tried to use a simple sprite replacing the cards, but the tween effect drive all my cards to the same position. Beside that, I noticed that even using the game cards, if I simply change the action "Set animation cards to “back” as it is in the game to: “change opacity”, for instance, it doesn’t work also. Why? I liked the effect and I was trying to make something similar, but not using animations.

If you changed the action from set animation to set opacity did you also change the condition that checks the animation to the one that checks the opacity? It’s a matching set. It’s a way to tell the used and unused placeholders apart.

Actually, I don’t want to alter anything. All I need is the tween and I don’t know how to proceed, because it needs a matching set to check, so I need to change the state in Condition.

What exactly do you want to happen?

I want to ramdomly tween my tiles (maybe 20) into the scene as they are, without changing animation or anything else.
Why can’t I use simply a condition to trigger the tween?
I set all my cards at x = -100 and used the condition: “if cards position x = -100” and in action I set the tween code.
I see that if somehow I don’t change the state of my “cards” in action, the tween doesn’t trigger.

I believe the problem is that the tween doesn’t start inside of the for each object so the x() doesnt change. I think the tween happens in-between frames. You could use an object boolean that wouldn’t rely on the object’s position. If the object variable is false then pick a random oject, add the tween and set the object variable to true. Checking the animation works as a trigger bc the value changes directly and immediately not though a tween.

OK! I’ll try that and post the result. Thanks for while!

1 Like

It didn’t work. I tried the boolean variable in position_placeholder and in another sprite I created just in case.

You would set the boolean of the card or whatever the object that is being picked and moved. You’re filter out the objects that are already placed.

That´s it!!
What’s the difference of using “pick a randon” as a condition inside the same event as testing the boolean and using it as a sub-event? That is what I was trying, like in the original file. But it works if you don’t use it as a sub-event. Anyway. You helped me a lot. Thanks so much for the effort! Have an amazing weekend!

1 Like

It depends on what you want the actions to do. As long as the conditions are in the same event they work sequential like a subevent.

Sometimes, you need to do things in steps. Other times it’s easier to understand the code if it’s split up. Events can be rather complex looking.

Thank you very much!

1 Like