In this post we are going to take a look at How to write if-else statement in GDScript using Godot Engine.
In previous tutorial we covered how to make the dictionary in the GDscript in Godot Engine. So in this tutorial we will take a look at the traditional if-else statement. This is similar to any other programming language and the syntax looks pretty much similar to the python syntax.
Along with the if-else statement the loops are pretty much interesting too. I wish to cover them in near future. As of now I found out the use for the if-else in your conditional programming.
So this is 8th tutorial in the series. And the previous one I wish to link below and hopefully you would find some value out of them. Make sure that you download the godot engine and follow the tutorial series one after another or as you please.
Do check out the tutorials in the below table of contents and see which one applies for your current learning trail. This would give you some direction on how to make use of the if-else statement in GDscript.
So let's get started with below video and you can check the TOC below if you want to access the previous tutorials.
Table of Contents of Godot Engine Tutorials
- Godot Engine - Create New Project
- Godot Engine - Change Scene Background
- Godot Engine - Add Image Background
- Godot Engine - Change Icon of Boot Splash Screen
- Godot Engine - Create GDScript
- Godot Engine - Create Function
- Godot Engine - Create Dictionary
Now check out the Video tutorial below in order to Create if-else Statement in GDScript for your game project.
If you have learned the python or any other simple language like say Lua then you would find learning some of the loops and conditional statements from the GDscript lot easier to work with. I'd recommend you to check out the previous tutorials too. That would give you a direction on what to expect and what to do in that case.
If you want to try out the similar game development tutorials using the gdevelop, you can follow this tutorial trail of GDevelop Tutorials.
I hope the current tutorial was useful to you.
We will continue the further game development topic in next post.
Great post!
the website looks very high quality
Thanks