Skip to content

Commit

Permalink
added over_hearing
Browse files Browse the repository at this point in the history
  • Loading branch information
Sayantan0013 committed Jan 5, 2021
1 parent e94f760 commit 2e779da
Show file tree
Hide file tree
Showing 15 changed files with 337 additions and 45 deletions.
85 changes: 49 additions & 36 deletions UI/Vocabulary/ItemList-Trial.tscn
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=6 format=2]

[ext_resource path="res://UI/Vocabulary/ItemList-Trial.gd" type="Script" id=1]
[ext_resource path="res://UI/Vocabulary/Old-Paper-2.jpg" type="Texture" id=2]
[ext_resource path="res://pic/%E2%80%94Pngtree%E2%80%94original%20cartoon%20done%20old%20yellow_4887212.png" type="Texture" id=2]
[ext_resource path="res://UI/Vocabulary/x.png" type="Texture" id=3]
[ext_resource path="res://UI/Vocabulary/New_list.gd" type="Script" id=4]
[ext_resource path="res://pic/overview-pages-1.png" type="Texture" id=5]

[node name="CanvasLayer" type="CanvasLayer"]
[node name="Vocubulary_box" type="CanvasLayer"]
script = ExtResource( 4 )

[node name="Control" type="Control" parent="."]
Expand All @@ -16,82 +17,94 @@ __meta__ = {
}

[node name="Panel" type="Panel" parent="Control"]
margin_left = 43.0
margin_top = 5.0
margin_right = 400.0
margin_bottom = 404.0
margin_right = 370.0
margin_bottom = 354.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="TextureRect" type="TextureRect" parent="Control/Panel"]
margin_left = 2.24744
margin_top = -4.0
margin_right = 400.247
margin_bottom = 405.0
margin_left = 383.682
margin_top = -10.5681
margin_right = 1450.68
margin_bottom = 860.432
rect_rotation = 90.0
rect_scale = Vector2( 0.4, 0.5 )
texture = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Label-StaticNote" type="Label" parent="Control/Panel"]
margin_left = 71.9282
margin_top = 265.473
margin_right = 185.928
margin_bottom = 279.473
margin_left = 33.433
margin_top = 290.418
margin_right = 147.433
margin_bottom = 304.418
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "You Have Chosen:"
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Label - output" type="Label" parent="Control/Panel"]
margin_left = 197.365
margin_top = 264.582
margin_right = 237.365
margin_bottom = 278.582
margin_left = 160.163
margin_top = 291.287
margin_right = 200.163
margin_bottom = 305.287
custom_colors/font_color = Color( 0.0390625, 0.00213623, 0.00213623, 1 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="ItemList" type="ItemList" parent="Control/Panel"]
margin_left = 69.4568
margin_top = 28.8909
margin_right = 296.457
margin_bottom = 243.891
margin_left = 48.5539
margin_top = 51.8341
margin_right = 275.554
margin_bottom = 266.834
__meta__ = {
"_edit_use_anchors_": false
}

[node name="GoButton" type="Button" parent="Control/Panel"]
margin_left = 112.492
margin_top = 305.8
margin_right = 228.492
margin_bottom = 325.8
margin_left = 112.451
margin_top = 327.082
margin_right = 228.451
margin_bottom = 347.082
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_colors/font_color_hover = Color( 0, 0, 0, 1 )
custom_colors/font_color_pressed = Color( 0, 0, 0, 1 )
text = "Go"
flat = true
__meta__ = {
"_edit_use_anchors_": false
}

[node name="exit" type="Button" parent="Control/Panel"]
margin_left = 335.0
margin_top = 24.0
margin_right = 859.0
margin_bottom = 542.0
margin_left = 303.046
margin_top = 27.3636
margin_right = 827.046
margin_bottom = 545.364
rect_scale = Vector2( 0.05, 0.05 )
icon = ExtResource( 3 )
flat = true
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Button" type="Button" parent="Control"]
margin_left = 45.0
margin_top = 542.0
margin_right = 88.0
margin_bottom = 570.0
text = "Open"
[node name="open" type="Button" parent="Control"]
margin_left = 32.3008
margin_top = 538.032
margin_right = 496.301
margin_bottom = 996.032
rect_scale = Vector2( 0.09, 0.09 )
icon = ExtResource( 5 )
flat = true
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="report" from="Control/Panel" to="." method="_on_Panel_report"]
[connection signal="pressed" from="Control/Panel/exit" to="Control/Panel" method="_on_exit_pressed"]
[connection signal="pressed" from="Control/Button" to="." method="_on_Button_pressed"]
[connection signal="pressed" from="Control/open" to="." method="_on_Button_pressed"]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/%E2%80%94Pngtree%E2%80%94original%20cartoon%20done%20old%20yellow_4887212.png-b948793917b20f90cc061feefebfddfe.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://pic/%E2%80%94Pngtree%E2%80%94original%20cartoon%20done%20old%20yellow_4887212.png"
dest_files=[ "res://.import/%E2%80%94Pngtree%E2%80%94original%20cartoon%20done%20old%20yellow_4887212.png-b948793917b20f90cc061feefebfddfe.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file added pic/blank-parchment-texture-3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions pic/blank-parchment-texture-3.jpg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/blank-parchment-texture-3.jpg-4303567a0382ad4f14de62d43187feda.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://pic/blank-parchment-texture-3.jpg"
dest_files=[ "res://.import/blank-parchment-texture-3.jpg-4303567a0382ad4f14de62d43187feda.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file added pic/overview-pages-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions pic/overview-pages-1.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/overview-pages-1.png-016055bbbd3c60678f261edd29f706f1.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://pic/overview-pages-1.png"
dest_files=[ "res://.import/overview-pages-1.png-016055bbbd3c60678f261edd29f706f1.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file not shown.
21 changes: 21 additions & 0 deletions resources/audio/Lord of the Land - Kevin MacLeod.wav.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[remap]

importer="wav"
type="AudioStreamSample"
path="res://.import/Lord of the Land - Kevin MacLeod.wav-b6dbe354d4b0015f9c39c9a32859d51f.sample"

[deps]

source_file="res://resources/audio/Lord of the Land - Kevin MacLeod.wav"
dest_files=[ "res://.import/Lord of the Land - Kevin MacLeod.wav-b6dbe354d4b0015f9c39c9a32859d51f.sample" ]

[params]

force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop=false
compress/mode=0
20 changes: 20 additions & 0 deletions resources/speaking_characters/group 2.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
extends StaticBody2D

signal hear(value)
# Declare member variables here. Examples:
# var a = 2
# var b = "text"


# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass


func _on_Area2D_body_entered(body,value):
emit_signal('hear',value)
10 changes: 9 additions & 1 deletion resources/speaking_characters/group 2.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[gd_scene load_steps=2 format=2]
[gd_scene load_steps=3 format=2]

[ext_resource path="res://resources/tilesets/conversing_chars_closepos.tres" type="TileSet" id=1]
[ext_resource path="res://resources/speaking_characters/group 2.gd" type="Script" id=2]

[node name="Node2D" type="StaticBody2D"]
script = ExtResource( 2 )

[node name="TileMap" type="TileMap" parent="."]
mode = 1
Expand All @@ -13,3 +15,9 @@ tile_data = PoolIntArray( -131075, 6, 0, -131074, 7, 0, -65539, 4, 0, -65538, 5,

[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
polygon = PoolVector2Array( -188.179, 113.587, -24.1925, 30.4704, 181.415, 121.887, 31.4681, 219.027 )

[node name="Area2D" type="Area2D" parent="."]

[node name="over_hearing" type="CollisionPolygon2D" parent="Area2D"]
polygon = PoolVector2Array( -232.653, 114.859, 31.6316, 256.44, 230.789, 123.354, -27.8325, 1.59412 )
[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"]
55 changes: 55 additions & 0 deletions scenes/Over_hearing.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
extends CanvasLayer

onready var system = $Control
onready var dialogue = $Control/dialogue
onready var speaker = $Control/speaker
onready var box = $Control/TextureRect

signal completed

var index: int = 0
var loadedDialogue: Dictionary

onready var tween: Tween = $Control/Tween
export (String, FILE, "*.json") var dialogue_file_path = "res://resources/dialogue/ayan.json" setget set_dialogue_file_path

var state: Dictionary = {} setget set_state

func set_dialogue_file_path(path: String) -> void:
dialogue_file_path = path
DialogueLoader.set_dialogue_file_path(dialogue_file_path)

func set_state(new_state: Dictionary) -> void:
state = new_state

func process_state(new_state: Dictionary) -> void:
speaker.text = new_state["character"]+ ":"
dialogue.text = new_state["text"]
tween.interpolate_property(dialogue, "visible_characters", 0, dialogue.text.length(), 0.08 * dialogue.text.length())
tween.start()

func _ready() -> void:
system.set_visible(false)
DialogueLoader.set_dialogue_file_path(dialogue_file_path)
# set_state(loadedDialogue[String(index)])
# process_state(state)

func _on_Button_button_down() -> void:
tween.stop(dialogue)
dialogue.visible_characters = dialogue.text.length()
index += 1
if index < loadedDialogue.size():
set_state(loadedDialogue[String(index)])
process_state(state)
else:
system.set_visible(false)
emit_signal("completed")

func start() -> void:
loadedDialogue = DialogueLoader.load_dialogue()
system.set_visible(true)
set_state(loadedDialogue[String(index)])
print(loadedDialogue[String(index)])
process_state(state)


Loading

0 comments on commit 2e779da

Please sign in to comment.