Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.
Only the player icon is spawningstupid-grouseFor some reason only the player icon is spawning on my timeline. I'm using Godot 4 and this is where I got so far.
```gdscript
func setup(battlers: Array) -> void:
for battler in battlers:
# We first calculate the right icon background using the `Types` enum from `UIBattlerIcon`.
# Below, I'm using the ternary operator. It picks the first value if the condition is `true`,
# otherwise, it picks the second value.
var type: int = (
UIBattlerIcon.Types.PLAYER
if battler.is_party_member
else UIBattlerIcon.Types.ENEMY
)
# We create an instance of the `UIBattlerIcon` scene using a function and add it as a child.
var icon: UIBattlerIcon = create_icon(type, battler.ui_data.texture)
# We get to use the `Battler.readiness_changed` signal again to move the icons along the turn bar.
# Once again, we bind the icon to the callback for each battler, so we don't have to worry
# about which battler corresponds to which icon later.
battler.readiness_changed.connect(_on_Battler_readiness_changed.bind(icon))
_background.add_child(icon)
```20May. 08, 2024
Lesson Q&A
Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.