Godot Version
4.2.2
Question
Hello, im using dialogic to manage my dialogue system in a top down rpg, i already managed to display dialogue if the player is in the area but now the problem is that the player is still capable of moving while the dialog is running and i dont want that, what can i do?
heres my player code
Blockquote
extends CharacterBody2D
var speed = 150
var run_speed = 230
var is_running = false
@onready var animation = $AnimatedSprite2D
var current_animation = “”
func _ready():
pass
func _unhandled_input(event):
# Movimiento
velocity.x = Input.get_axis("move_left", "move_right")
velocity.y = Input.get_axis("move_up", "move_down")
# Animaciones cuando no se mueve
if Input.is_action_just_released("move_down"):
play_animation("default_down")
elif Input.is_action_just_released("move_up"):
play_animation("default_up")
elif Input.is_action_just_released("move_right"):
play_animation("default_right")
elif Input.is_action_just_released("move_left"):
play_animation("default_left")
func update_animation():
var new_animation = “”
if abs(velocity.x) > abs(velocity.y):
if velocity.x > 0:
new_animation = "walk_right"
else:
new_animation = "walk_left"
else:
if velocity.y > 0:
new_animation = "walk_down"
else:
new_animation = "walk_up"
if current_animation != new_animation:
play_animation(new_animation)
func play_animation(anim_name):
if animation.animation != anim_name:
animation.play(anim_name)
current_animation = anim_name
func _physics_process(delta):
is_running = Input.is_action_pressed("ui_back")
var current_speed = speed
if is_running:
current_speed = run_speed
if velocity != Vector2.ZERO:
velocity = velocity.normalized() * current_speed
move_and_slide()
update_animation()
func player():
pass
and the interactable object:
Blockquote
extends Area2D
var player_in_area = false
var dialog_in_course = false
var player
func _input(event):
if player_in_area:
if Input.is_action_just_pressed(“ui_ok”):
if Dialogic.current_timeline == null:
run_dialogue(“prueba1”)
func run_dialogue(dialogue_string):
Dialogic.start(dialogue_string)
func _on_body_entered(body):
if body.has_method(“player”):
player_in_area = true
func _on_body_exited(body):
if body.has_method(“player”):
player_in_area = false
Blockquote