Missing a few actions/conditions (it may be just my ignorance)

Hi guys,
let me say that I love GDevelop and it really sparked my interest in programming after many years.
In the past, I used Game Maker and Construct for some time. After a couple of games that I made in Gdevelop I started to miss a few actions/conditions that were present in either Game Maker or Construct (or both). Again, most of these may be already implemented in Gdevelop but I may be unaware of them (I’m still a beginner). That’s why I would like to ask the community (and maybe also 4ian -whom I greatly respect) if there is any reason these actions/conditions are not present in Gdevelop:

Else condition - I’m missing this a lot. I know how to do it in Gdevelop but it would be way clearer with ELSE. I’ve read that it would be extremely difficult to implement it in Gdevelop so that’s probably why it’s not already there? If so, is Construct 3 so different? (it has else condition)

“On creation” condition- omg, I’d love this condition because I frequently want something to happen to the object upon creation.
BTW, if I want to create an object and assign value to its object variable, how do I do that? For some reason, if I want to edit the object variable in the object editor, I can’t use expressions like Random() as a value. Why is that?

“On destroyed” - see above

Every second condition - I know it can be done through timers but this would be easier

“Wait” - In Game Maker, I remember there was an action with which you could pause the execution of your game for a specified number of milliseconds. I think that this can be done in Gdevelop using Change time scale action. The problem with it is that then you have re-activate it by using a timer, which is annoying. - I might be mistaken here though

If the position is empty condition - again, this may steam from my lack of knowledge but I haven’t found a way to check that

Yes, there are no Else condition in GDevelop
There are no On creation condition in GDevelop if you are referring to objects. But you can achieve this by creating an object and doing an action along with it.
or, if you are referring to this
As far as I know, there is no On destroyed condition too but you can achieve this too just like the previous one
Don’t know what Every second condition is. Or are you referring to this
Don’t know Wait action. Could you please explain more. I Googled it but can’t find anything about it.
If the position is empty condition :thinking:? I can’t understand what you are talking about? How can a position be ‘empty’?

If I am wrong, other members can correct me or clear my doubts

1 Like

The if/Else personally I think is a must have in all Game Engines but here is missing as he*ll anyway if you understand how events work in GD it’s absolutely useless to have if/else.

The condition Always is a do nothing really, is up to the developer to use it or not.

For On created and On Destroyed you can always code your own behavior and apply that new behavior to the Object you that want.

For the Wait I’m pretty sure someone in the forum make something alike I think he called Delay Extension or something like that, just search in the forum.

1 Like

Oh right, you can make your own Extension and Behaviors too
I totally forgot this :sweat_smile::sweat_smile::sweat_smile:

Thank you guys for answers. I will try to comment.

Yes, but if you create numerous instances of the same object and you want to do different actions to each one of them, Gdevelop starts to have problems distinguishing which instance is which.

I meant something like this. In Construct 3, there is a condition “Every tick” , which basically means every frame. But there is also a condition called “Every X seconds” . You just define how often you want the action to be performed.
For example, then it looks like
Condition: Every 2 seconds - action: create object enemy
I know you can do this via timers in Gdevelop but this is way quicker. Also, I feel bad for creating so many timers lol.

What does this condition “Always” do? I’ve never used it. Is it like “Every tick/frame…do…?”

For example, in the old version of Game maker, there was an action Wait. If you put it there and defined for how many milliseconds you want it to happen, the game would freeze for the time you specified.

I meant a condition that would check if there is no object on the coordinates that the object is to be created. For example, If there is no object “wall” - create…

Omg, I didnt know I could do that. Thank you so much!!

I’ll look it up, thanks.

You can simply do a position check with the not condition:

Note that inverting would trigger for every instance that does not touch the position, the not event is therefore used to not trigger unless the condition is false for all instances. If it is too tedious to write that out every time, GDevelops powerful events based extension feature lets you create your own condition for it:

Each time we had discussions about it, we were not sure how to do object selection.

As said above, a custom behavior should be the way to go. We could probably add those conditions but we already have the (more flexible) events-based behaviors so it would be a pretty low priority.

Check out the “Repeat every X seconds” extension :wink: . It is a nice little wrapper around timers to allow for less boilerplate.

This is planned, but we won’t get this for some time: we first want to add asynchronous action. Those are actions that continue executing in the background while the rest of the events sheet continues executing, and once that action finishes executing it will finish executing the actions after it and subevents.

This would be used for network operations that can take some time and this wait condition among other things. There has been some talking about it but no work was started for it as of now.

1 Like

Thank you so much for this tutorial.

I know and I’ve been always wondering why you guys dont get inspired by how Construct or Game Maker implemented it. Or are those engines that much different?

Well, the conditions would be nice but I can definitely do with the custom behavior (I didnt know you could do that)

Omg! Amazing! That’s exactly what I wanted! Thanks for letting me know!

I’m glad it’s planned!

By the way, there is one more feature that I forgot and would like to see in the future and that is Paths. What I mean by this is nodes that you would place in some kind of editor and then make for example an enemy object to go from one node to another.
Something like in this video:

Do you plan anything like this? I know that Pathfinding is already there, but this is a little bit different.

1 Like

Hmmm…that really isn’t different, it’s literally pathfinding, and even nodes are possible using the virtual grid.

To clarify, that’s not really how that works.
Actions in an apply to the selected object. Upon object creation, that object is selected (unless you’re using a “Number of objects” condition, which selects all of the objects, or doing the selection in the same event, which adds to the current selected objects list).

So You could have

(Event 1Your Conditions)   || Create Object A at X/Y
                           || Tint Color of A to 255;0;0
(Event 2 Your conditions)  || Create Object A at X/Y
                           || Tint Color of A to 0;255;0

And both As would be different colors. I tested this here and it works fine:



Really? I thought that in Pathfinding, the object tries to find a path among solid objects while in Paths the object follows the specified path.
How can I access the virtual grid and nodes? Is there any tutorial?

1 Like

There are a few pathfinding examples built into the engine. A few of them show displaying the nodes with objects.

There are actions for the nodes and virtual grids so you can tweak them, but in most cases you will just need to olay with them some.

I have checked all of these examples and none of them are what I meant. What I want to do is to program a predefined way (a path) according to which an object would move. I guess this is either very difficult to do in GDevelop or impossible.
Like this:

It’s impossible with gd. Pathfinder allow to move a sprite from point a to point b but isn’t the same.

Definitely doable, and with pathfinding.

You would just store the points either as objects or as variables, and use pathfinding to go to each point.

Edit: In fact, that’s exactly what they’re doing in the video. They’re storing each step of the path’s X/Y values as data in their game, then just having the object go to the next point after reaching the current one. Visualizing it is a different thing entirely.

You might be able to do that using LDtk’s entity functions in tilemaps once support for them is added. More discussion on that is visible here: https://github.com/4ian/GDevelop/discussions/2836

Or you could just create objects to use as pathpoints, and add them to the scene with whatever order you want. Add an ID variable to them, then add a “NextID” variable to them. Set up a “For Each pathpoints object” event, have the condition be something like “CurrentPoint (Global/Scene/object variable, you decide) = pathpoints.Variable(ID) " | Move player to PathPoint.X()/PathPoint.Y()”

Once the player is in collision with the pathpoint, you then update the CurrentPoint variable to the pathpoints.Variable(NextID) variable. It’ll then start pathing to the next object. Etc.

1 Like

To manage else I usually create a global variable else .

Else : true
Condition a : if ok then else = false .
Condition b and else = true …
I know, it’s a workaround but it’s easy to manage.

Great suggestions. I dont know if I’m capable of that but I’m gonna try it. Maybe one day someone makes an example for this.

It would be great to have it visualized. I hope it will be possible one day.

That’s a good idea! Thanks.

I wrote it for my game. I try to extrapolate the code and share it

1 Like

Amazing! Please, share it when it’s ready :wink:




Hello @jumpingj. I can’t access your file nor download it, I don’t know why. @kattan also uses the same website as you do to share files but I can access and download his files from the same website that you use but I can’t access your file.

Can you access @jumpingj’s files?

  • I can download/access his files
  • No, I can’t access his files

0 voters