Commit b884b530 authored by Julia Santos's avatar Julia Santos

Started adding text scrolling to dialogue

parent cba8049c
......@@ -81,9 +81,11 @@ func storeInt(selected): # specifically for using one item on another, stores mo
# override the following functions as needed when extending the script:
func mouseInteraction(): # just clicked on it with nothing
dialogueBox.text = flavorText
dialogueBox.playText()
func pickup(): # when it's picked up
dialogueBox.text = flavorText
dialogueBox.playText()
inventory.add_item(self.get_name(), texture)
queue_free()
inventory.unselect_all()
......
......@@ -259,13 +259,11 @@ retrievable = true
flavorText = "Good for holding my hair up or picking into small spaces."
[node name="Hitbox" type="CollisionShape2D" parent="Bobby pins"]
visible = false
position = Vector2( 6.81549, -18.2035 )
shape = SubResource( 8 )
disabled = true
[node name="Sprite" type="Sprite" parent="Bobby pins"]
position = Vector2( 62.0674, 20.4902 )
[node name="Sprite" type="Sprite" parent="Bobby pins/Hitbox"]
position = Vector2( 55.2519, 38.6937 )
scale = Vector2( 0.03, 0.03 )
texture = ExtResource( 15 )
......
[gd_scene load_steps=41 format=2]
[gd_scene load_steps=43 format=2]
[ext_resource path="res://Main rooms/Test room 1.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/Thesis Clickables/moxie1.png" type="Texture" id=2]
......@@ -34,6 +34,7 @@
[ext_resource path="res://Main rooms/Living room - Notepad.tscn" type="PackedScene" id=32]
[ext_resource path="res://Cutscenes/Cutscene 3.tscn" type="PackedScene" id=33]
[ext_resource path="res://assets/Thesis Clickables/to do list.png" type="Texture" id=34]
[ext_resource path="res://Scripts/Text Animator.gd" type="Script" id=35]
[sub_resource type="Animation" id=1]
resource_name = "Notepad open"
......@@ -59,10 +60,25 @@ bg_color = Color( 0.984314, 0.847059, 0.435294, 1 )
[sub_resource type="RectangleShape2D" id=4]
extents = Vector2( 143.453, 196.701 )
[sub_resource type="StyleBoxFlat" id=5]
bg_color = Color( 0.466667, 0.631373, 0.168627, 1 )
[sub_resource type="Animation" id=5]
resource_name = "Dialogue"
tracks/0/type = "value"
tracks/0/path = NodePath("RichTextLabel:percent_visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
[sub_resource type="StyleBoxFlat" id=6]
bg_color = Color( 0.466667, 0.631373, 0.168627, 1 )
[sub_resource type="StyleBoxFlat" id=7]
bg_color = Color( 0.145098, 0.145098, 0.164706, 1 )
[node name="Node2D" type="Node2D"]
......@@ -346,23 +362,28 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Text Animator" type="AnimationPlayer" parent="UI/Dialogue Box"]
anims/Dialogue = SubResource( 5 )
[node name="RichTextLabel" type="RichTextLabel" parent="UI/Dialogue Box"]
margin_left = 21.0
margin_top = 20.0
margin_right = 518.0
margin_bottom = 74.0
scroll_active = false
script = ExtResource( 35 )
__meta__ = {
"_edit_use_anchors_": false
}
textSpeed = "Medium"
[node name="Energy bar" type="ProgressBar" parent="UI"]
margin_left = -197.122
margin_top = -367.765
margin_right = 235.878
margin_bottom = -325.765
custom_styles/fg = SubResource( 5 )
custom_styles/bg = SubResource( 6 )
custom_styles/fg = SubResource( 6 )
custom_styles/bg = SubResource( 7 )
value = 50.0
percent_visible = false
__meta__ = {
......
......@@ -16,6 +16,7 @@ func pickup():
if (eventHandler.get_clothes() == 0):
inventory.add_item("Dirty clothes", load("res://.import/clothes pile.png-0e9642e1068a37424f7c246204716908.stex"))
dialogueBox.text = flavorText
dialogueBox.playText()
queue_free()
inventory.unselect_all()
emit_signal("retrieved")
extends RichTextLabel
onready var textLength = 0
onready var animationPlayer = get_parent().get_node("Text Animator")
onready var textAnimation = animationPlayer.get_animation("Dialogue")
export(String, "Slow", "Medium", "Fast") var textSpeed
# Called when the node enters the scene tree for the first time.
func _ready():
pass
func playText():
animationPlayer.stop()
textLength = text.length()
if textAnimation.track_get_key_count(0) == 2:
textAnimation.track_remove_key(0,1)
textAnimation.length = float(textLength)/float(checkSpeed(textSpeed))
textAnimation.track_insert_key(0, textAnimation.length, 1)
print("text: " + str(textLength) + ", animation length: " + str(textAnimation.length))
animationPlayer.play("Dialogue")
func checkSpeed(spd):
match spd:
"Slow":
return 80
"Medium":
return 100
"Fast":
return 150
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment