Releases: rune-scape/godot
Releases · rune-scape/godot
4.2.3.rc.custom_build.a45d9d793
Added feature: when notified declaration
v4.0.1c-r6
-
Includes
when
andwhen notified
declarations ✨:
# can have multiple `when ready:` definitions in the script and they will all be called in order
# and called from basest class up if extending another script with `when ready:` definitions
# (that applies to all when decls, but importantly it acts like `_ready` did in godot 3. :3 )
when ready:
set_physics_process(true)
# v This is almost works like '_physics_process()' in godot 3 (calls up through inheritance chain)
# but you need to `set_physics_process(true)` in a `when ready:` declaration
when notified NOTIFICATION_PHYSICS_PROCESS:
print("ourple")
when $Button.pressed:
print("ourpler")
-
Includes Operator Overloading:
class_name Vec2
var x
var y
func _init(x, y):
self.x = x
self.y = y
# Overload the '+' operator to add two Vec2 objects
func _add(other):
return Vec2.new(self.x + other.x, self.y + other.y)
# Can also overload the '+' operator as the rhs. only used if _add wasn't found on the lhs arg
func _radd(other):
return Vec2.new(self.x + other.x, self.y + other.y)
# Overload the '-' operator to subtract two Vector2 objects
func _sub(other):
return Vec2.new(self.x - other.x, self.y - other.y)
# Overload the '*' operator to multiply a Vector2 object by a scalar
func _mul(scalar):
return Vec2.new(self.x * scalar, self.y * scalar)
-
Editor will also show errors of dependant scripts
bugfixes:
- weird highlighting bug
- errors could show wrong script path
v4.0.1c-r5
-
Includes
when
andwhen notified
declarations ✨:
when ready:
set_physics_process(true)
# v This is almost works like '_physics_process()' in godot 3 (calls up through inheritance chain)
# but you need to `set_physics_process(true)` in a `when ready:` declaration
when notified NOTIFICATION_PHYSICS_PROCESS:
print("ourple")
-
Includes Operator Overloading:
class_name Vec2
var x
var y
func _init(x, y):
self.x = x
self.y = y
# Overload the '+' operator to add two Vec2 objects
func _add(other):
return Vec2.new(self.x + other.x, self.y + other.y)
# Can also overload the '+' operator as the rhs. only used if _add wasn't found on the lhs arg
func _radd(other):
return Vec2.new(self.x + other.x, self.y + other.y)
# Overload the '-' operator to subtract two Vector2 objects
func _sub(other):
return Vec2.new(self.x - other.x, self.y - other.y)
# Overload the '*' operator to multiply a Vector2 object by a scalar
func _mul(scalar):
return Vec2.new(self.x * scalar, self.y * scalar)
-
Editor will also show errors of dependant scripts