Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | VirtualTeddy |
Okay so I have a
var current_dia_id = 0
Then I have it where once it’s been interacted with, it will up the number.
func _input(event):
if not d_active:
return
if event.is_action_pressed("ui_accept"):
next_script()
func next_script():
current_dia_id += 1
Now here let me lay out the piece of code I’m stuck on.
The first part of the script for the length of dialogue, it just detects if it has reached the end and then makes it invisible. That part I know works. But the part underneath it is the part that’s kicking my butt. I am trying to make it detect when the current_dia_id becomes a certain number, so that when it is that number it plays an animation. I don’t know if I have it placed in a wrong position or what. Can anyone help?
func next_script():
current_dia_id += 1
if current_dia_id >= len(dialogue):
$Timer.start()
$NinePatchRect.visible = false
return
if current_dia_id == [0]:
$AnimationPlayer.play("textpop")
if current_dia_id == [1]:
$AnimationPlayer.play("textpop")
if current_dia_id == [2]:
$AnimationPlayer.play("textpop")
$NinePatchRect/Name.text = dialogue[current_dia_id]['name']
$NinePatchRect/Text.text = dialogue[current_dia_id]['text']