0 votes

Hello.
I created few spawners which spawn enemys via PackedScene. After few waves I want to change speed of enemy scene but I dont know how.

asked Jul 12 in Engine by JokerDDZ (50 points)

1 Answer

+1 vote
Best answer

You haven't said how your enemies are set up, but you can set any property of an instanced scene after instancing.

For example, if you have a wave variable tracking what wave you're on and your enemy has a speed property:

var e = EnemyScene.instance()
e.speed = 100 + wave * 5
add_child(e)

That would make them get a little bit faster each wave. Adjust for your preferences.

answered Jul 12 by kidscancode (5,720 points)
selected Jul 12 by JokerDDZ

Yea, its working. Thank you very much for your help :)

I have one more question. Is it the same if I add childs to the group ???

I'm not sure what you mean. What group?

I want to add all children to one group (for example "enemys") and after that change their speed via refer to the group.

Yes you could do it that way too.

Thx for answer.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.