[SOLVED] Create on click in specific area

Hi, If someone could help me, I would much appreciate it.
Im trying to do a “pachinko” game and I managed to use the create on click.
When I click the left mouse, it creates a sprite with physics. What I can’t manage to do is to only create the sprite in certain areas of the screen. I thought about putting an invisible sprite on screen and treat it like a button and when I click the invisible sprite, it would create the thing I want but this doesn’t work. I also thought about only creating the sprite when mouse is inside a certain area with x and y coordinates but I don’t know how to do this.
So, can anyone help me with this?.
Thank you in advance.

Your plan to create an invisible sprite is the right idea. Make the sprite filled with a colour, so you can see it in the editor. Then hide it at the start of the scene.

If that’s not working, then post a screen shot of your events and of the hitbox of your sprite, and we can see if there’s something not quite right there,

2 Likes

Thanks for helping.
I will try what you say and if I can’t make it work, I will ask for help again.
Thank you.

Hi. I tried to do what you said but I can’t manage to do it.
If I make a condition “the cursor/touch is on” , it will create an object when the cursor is on the invisible sprite/area. But that’s not what I want.
If I make a condition “left mouse was release”, it will create an object anywhere I click and that’s also not what I need.
How can I achieve this?. In my mind it should be simple. Whenever I click only inside the shape, it will create an object.
I hope you can help me. Thanks.

I got it. :smile:
I put a “the cursor/touch is on” and followed by a “left mouse was release” and it works.
It only creates an object when I have the mouse on the invisible area and it doesn’t create outside the invisible area.

Thanks, much appreciated.