Options for what to plant

Hey GDevelop geniuses! Still have my programming training wheels on so I apologize in advance for a “stupid” question. At the most basic level, I’m putting together a farming game for my son to enjoy. When the character walks over to the “plot”, how would one create a prompt for him to choose to plant crop1 or crop2? I don’t mind doing the legwork if you can only send a link but additional insight would be much appreciated.

Thanks in advance


Two things you want to think about:
“When do I want something to happen” (the condition).
“What do I want to happen” (the actions)

As you mentioned, you want to check for when your character object interacts with a plot object.
I would set up your conditions for “CharacterObjectname is in collision with plotobjectname”. Make sure you use a trigger once in the conditions so it doesn’t happen every frame.

For your actions, there’s a ton of different ways you can do it. In general, I prefer to keep all of my UI/interface objects on a separate layer. So maybe you have a “cropselect” layer, and hide it by default. Then with your above condition, you can use the “Show layer” action to show the layer?


Brilliant suggestions. That points me in the right direction and gives me something to work on this evening since it’s too cold to be outside.

Thanks. I’ll post back if I run into another wall.

1 Like

So I got to the point where I need to have the crop “grow” and did this so far (please advise if I did this properly):

  1. Creating an instance variable called growth for the crop. Set it to 0.
  2. Then I added a new event, every tick, that increased the variable of “growth” by 1
  3. Created another new event that compares the instance variable to see if it equals 100. If it does, for now, I have the opacity change to 50.

Does #3 stop the growth variable from going past 100? Do I need to stop the variable from increasing?

1 Like

I would just add a condition to your event that says “If Growth <100”

That way it won’t trigger at all once it’s at 100.

1 Like