1/26/2024 0 Comments Godot signals![]() ![]() # Functions func foo (): pass # pass keyword is a placeholder for future code func add ( first, second ): return first + second # Printing values func printing (): print ( "GDScript ", "is ", " awesome." ) prints ( "These", "words", "are", "divided", "by", "spaces." ) printt ( "These", "words", "are", "divided", "by", "tabs." ) printraw ( "This gets printed to system console." ) # Math func doing_math (): var first = 8 var second = 4 print ( first + second ) # 12 print ( first - second ) # 4 print ( first * second ) # 32 print ( first / second ) # 2 print ( first % second ) # 0 # There are also +=, -=, *=, /=, %= etc., # however no ++ or - operators. export ( int ) var age export ( float ) var height export var person_name = "Bob" # Export type hints are unnecessary # if you set a default value. ![]() var d = # Exported variables are visible in the inspector. class_name M圜lass # Inheritance extends Node2D # Member variables var x = 8 # int var y = 1.2 # float var b = true # bool var s = "Hello World!" # String var a = # Array - similar to list in Python, # it can hold different types # of variables at once. """ # Script file is a class in itself and you can optionally define a name for it. """ Multi-line comments are written using docstrings. # Single-line comments are written using hash symbol.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |