Embracing Strong Typing in Godot 4
Strong typing makes your GDScript faster, safer, and more powerful. Variables, as you know, come in different types. Some basic types include... Type Values Example int Whole numbers (1,42,-7) var score: int = 0 float Decimal numbers (1.0, -2.75) var speed: float = 3.5 bool true or false var is_alive: bool = true String Text var name: String = "Player" Vector2 2D position (x, y) var start_position: Vector2 = Vector2 ( 100 , 200 ) Vector3 3D position (x, y, z) var start_position: Vector3 = Vector3 ( 1 , 2 , 3 ) Color RGBA color var color: Color = Color ( 1 , 0 , 0 ) Rect2 2D rectangle (position + size) var rect: Rect2 = Rect2 ( Vector2 ( 0 , 0 ), Vector2 ( 10 , 10 )) In programming, typing refers to how a l...