Tutorial 1: Basic Numbers in GDScript

Numbers in GDScript
The image above shows an example code on how to solve the area of a circle using Godot script. You can download the source code here.

In the GDScript, you'll learn how to declare an integer, float and constant variables; the use of a hash symbol for remarks; utilizing the built-in function _ready() to generate results in the output console; using the print() function to print texts; converting any numbers to string with str() function; and, stepify() function used to reduce a float to 2 decimal places.

Below shows the answer in the Output console using the given radius of 3.

Godot Output Console

As for your practice, solve the area of a cone utilizing the techniques in this tutorial with the sqrt() function.

0 comments:

Post a Comment

© 2020 by Emman Lijesta, all rights reserved. Powered by Blogger.