v4.0.1c-r5
rune-scape
released this
22 Apr 00:02
·
276 commits
to rune-custom
since this release
-
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