Enter the names of the players on a scene

Hello or Hello again to all, :sweat_smile:

I would like to make a scene where the players can write their names on the phone but I have a problem. When Player 1 clicks on the blue square to validate his name, then his name is displayed in all the text areas :sweat:
I would like his or her name to appear in only text area number 1.

I attach two screenshots of my events and the ā€œgameā€ link to see the extent of the problem.

Thanks again for your reactivity :heart_eyes:

Link of ā€œgameā€ :
https://games.gdevelop-app.com/game-c5cfb856-380b-46b3-9c05-73ae6ab1c2e0/index.html

Are all the text areas on the scene the same object named ā€˜NomJoueurā€™? If so, the ā€˜Change the textā€¦ā€™ action will affect them all because technically it should.

You could either create separate objects for each of the text areas with different names, OR, add an instance variable to each of them to distinguish them from one another and add that in your conditions.

For example, add the instance variable WhichPlayer to each of the text areas, one with the value Player1, another with Player2, another with Player3.

Then when you want to add the name in your events sheet, add a condition that references that instance variable like so:

Add the same condition with 'Player2", ā€œPlayer3ā€ etc when youā€™re trying to target that text area.

Thank you for this very helpful answer! :heart_eyes:

I tried what you said but Iā€™m stuckā€¦ Iā€™m having trouble understanding what the problem is with that :sweat:

Sorry itā€™s hard for me to follow along with the french code, is it just doing the same thing or are you having different issues?

Sorry, I forgot to translate the code into English.:sweat_smile: I have just modified the photo

When I click on the button nothing happensā€¦ I donā€™t know if I put the line of code in the right place or if I need to move it or if I need to change other thingsā€¦ :disappointed_relieved:

Iā€™m not sure I quite get the text area setup you have going here. You have just the 1 text area used for showing captured input called NomJoueur? If so, that kind of neglects the point of using/checking for the instance variables (if every text object has itā€™s own name.)

Let me try something over here and Iā€™ll post back in a bit.

Let me make it easier to transfer my start of gambling to you, so that you can become more aware of the problem. :blush:
https://we.tl/t-mYUA3KRxEP

Sorry, didnā€™t see your post in time so tried recreating it from scratch. Anyway, see if this helps - itā€™s a little different but I think does what youā€™re trying to do.

https://we.tl/t-Q1p3xsTry0

1 Like

Hello,

Thatā€™s exactly what Iā€™ve been trying to do for days! You just helped me take a giant step.:muscle:

Thank you so much :heart_eyes: