dialogs
This commit is contained in:
parent
9391847aea
commit
f4cba77cec
9 changed files with 128 additions and 58 deletions
|
@ -6,9 +6,16 @@ var origmpos
|
|||
var mousepos
|
||||
var timelimit = 15000
|
||||
var wait
|
||||
var bossready = false
|
||||
const pcnames = ["Midori Asgardius", null, null, null, null, null, null, null, null, "Natasha Dostoyevsky"]
|
||||
const npcnames = ["Lily", null, null, null, null, null, null, null, null, "Natasha Dostoyevsky"]
|
||||
const pcfaces = ["res://sprites/common/midori/face.png", null, null, null, null, null, null, null, null, "res://sprites/common/natasha/face.png"]
|
||||
const npcfaces = ["res://sprites/common/midori/face.png", null, null, null, null, null, null, null, null, "res://sprites/common/natasha/face.png"]
|
||||
var cdialog = []
|
||||
const places = [[[[null, null, false], [null, null, false]], [["res://levels/Testrooms/bullethell.tscn", 11, true], ["res://levels/Testrooms/lilytest.tscn", 20, true]], [["res://levels/Testrooms/dialogtest.tscn", 19, false], ["res://levels/Testrooms/testspawn.tscn", 2 ,false]]]]
|
||||
var cplace = [0,2,1]
|
||||
var dplace = [null, null, null]
|
||||
const dialogs = []
|
||||
const pchars = ["res://sprites/common/midori/sprite.png", null, null, null, null, null, null, null, null, "res://sprites/common/natasha/sprite.png"]
|
||||
const npchars = ["res://sprites/common/midori/sprite.png", null, null, null, null, null, null, null, null, "res://sprites/common/natasha/sprite.png"]
|
||||
var party = [null, null, null, null]
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://bspatjsjp628h"]
|
||||
|
||||
[ext_resource type="Script" path="res://levels/Testrooms/testspawn.gd" id="1_wsfn4"]
|
||||
[ext_resource type="Texture2D" uid="uid://kxvipok4tnuw" path="res://backgounds/wip.jpg" id="2_5agyo"]
|
||||
[ext_resource type="PackedScene" uid="uid://cehe6sm8ly06u" path="res://sprites/common/player/player.tscn" id="3_gs020"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_nytv7"]
|
||||
size = Vector2(20, 761)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wkumn"]
|
||||
size = Vector2(1283, 20)
|
||||
|
||||
[node name="Testspawn" type="Node2D"]
|
||||
script = ExtResource("1_wsfn4")
|
||||
|
||||
[node name="WIP" type="TextureRect" parent="."]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
texture = ExtResource("2_5agyo")
|
||||
|
||||
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
||||
position = Vector2(-11, 361.5)
|
||||
shape = SubResource("RectangleShape2D_nytv7")
|
||||
|
||||
[node name="StaticBody2D2" type="StaticBody2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D2"]
|
||||
position = Vector2(1293, 358)
|
||||
shape = SubResource("RectangleShape2D_nytv7")
|
||||
|
||||
[node name="StaticBody2D3" type="StaticBody2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D3"]
|
||||
position = Vector2(641.5, -9)
|
||||
shape = SubResource("RectangleShape2D_wkumn")
|
||||
|
||||
[node name="StaticBody2D4" type="StaticBody2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D4"]
|
||||
position = Vector2(644, 731)
|
||||
shape = SubResource("RectangleShape2D_wkumn")
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("3_gs020")]
|
||||
position = Vector2(654, 594)
|
16
levels/Testrooms/bullethell.gd
Normal file
16
levels/Testrooms/bullethell.gd
Normal file
|
@ -0,0 +1,16 @@
|
|||
extends Node2D
|
||||
var talk = load("res://levels/ui/talk.tscn").instantiate()
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
Global.cdialog = [["What are you doing heree?", true, 0], ["Your father need help to debug this game", false, 9], ["Ok, i'll help too", true, 0]]
|
||||
Global.live = 0
|
||||
get_tree().root.add_child.call(talk)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
func _input(event):
|
||||
if Global.cdialog.size() == 0:
|
||||
get_tree().root.remove_child(talk)
|
|
@ -1,5 +1,6 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://c8hmum2w6aygy"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://c8hmum2w6aygy"]
|
||||
|
||||
[ext_resource type="Script" path="res://levels/Testrooms/bullethell.gd" id="1_cjbjq"]
|
||||
[ext_resource type="Texture2D" uid="uid://dursxelwwxe8u" path="res://sprites/common/placeholder/player.png" id="1_g5hs8"]
|
||||
[ext_resource type="PackedScene" uid="uid://dpudp1d2wpryc" path="res://sprites/common/natasha/natasha.tscn" id="2_5cnwp"]
|
||||
[ext_resource type="PackedScene" uid="uid://cehe6sm8ly06u" path="res://sprites/common/player/player.tscn" id="3_slxde"]
|
||||
|
@ -11,6 +12,7 @@ size = Vector2(20, 761)
|
|||
size = Vector2(1283, 20)
|
||||
|
||||
[node name="Bullethell" type="Node2D"]
|
||||
script = ExtResource("1_cjbjq")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
offset_left = 583.0
|
||||
|
|
17
levels/Testrooms/dialogtest.gd
Normal file
17
levels/Testrooms/dialogtest.gd
Normal file
|
@ -0,0 +1,17 @@
|
|||
extends Node2D
|
||||
var talk = load("res://levels/ui/talk.tscn").instantiate()
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
Global.cdialog = [["What is this place?", true, 0], ["I'm here", false, 9], ["I got you, cheap copy", false, 0]]
|
||||
Global.live = 0
|
||||
get_tree().root.add_child.call(talk)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
func _input(event):
|
||||
if Global.cdialog.size() == 0:
|
||||
get_tree().root.remove_child(talk)
|
||||
Global.live = 1
|
|
@ -1,5 +1,6 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://cs2dkktcbaptx"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://cs2dkktcbaptx"]
|
||||
|
||||
[ext_resource type="Script" path="res://levels/Testrooms/dialogtest.gd" id="1_hf3bg"]
|
||||
[ext_resource type="PackedScene" uid="uid://cehe6sm8ly06u" path="res://sprites/common/player/player.tscn" id="2_lfw71"]
|
||||
[ext_resource type="Texture2D" uid="uid://kxvipok4tnuw" path="res://backgounds/wip.jpg" id="2_xoavp"]
|
||||
|
||||
|
@ -10,6 +11,7 @@ size = Vector2(20, 761)
|
|||
size = Vector2(1283, 20)
|
||||
|
||||
[node name="Dialogtest" type="Node2D"]
|
||||
script = ExtResource("1_hf3bg")
|
||||
|
||||
[node name="WIP" type="TextureRect" parent="."]
|
||||
offset_right = 40.0
|
||||
|
|
|
@ -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,11 +33,10 @@ 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)
|
||||
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
45
levels/ui/talk.gd
Normal 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 = []
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue