Reveal text after player collides with an object

How do I reveal text after the [Player] object collides with the [Apple] object…?

I am using the {Show} Action at the moment but it is not doing anything.

I’m assuming everything else is happening. If the text object is where you expect it to be then maybe it’s behind another object or there’s another action that immediately hides the object as soon as it’s shown. How are you hiding the text after it’s shown?

1 Like

Have you got the text object in the scene already, or are you creating it? If you have scrolling, is it on the correct layer (probably one that doesn’t scroll)?

1 Like

Thanks a lot @Keith_1357 and @MrMen :slightly_smiling_face: , I quickly understood what to do after responses from you both.
I wasn’t hiding the text object at the beginning of the scene.

Below is what worked for me:

I would be doing this for lots of [Apple] objects, what would be the efficient way to achieve this.?

It looks pretty lean. You could add a trigger once condition to the key is pressed condition events since the animation doesn’t need to be set more than once per press.

If there’s a possibility of colliding with multiple apples at the same time, instead of adding 1, you can use the expression that counts the number of picked objects for the apple. Then it would count all of the apples. You probably only need the other actions to run once otherwise you might need a for each object as a sub event. But I don’t think it’s needed here.

Dear @Keith_1357 and @MrMen,

I have published my game to itch.io and gd.games.

There are 2 problems that I am facing:

  1. The game sound doesn’t gets played on desktops on both the platforms (It plays on mobile).
  2. For the mobile version. How do I make the [Player] object move right, left and jump without the need of pressing on the arrow keys. { The reason behind doing so is that I have placed the right and left arrows at the bottom left and every time I click on them, the gdevelop watermark gets clicked and blocks the view }.

Below is my entire logic for the game:


You can remove or change the position of the watermark. You need to have a subsription to hide both the logo and the watermark at the same time. I believe without, you can only do 1 at a time,
https://wiki.gdevelop.io/gdevelop5/interface/project-manager/properties/

For mobile games, you might need to use the multi-touch.
https://wiki.gdevelop.io/gdevelop5/all-features/mouse-touch/#handle-clicks-and-taps-on-objects

As for the sound. Is the sound preloaded and have you tried using the play sound on channel with each sound on it’s own channel. Have you tried other sound files? That’s the limit of my knowledge on that.

https://wiki.gdevelop.io/gdevelop5/all-features/audio/#pre-loading-improve-the-latency-and-loading-times

Just a couple of tips.

If you add all of the objects you want to hide to a group, you can hide them with 1 action using the group name. It’s simplifies the event sheet. If the objects being in a group doesn’t affect anything else.

Instead of the 1st event, you could use the 2nd which uses a group named buttons.

You can use 1 event to handle all of the apples and process objects. Each type can be a single object or you can create a group for each type. Add a variable like ID and give each matching apple and process object matching ID values. If using a single object make sure you change the instance variable not the object variable. I tested it with a single apple and checkmark objects but you can use any object type. You can use different animations for the apple.

If it’s possible to collide with multiple apple, you would need a for each object.

Thank you so much @Keith_1357 for your kind response.
I am going to try this.

And, what about the sound of the game, what could be going wrong with that ( it doesn’t gets played on desktops but plays when I load the game on a mobile phone ) .?

I’m clueless on your sound issue. I never had missing sound. Hopefully, someone else can help, in the meantime keep searching the forum and other places.

Hello @Keith_1357 & @MrMen ,

Can you please help me out here:

I will be really thankful to you…!