![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Nirmal |
hi, this is my first question im very beginner to godot, Im making a simple turn based game similar to hearbeast tutorial.
On extending his tutorial, Now my enemy does only damage in his turn
But i want him to pick random move in his turn such as healing…
This is my damage code in enemy scene :
func deal_damage():
rng.randomize()
damage = rng.randi_range(4,10)
BattleUnits.PlayerStats.hp -= damage
Should i create func heal_hp like that,Even after creating function healp_hp how can i make my enemy to pick any one move in his turn
This is my attack code in enemy scene
func attack() -> void:
yield(get_tree().create_timer(0.4), "timeout")
animationPlayer.play("Attack")
yield(animationPlayer, "animation_finished")
emit_signal("end_turn")
This is my code in battle scene
func start_enemy_turn():
battleActionButtons.hide()
textboxpanel.hide()
var enemy = BattleUnits.Enemy
if enemy != null and not enemy.is_queued_for_deletion():
enemy.attack()
yield(enemy, "end_turn")
start_player_turn()
Is using function is a right way OR
Is there any other better solution to determine enemy to pick a random move in his turn… Please I need help