Is there a way to make a text box appear when an item is collected?

I am creating an educational science game, the first stage is to collect all the equipment. When each piece is collected I want a text box to appear explaining what each thing is, is this possible?

Thanks!

Try something like this:
Create a Text object on a “gui” layer called “HelpSign”
When the scene starts hide the HelpSign object
Add an instance variable to all of your equipment objects called “HelpText” with a string value of the message you want to display.
When the player object collides with an equipment object then show then change the text on the HelpSign object to be equal to the value of HelpText on the equipment object the player collided with.
Then show the HelpSign
Then pause game execution until a key is pressed (or use a timer)
Then hide the HelpSign object

2 Likes

@krunkster thank you! I’ll try that now :smile:

@krunkster image
I’ve managed to get to this stage but I’m not sure how to add an until case.

Any ideas?

That “pause game execution” action is probably only for debugging purposes.
I think I may have made it seem more simple to pause your game than it will be.:sweat_smile:
It’s a little tedious, but here’s how you can do that:

Create a new scene variable called “GameIsPaused”
Take all of you current logic for your main loop (i.e. all the events) and put them into a new event group called “Main Loop”. Then put that event group under a condition like “GameIsPaused = 0” so that the main loop only runs when that variable is not set. Unfortunately moving all your events into the event group will be tedious and require lots of drag and drop, which is very error prone… please make a backup and be careful. If you can collapse as many events as you can to make the drag and drop easier for subevents.
Then create a new condition after the last for “GameIsPaused = 1” which have a sub condition of some input event like “AnyKeyPressed” or “Touch Ended” or “Mouse Button Released” and the action for that event will set “GameIsPause to 0”. The last piece is to update you sign logic to set “GameIsPaused to 1” when displaying the help sign.
I hope that all helps!

Thanks so much! That’s a lot to wrap my head around but I will have a go. :smile:

Maybe if I can’t figure it out I’ll just add a timer. :laughing:

I really appreciate your help!

Sorry, it’s taken me a while to have a go!

I think I’ve done what you said, it stops when the character collides with the object until another key is pressed which is great.

Thank you so much for explaining it so well!

1 Like