Hi, I started out with godot recently, coming from a python background. I like to think of godot scripts as the classes in my project, I'm not even using inner classes. A lot of my classes require instance variables, which in python I would just declare using "self" in the constructor. This is pretty much what I'm doing in godot at the moment, however I have to declare them before I can assign them with _init.
Here's what I mean:
extends Node2D
var attach_point: Vector2
var start_vec: Vector2
var end_vec: Vector2
var strength: float
func _init(attach_point, start_vec, end_vec, strength):
self.attach_point = attach_point
self.start_vec = start_vec
self.end_vec = end_vec
self.strength = strength
Is there a way to do this in one line? I am aware that I can just assign them after instancing the script, however I prefer to use my_class.new(param1, param2 ...)