Seperate Object Problem

So Im creating a phone keypad system which is almost working! But I have my game set to where…

if you input a number by clicking it then it will appear at a set point. If another number is entered at that set point then the object will seperate from the last number clicked.

However, I have all the numbers in a group called “Phone”. It works but itll only display the number 1 regardless of what number i press. Maybe its something to do with groups? I dont know. I want to be able to press any number and have it function like I mention. Only the number 1 is appearing with the groups set up.

Can you give a screen snip of your events? We’ll be stumbling in the dark not knowing what you’ve done or how you’ve done it

Sure! Here it is.


Do you have any objects for the numbers? If you aren’t checking which number they clicked and outputting it into the scene then it will default it to 1 because you never told it which number you clicked.

You would need to make separate objects for each number and check if they were clicked with the mouse conditions. If they were, get the number and send it out to the scene like you have done it there.

I have a seperate object for each number. The screenshot is displaying the numbers in the group. I was thinking of trying to call a group and do it that way to reduce the amount of conditions i have to do.

The problem is you are creating object Phone, and it’ll default to the first object in the list. You may be able to get away with only changing the create action to :

image

However, the downside here is if you ever need to refer to the phone object in this event or subevent, which one will it be? The one the cursor is on, or the newly created one?


So I’d do it this way, to avoid this potential confusion :


Also, be aware that using the Phone group name to refer to 2 objects is prone to trouble - how does GDevelop know which Phone object you are referring to in the separate action? It may work for you now, but keep in mind that if it starts behaving weirdly, this could be the reason.

That makes sense. I’ll give this a shot. Thank you!!