Spawning enemys via PackedScene

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

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.

:bust_in_silhouette: Reply From: kidscancode

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

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

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

JokerDDZ | 2018-07-12 17:30

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

JokerDDZ | 2018-07-12 18:53

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

kidscancode | 2018-07-12 18:59

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

JokerDDZ | 2018-07-12 19:02

Yes you could do it that way too.

kidscancode | 2018-07-12 19:08

Thx for answer.

JokerDDZ | 2018-07-12 19:09