Compare commits

...

2 Commits

3 changed files with 24 additions and 25 deletions

View File

@ -19,14 +19,14 @@ var max_lines: float = 0
set(value):
progress = value
if is_node_ready() and not all_text_revealed:
var start_index = 0
var start_index := 0
if progress >= substring_sizes.size() or progress < 0:
label.visible_ratio = 1
elif progress > 0:
for i in range(min(progress, substring_sizes.size()-1) as int) if progress > 0 else range(substring_sizes.size()-1):
start_index += substring_sizes[i]
label.visible_characters = start_index + substring_sizes[min(progress as int, substring_sizes.size()-1)] * fmod(progress, 1)
label.visible_characters = start_index + int(substring_sizes[min(progress as int, substring_sizes.size()-1)] * fmod(progress, 1))
else:
label.visible_ratio = 0
@ -94,14 +94,14 @@ func _rebuild():
max_lines = float(label.get_line_count())
func try_scroll():
var forward_target: int
var forward_target: float
#print_debug( "max lines: " + str(max_lines))
#print_debug( "current lines: " + str(label.get_character_line(label.visible_characters)))
#print( "max lines: " + str(max_lines))
#print( "current lines: " + str(label.get_character_line(label.visible_characters)))
var visible_ratio: float = float(label.get_character_line(label.visible_characters)) / max_lines
#print_debug("Tried scrolling with ratio of %f. Comparing %f against %f" % [visible_ratio, label.size.y * visible_ratio - scroll_container.scroll_vertical, scroll_container.size.y * 0.9])
#print("Tried scrolling with ratio of %f. Comparing %f against %f" % [visible_ratio, label.size.y * visible_ratio - scroll_container.scroll_vertical, scroll_container.size.y * 0.9])
if label.size.y * visible_ratio + scroll_container.scroll_vertical > scroll_container.size.y * 0.9:
if scroll_container.scroll_vertical + scroll_container.size.y * 0.9 < label.size.y:
@ -109,7 +109,7 @@ func try_scroll():
else:
forward_target = label.size.y - scroll_container.size.y
if scroll_target != null:
var tween: Tween = get_tree().create_tween()
#var tween: Tween = get_tree().create_tween()
##tween.set_trans()
scroll_target = forward_target
@ -150,18 +150,18 @@ func play_scene():
finished.emit()
func _unhandled_input(event: InputEvent) -> void:
var just_revealed_text = false
var just_revealed_text := false
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
scroll_target += 40
if not all_text_revealed: just_revealed_text
all_text_revealed = true
if not all_text_revealed:
just_revealed_text = true
if event.button_index == MOUSE_BUTTON_WHEEL_UP:
scroll_target -= 40
if not all_text_revealed: just_revealed_text
if not all_text_revealed:
just_revealed_text = true
if just_revealed_text and animation_complete:
all_text_revealed = true
if just_revealed_text:
if animation_complete: all_text_revealed = true
var scroll_target: float = 0:
set(value):
@ -170,7 +170,7 @@ func _process(delta: float) -> void:
# FIXME: maybe change this to has stage?
if visible and not Engine.is_editor_hint():
if scroll_container.scroll_vertical != scroll_target:
scroll_container.scroll_vertical += (scroll_target-scroll_container.scroll_vertical)*delta*6
scroll_container.scroll_vertical += int((scroll_target-scroll_container.scroll_vertical)*delta*6)
var intro_triggered:= false
func trigger_intro():

View File

@ -1,8 +1,7 @@
[gd_scene load_steps=137 format=4 uid="uid://b3b0gyvklqn50"]
[gd_scene load_steps=136 format=4 uid="uid://b3b0gyvklqn50"]
[ext_resource type="Script" uid="uid://belkrno67sft0" path="youth_room.gd" id="1_aitp0"]
[ext_resource type="Script" uid="uid://bsop46tqngddc" path="res://base-environments/youth_room/youth_room.gd" id="1_aitp0"]
[ext_resource type="AudioStream" uid="uid://1h6k2d8q1kw3" path="res://base-environments/youth_room/import/sounds/rain_on_window.mp3" id="2_3haaq"]
[ext_resource type="Resource" uid="uid://bgplfqxa852wo" path="res://dev-util/debug_save.tres" id="2_h6j14"]
[ext_resource type="PackedScene" uid="uid://mkccbig41bqb" path="res://logic-scenes/player_controller/player_controller.tscn" id="3_foj4y"]
[ext_resource type="AudioStream" uid="uid://bbpo1hu35yer8" path="res://base-environments/youth_room/import/sounds/thunder.mp3" id="3_wcypa"]
[ext_resource type="Script" uid="uid://c281w7earok6w" path="res://base-environments/youth_room/crouch_volume.gd" id="3_x3dlb"]
@ -1736,7 +1735,7 @@ func _ready():
camera = get_tree().root.get_viewport().get_camera_3d()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
func _process(_delta):
self.global_transform = camera.global_transform
"
@ -1758,7 +1757,6 @@ func hide():
[node name="youth room" type="Node3D" groups=["serializable"]]
process_mode = 1
script = ExtResource("1_aitp0")
save_game = ExtResource("2_h6j14")
[node name="logic" type="Node3D" parent="."]

View File

@ -266,9 +266,10 @@ func _input(event:InputEvent):
else:
crouch_toggled = true
func play_scene(id: int, _repeat):
if id == Scenes.id.YOUTH_DRAEVEN:
var rotation_tween = create_tween()
func play_scene(_id: int, _repeat: bool):
pass
#if id == Scenes.id.YOUTH_DRAEVEN:
# var rotation_tween := create_tween()
func scene_finished(_id, repeat: bool):
if repeat: