midori-school/levels/ui/talk.gd

50 lines
1.6 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-01-28 00:01:47 +01:00
if Input.is_action_just_pressed("ui_accept") && !press:
press = true
if Input.is_action_just_released("ui_accept") && 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-03-06 18:49:01 +01:00
pface.texture = load((Global.pcfaces[Global.cdialog[dindex][2]][Global.cdialog[dindex][2]]))
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]
if isboss:
Global.bossready = true
2024-03-06 18:49:01 +01:00
Global.live = 1
2024-01-27 23:38:20 +01:00
Global.cdialog = []
2024-01-28 00:01:47 +01:00
press = false