Compare two variables

Hello, lets say i have “scene_var1” and “scene_var2”.
How do i compare:
if scene_var1 - scene-var2 > 0 ?

Is there such thing in GDevelop?

Greetings Horst

there is no if in gdevelop
Value of scene variable var1 <, > or = than Variable (var2)

In case you don’t want to change the value of the variable scene_var1, only want to compare it, you need to use expressions and assign the result to a new variable:

newSceneVar = Variable(scene_var1) - Variable(scene_var2)

Variable(variable_name) is the expression to reference scene number variables inside any value field.

And then you can check if the value of the scene variable newSceneVar > 0

In GDevelop standard events works similar to if statements. Conditions are the statements and the action block is the body of statement that being executed in case the statement is true. Basically each event block is an if statement.

1 Like

Thanks, thats what i wanted to know!