[Solved] New, need help how to add text with collision

Hello everyone. Just recently started using gdevelop. I need some help with a side scroller I have made. I couldn’t find any answers on YouTube or even google regarding this. I am still learning Gdevelop and what I needed help is with setting up something like

When my character collides with different coins it goes away but I want it to replace it with a text for like information. I think it’s cause I’m still learning but surprised there’s nothing like that.

So basically character gets the coin and in that spot some text with some information pops up. Is this possible and if so could someone please walk me through it. A new person would understand. Much love and thanks.

Thank you for your help!

hi. it’s as simple as you wrote it. when your coin is disappear (delete object), in the same event just put the “create object” action for the text object. set it’s position to the coin X and Y coordinate. of course you need to put this lines BEFORE delete the coin object. so in the same event, just above between the actions.

1 Like

Thank you so much for your reply. So far the deleting the object is making sense, do you know what type of X and Y I would need to use?

So you are saying first I put the coordinates of the coin? What if I have multiple i need to do. Do I make it for each individual one? So after I put the coordinates I do create object with text?

Thank you for your help, sorry for the dumb questions, just need this one last thing to finish my game.

position of course. here my example with a fade-out effect:

1 Like

Omg thank you so much for the example. I am going to try it as soon as I’m home from work. Will you be around later today? Just in case I need some guidance. Also where it says: repeat for each object. Is that a condition? Or I just have to do it for each of the coin? Since I do have to make different text for each coin, will do make one for each individual one?

THANK YOU SO MUCH FOR THE HELP!!!

Hey so I’m actually trying it right now. Would I do it on this action line right beside the collision?

you don’t need a “for each” event for the sound or the points. just pull the actions from it to the collision’s line.

1 Like

Okay so I have moved them on the same line. But the only problem I have right now is, how do I make individual text for the coins? The first one worked like you said but it does that for every single one. Would I need different coins in the world and set up collision for them individually? This is what I have so far.

Thank you once again for your help this means a lot to me. I’m finished when I finish these text you have been wonderful.

I suggest to you, first recreate in a new project what I did to uderstand how it’s work, before implement it in your code.

so. I don’t understand how many different text are you want. I think the easier way is create a few different coins types, and then add one-one text to each different coin types. but we can add more variation to the single coin version. wrote a bunch of texts and random choose one from it. explain more please what are you want.

So I was wanting to do is each going have a different text that shows up. I think you might be right, I might need to make individual coins for each text. I just don’t understand if there’s a way to change the coin text depending on which X or Y location their at.

Example:
So first coin I hit does 1 text: “Hey”
Second coin I hit: “how are you”
3rd coin: “Where are you going”
Etc.

So that’s what I was hoping to do. But do you think I have to make different coin Collisions for each text?

Thank you.

how many different text are you want in all? if just a few, may be easier the different collision method. but if you want many, we will use an another solution. it will be a bit more complicated.

So I decided to make individual coins for each text. Makes it easier. Like you said to try it on a different page to test and it works. Only
Problem is when I try to get the second coin, it shows up on the top like this

I did the exact same thing for the red as per the blue but when I get the red coin the text spawns on the top of the screen. Would you happen to know how to fix it? Thank you

Of the code:

Thank you for the help again!

1, the red coin text position is incorrect. it isn’t the red coin, but the text itself.
2, pull the delete coin objects actions to the bottom of its group.

3, be more attentive. :stuck_out_tongue_winking_eye:

Ohh sorry :frowning: because I basically did the same thing with the blue coin it was in the right spot so I thought it would do the same. I’ll try it now. Thank you!

IT WORKED! Thank you so much for everything, you saved my butt! Can’t thank you enough friend!

Could you help me with one last thing. So I tried making the text fade away but it does not fade. I followed the opacity but it didn’t work the text doesn’t disappears. Is there a way for the text to disappear after a couple of seconds being on the screen?

Thank you!

1 Like

you see in my screenshot above how to do the fade-out effect. try to copy it exactly. but you need to use an “object group” for this. create an object group, and put in all the text objects wich are you want to fade-out. than use this group in the “for each” event. you find more info about object groups in the wiki, if you need.

1 Like

Okay I’ll try it. Thank you.

1 Like