This commit is contained in:
Page Asgardius 2024-01-27 15:38:20 -07:00
parent 9391847aea
commit f4cba77cec
9 changed files with 128 additions and 58 deletions

View file

@ -6,6 +6,7 @@ var bgsound := AudioStreamPlayer.new()
var sfx1 := AudioStreamPlayer.new()
var musictrack
var isboss
var bhud = load("res://levels/bottomhud.tscn").instantiate()
# Called when the node enters the scene tree for the first time.
func _ready():
@ -32,12 +33,11 @@ func _ready():
# player.position.y = Global.places[Global.cplace[0]][Global.cplace[1]][Global.cplace[2]][2]
music = load(musictrack)
get_tree().root.add_child.call_deferred(level)
get_tree().root.add_child.call_deferred(bhud)
#get_tree().root.add_child.call_deferred(player)
bgsound.stream = music
if isboss:
sfx1.stream = load(Global.sfxtracks[1])
sfx1.play(0)
bgsound.play(0)
if !isboss:
bgsound.play(0)
@ -64,6 +64,8 @@ func _process(delta):
func _input(event):
if Input.is_key_pressed(KEY_ESCAPE) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK):
Global.live = 0
Global.bossready = false
get_tree().root.remove_child(bhud)
get_tree().root.remove_child(player)
get_tree().root.remove_child(level)
if Global.debug:
@ -98,3 +100,8 @@ func _input(event):
else:
if Global.party[3] != null:
Global.cpchar = 3
if Global.bossready:
Global.bossready = false
sfx1.stream = load(Global.sfxtracks[1])
sfx1.play(0)
bgsound.play(0)

45
levels/ui/talk.gd Normal file
View file

@ -0,0 +1,45 @@
extends Node2D
var dindex = 0
var cname
var dialog
var pface
# Called when the node enters the scene tree for the first time.
func _ready():
cname = $Cname
dialog = $Dialog
pface = $Playerface
if Global.cdialog[dindex][1]:
cname.set_text(Global.pcnames[Global.cdialog[dindex][2]])
pface.texture = load((Global.pcfaces[Global.cdialog[dindex][2]]))
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])
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _input(event):
if Input.is_action_just_pressed("ui_accept"):
dindex += 1
if dindex < Global.cdialog.size():
if Global.cdialog[dindex][1]:
cname.set_text(Global.pcnames[Global.cdialog[dindex][2]])
pface.texture = load((Global.pcfaces[Global.cdialog[dindex][2]]))
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
Global.live = 1
Global.cdialog = []

View file

@ -1,8 +1,10 @@
[gd_scene load_steps=2 format=3 uid="uid://cd8hd11usuhbu"]
[gd_scene load_steps=3 format=3 uid="uid://cd8hd11usuhbu"]
[ext_resource type="Texture2D" uid="uid://bb4sw2rhdbjbf" path="res://sprites/common/placeholder/face.png" id="1_4l8il"]
[ext_resource type="Script" path="res://levels/ui/talk.gd" id="1_c5y35"]
[node name="Talk" type="Node2D"]
script = ExtResource("1_c5y35")
[node name="Playerface" type="TextureRect" parent="."]
offset_left = 511.0
@ -11,6 +13,24 @@ offset_right = 767.0
offset_bottom = 291.0
texture = ExtResource("1_4l8il")
[node name="Continue" type="ColorRect" parent="."]
offset_left = 39.0
offset_top = 118.0
offset_right = 276.0
offset_bottom = 177.0
color = Color(0.254902, 0.254902, 0.254902, 1)
[node name="Continuetext" type="Label" parent="."]
offset_left = 39.0
offset_top = 119.0
offset_right = 276.0
offset_bottom = 177.0
theme_override_font_sizes/font_size = 20
text = "Press enter or B
to continue"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Textbox" type="ColorRect" parent="."]
offset_left = 41.0
offset_top = 319.0
@ -18,22 +38,22 @@ offset_right = 1243.0
offset_bottom = 681.0
color = Color(0.254902, 0.254902, 0.254902, 1)
[node name="Label" type="Label" parent="."]
[node name="Cname" type="Label" parent="."]
offset_left = 41.0
offset_top = 319.0
offset_right = 1243.0
offset_bottom = 412.0
theme_override_font_sizes/font_size = 68
offset_bottom = 374.0
theme_override_font_sizes/font_size = 40
text = "Character name goes here"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Dialog" type="Label" parent="."]
offset_left = 41.0
offset_top = 414.0
offset_top = 377.0
offset_right = 1243.0
offset_bottom = 681.0
theme_override_font_sizes/font_size = 68
theme_override_font_sizes/font_size = 40
text = "Your dialog goes here"
horizontal_alignment = 1
vertical_alignment = 1