Everything works good but I noticed a strange behavior with the order you uncoer the cards. Let’s say we have a poppy and a daisy. Poppy’s name animation is number 1, and daisy’s is number 2. When I uncover poppy first, it’s name appear and when I uncover daisy, displayed name changes to daisy’s, that’s how it should work. But when I uncover daisy first, it’s name appears and then uncover the poppy, poppy name won’t be displayed and it will still be showing daisy. I don’t know what causes this problem but I noticed it appears in every case when it should display the animation with lower number than the first, eg.: 7 to 3, 10 to 8 etc. I also tried it wih action “Change the animation by name” but the same problem still appears.
I’m going on an assumption that each card has a display name attached.
If so, you need to select which display name to change, otherwise GDevelop will do all of them. And because Daisy is checked after Poppy, all the display names are changed to Daisy.
So ideally you need to link each display name to a card. Let us know if you need help with this.
I also assume Cards is the object group for all the cards. If so, then you could reduce the number of events from the 19 you have to 3 or 4. It would require a little bit of setup, but it would mean you could add or remove cards without having to add or remove events. Let us know if you’d like to try this.
Hi, thank you for your answer. Yes, Cards is the group of all cards. I’d honestly need some help with this as it’s the first time I’m doing this kind of game, so the explanation would be very much appreaciated!
I have one more question. It’s less important and I didn’t want to create a new topic since all the context of the game is here. How can I make it that when a pair is found, these two cards are displayed on screen longer than normally? Example, you got the pair wrong, the cards get covered after 2 seconds. You got the pair, the cards dissapear after 5 seconds.
I’d look at using a timer. At the beginning of the scene, start a scene timer (say called “coverTimer”) and then pause it. Also create a scene variable called coverTimerDelay, and set it to 999 (just an arbitrary large number).
Create a new event that checks if coverTimer > coverTimerDelay, and has actions that covers the cards, resets the timer coverTimer and pauses it.
In the logic that determines whether the pair of cards are correct or not, set set coverTimerDelay to the appropriate value (2 or 5), start the timer coverTimer and unpause it.
Hi, sorry for disturbing but I have to have the game finished in a few days (a school project) and the problem with names is actually the only thing holding me back. I tried other methods with separate sprites, text etc but it still doesn’t work so I’d be glad if you could show any tutorials or examples with this linking. It’s a really weird problem, as I said, it works in one way but not in the other way
No worries. I think I’ve misunderstood how you use names. I though it was one name on each card, but now I assume it’s a text box on the screen, that shows the name of the flower that’s on the card that’s just been turned over. In which case, linking is not correct. Also, I’m assuming each card has a front and back animation.
If those assumptions are correct, do the following:
Add an instance variable to each card object, name it “AnimationNumber” and assign it the value of the name animation.
You realise the trigger once means this sub events are actioned once and that’s it until the scene is rerun? Is that what you want to happen?
I think you may be better off adding a tween behaviour to all the cards (sorry, a bit of extra work, bt it makes the events a lot simpler), and using an opacity tween that deletes the object when it’s finished.