Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | JokerDDZ |
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.
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | JokerDDZ |
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.
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
add_child(e)
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
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