Creating Infinate Dragabble Objects

Hello! I’m new to GDevelop and haven’t made games in years.
I’m trying to remake a game I made in gamemaker years ago to get a hang of the program.
Its a drag and drop game where you put toppings on a pizza. Think dress-up game, but its a pizza instead of a person!

I have the draggable behavior for my test object, but I have no idea how to make it where I click on the object to move it, another one appears. And once that one appears moving the original object doesn’t cause more of the object to appear. I know that is really confusing so here is a quick vid showing you what I mean in the old game: drag and drop old game - YouTube

So basically lets say I got a pepperoni, once I drag and drop that pepperoni I want a new one to appear - BUT - I also want any dragged and dropped object moveable so you can make sure your pizza is perfect, and I don’t want a new object to spawn every time the object is moved.

I hope this all made sense, I’m not good at describing things.
I’m used to gamemaker so how this works is completely new to me!

Thank you for any help you can give!

I made something quite similar to this not too long ago, with a drag and drop snap to grid base builder game. Let’s say you want to grab and drop a pepperoni, I would have two different pepperoni objects, one that is configured with the button behavior so you can click it and execute and event (a menu/UI item), the other is the actual pepperoni that would be dragged and dropped (configured with the draggable behavior). When you click the pepperoni button it creates a draggable pepperoni object (I used the mouse helper curser object extension to replace the curser with the object) but you can just have the draggable pepperoni object be created next to the pepperoni UI button. Then you can drag and drop as many as you like.

1 Like

This is one way. The toppings would be in Group and the tray is just a sprite used for collision detection.

When you drag it if it’s in collision with the tray then you create a new copy. When you drop it if it’s in collision with the tray then you delete it.

1 Like

Dang I never even thought of a button…which is stupid on my part I might have already done that before and forgot. Granted in gamemaker but still Lol! - Thanks!

That idea looks much closer to how I did it in my original years ago in gamemaker. Only less buggy than mine XD - Thanks!

1 Like