midori-school/levels/ui/talk.gd

57 lines
1.8 KiB
GDScript3
Raw Normal View History

2024-01-27 23:38:20 +01:00
extends Node2D
var dindex = 0
var cname
var dialog
var pface
2024-01-28 00:01:47 +01:00
var press = false
2024-01-27 23:38:20 +01:00
# Called when the node enters the scene tree for the first time.
func _ready():
2024-03-09 02:50:47 +01:00
cname = $CanvasLayer/Cname
dialog = $CanvasLayer/Dialog
pface = $CanvasLayer/Playerface
2024-01-27 23:38:20 +01:00
if Global.cdialog[dindex][1]:
cname.set_text(Global.pcnames[Global.cdialog[dindex][2]])
2024-03-06 18:49:01 +01:00
pface.texture = load(Global.pcfaces[Global.cdialog[dindex][2]][Global.cdialog[dindex][3]])
2024-01-27 23:38:20 +01:00
else:
cname.set_text(Global.npcnames[Global.cdialog[dindex][2]])
2024-01-30 04:05:17 +01:00
pface.texture = load(Global.npcfaces[Global.cdialog[dindex][2]])
2024-01-27 23:38:20 +01:00
dialog.set_text(Global.cdialog[dindex][0])
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _input(event):
2024-12-02 20:49:07 +01:00
if (Input.is_action_just_pressed("ui_accept") || Input.is_action_just_pressed("mclick")) && !press:
2024-01-28 00:01:47 +01:00
press = true
2024-12-02 20:49:07 +01:00
if (Input.is_action_just_released("ui_accept") || Input.is_action_just_released("mclick")) && press:
2024-01-27 23:38:20 +01:00
dindex += 1
if dindex < Global.cdialog.size():
if Global.cdialog[dindex][1]:
cname.set_text(Global.pcnames[Global.cdialog[dindex][2]])
2024-08-24 05:54:38 +02:00
pface.texture = load((Global.pcfaces[Global.cdialog[dindex][2]][Global.cdialog[dindex][3]]))
2024-01-27 23:38:20 +01:00
else:
cname.set_text(Global.npcnames[Global.cdialog[dindex][2]])
pface.texture = load((Global.npcfaces[Global.cdialog[dindex][2]]))
dialog.set_text(Global.cdialog[dindex][0])
else:
var isboss
if Global.debug:
isboss = Global.places[Global.dplace[0]][Global.dplace[1]][Global.dplace[2]][2]
else:
isboss = Global.places[Global.cplace[0]][Global.cplace[1]][Global.cplace[2]][2]
2024-07-16 02:22:33 +02:00
if Global.live == 0:
if isboss:
Global.bossready = true
Global.live = 1
queue_free()
elif Global.live == 3:
if Global.ccutscene == null:
Global.live = 7
else:
Global.live = 8
queue_free()
2024-01-28 00:01:47 +01:00
press = false