Hi!
I have doors in my game that come in a variety of shapes and sizes. Initially, I created a new scene for each door that is different. But I have around 20 doors atm, so had to change tactics. I thought I was being smart by using only one door scene, and then exporting variables for the collision shape, sprite texture, sprite region, coordinate/time values for tweening etc. ALL of these work beautifully, apart from the collision shape.
I tried to make the scenes unique by selecting "Make Local". But this did not work as changing the size of one door affected ALL the others as well. I also tried to tick the checkbox called "Local to Scene" under the CollisionShape2D's Shape property but again this did not work.
@export var x_coordinate : int = 0
@export var y_coordinate : int = 80
@export var time = 0.3
@export var sprite : String = "warning"
@export var sprite_region : Rect2 = Rect2(1040,360,120,40)
@export var collision_shape : Vector2 = Vector2(40, 120)
@export var sprite_rotation = 0
func _ready():
$Sprite2D.region_rect = sprite_region
$Sprite2D.rotation = sprite_rotation
$CollisionShape2D.shape.size = collision_shape
Please let me know what I'm doing wrong, or if there is a different/better way of achieving this, I'm all ears.