it seems like the code should work correctly, but it gives 2 errors

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By kraken

it seems like the code should work correctly, but it gives 2 errors

I don’t understand why it gives the error “error (2,1): “extends” can only be present once in the script”. and “error(10.1): the method “set_initial_velocity” is not declared in the current class.”

extends Particles2D

var velocity = Vector2()

func _ready():
set_emitting(true)
set_amount(100)

set_one_shot(false)
set_initial_velocity(1)
set_speed_scale(0.5)

func _process(delta):
for i in range(get_amount()):
velocity = Vector2(rand_range(-100, 100), rand_range(-100, 100))
velocity = velocity.normalized() * rand_range(50, 200)
set_emission_transform(i, Transform2D(velocity, Vector2()))

:bust_in_silhouette: Reply From: zhyrin

Particles2D has neither an initial_velocity nor an emission_transform property.