need help , all images are separate , what i want : images should change by clicking yes or no button, after showing all images need to trigger texts according to the images user selected via clicking yes button , please help , i’m new to g dev
Add these four images as different Animation of a single Sprite object: they will appear as Animation #0, #1, #2, and #3.
Read this until “Adding multiple animation”: Sprite object [GDevelop wiki].
Then, for your Yes and No button, they will be two different objects.
But firstly, please tell, what do you want to do with the Yes and No choice the player makes? What is example of result to be displayed?
yes means user selected that image and show text as result to it after showing every images
no means nothing to show at the end result
via clicking yes or no button to change images (not like timed switching )
showing text as results for selecting those images
“apple contains …etc” in text object if that image is selected only via yes button
if user selected more images then show all texts related to that image
Okay. I understand that if for example user presses Yes for image 1 and 2 (apple and strawberry) they might get something like “Apple and Strawberry is red.” in result text.
In programming that is Text Concatenation, this is a complex usage of it actually so I cannot explain it fully.
Are you familiar with Variables? In a simple example, we can use two string variables, called “Fruits” and “Features” - these both will be Scene Variable.
However, “Features” will be Structure Variable since I am not sure how to check if certain string is present in the variable, so that multiple same features would not be repeated.
Please study the variables wiki page, especially Structure which is not explained too well - you may need to research Structure variable from other programming language.
To actually implement it, now there should be three objects: the sprite of the images (multiple animation), the Yes and No button.
Add a “if mouse button pressed” event, then make sub event of that to check “Mouse or Touch is on Yes button sprite”, and finally, a Trigger Once condition.
In this sub-event add action to increase animation number of fruits sprite by 1, if you arrange it like above picture it will switch to next picture image.
Add another sub event to check animation number/name of the fruits sprite; if animation number is 0 we might be at apple sprite, so we will concatenate (use Add To) to Fruits variable: "Apple ". Note space at the end so it will concatenate with space later.
We then will add another event below this sub event, that also checks the animation numbers:
inside this, we will use “Check if child of variable exists NOT” condition, use "Invert condition "switch when adding it, and there will be a red refresh icon. For example we check if child variable “green” of “Features” does NOT exist and add it to the structure variable.
Do this event for other features the fruit can have.
Finally, to check if all images has finished, check if animation number of fruit sprite >= 3, then hide the three objects and display a new text object. Use “Modify the text” action, then inside it you can type “VariableString(Fruits) + " is " + VariableString(Features)”. Not sure if that will work because of structure variable.
Hope this helps you. If not you’ll have to find other examples of the same system somewhere, maybe on Youtube using something other than GDevelop, but the concept can be taken from other places. Try to study the wiki more also, especially variables page since that is what you need most.
after adding again check animation condition problem started
image changes no problem at the beginning , after adding again check animation by name and hide action , image is no more shown,
please watch my video attached , i have no idea how to add features to integrate text modification please help and thanks in advance