fix: tutorial spawn off-screen & anim, audio saving

This commit is contained in:
Jakob Feldmann 2023-09-06 13:47:32 +02:00
parent 15c98361c0
commit c614d27d80
18 changed files with 349 additions and 412 deletions

View File

@ -17,7 +17,7 @@ force/max_rate=false
force/max_rate_hz=44100 force/max_rate_hz=44100
edit/trim=false edit/trim=false
edit/normalize=true edit/normalize=true
edit/loop_mode=0 edit/loop_mode=2
edit/loop_begin=0 edit/loop_begin=0
edit/loop_end=-1 edit/loop_end=1505503
compress/mode=0 compress/mode=0

View File

@ -4385,7 +4385,7 @@ texture = SubResource( 62 )
offset = Vector2( 1, 0 ) offset = Vector2( 1, 0 )
hframes = 6 hframes = 6
vframes = 6 vframes = 6
frame = 7 frame = 8
__meta__ = { __meta__ = {
"_editor_description_": "YXNlcHJpdGVfd2l6YXJkX2NvbmZpZwpwbGF5ZXJ8PUJsb2JieVNwcml0ZS9CbG9iYnltYXRpb25QbGF5ZXIKc291cmNlfD1yZXM6Ly9hc3NldHMvYmxvYmJ5L2Jsb2JieS1zcHJpdGVzaGVldHQuYXNlcHJpdGUKbGF5ZXJ8PUJsb2JieQpvcF9leHB8PUZhbHNlCm9fZm9sZGVyfD0Kb19uYW1lfD0Kb25seV92aXNpYmxlfD1GYWxzZQpvX2V4X3B8PQo=" "_editor_description_": "YXNlcHJpdGVfd2l6YXJkX2NvbmZpZwpwbGF5ZXJ8PUJsb2JieVNwcml0ZS9CbG9iYnltYXRpb25QbGF5ZXIKc291cmNlfD1yZXM6Ly9hc3NldHMvYmxvYmJ5L2Jsb2JieS1zcHJpdGVzaGVldHQuYXNlcHJpdGUKbGF5ZXJ8PUJsb2JieQpvcF9leHB8PUZhbHNlCm9fZm9sZGVyfD0Kb19uYW1lfD0Kb25seV92aXNpYmxlfD1GYWxzZQpvX2V4X3B8PQo="
} }
@ -4572,5 +4572,5 @@ one_shot = true
[connection signal="got_grounded" from="BlobbyStateMachine" to="." method="_on_Blobby_got_grounded"] [connection signal="got_grounded" from="BlobbyStateMachine" to="." method="_on_Blobby_got_grounded"]
[connection signal="timeout" from="BlobbyStateMachine/JumpBufferTimer" to="BlobbyStateMachine" method="_on_JumpBufferTimer_timeout"] [connection signal="timeout" from="BlobbyStateMachine/JumpBufferTimer" to="BlobbyStateMachine" method="_on_JumpBufferTimer_timeout"]
[connection signal="timeout" from="InvincibilityTimer" to="." method="_on_InvincibilityTimer_timeout"] [connection signal="timeout" from="InvincibilityTimer" to="." method="_on_InvincibilityTimer_timeout"]
[connection signal="timeout" from="PitfallTimer" to="." method="die_for_real"]
[connection signal="timeout" from="PitfallTimer" to="." method="_on_PitfallTimer_timeout"] [connection signal="timeout" from="PitfallTimer" to="." method="_on_PitfallTimer_timeout"]
[connection signal="timeout" from="PitfallTimer" to="." method="die_for_real"]

View File

@ -180,7 +180,7 @@ initial_wait_time = 4.0
[node name="Button" parent="Tutorials/LeftTut" index="0"] [node name="Button" parent="Tutorials/LeftTut" index="0"]
material = SubResource( 12 ) material = SubResource( 12 )
[node name="AnimationPlayer" parent="Tutorials/LeftTut" index="5"] [node name="AnimationPlayer" parent="Tutorials/LeftTut" index="4"]
anims/RESET = SubResource( 7 ) anims/RESET = SubResource( 7 )
anims/cease_4_exist = SubResource( 8 ) anims/cease_4_exist = SubResource( 8 )
@ -196,7 +196,7 @@ initial_wait_time = 2.0
[node name="Button" parent="Tutorials/RightTut" index="0"] [node name="Button" parent="Tutorials/RightTut" index="0"]
material = SubResource( 13 ) material = SubResource( 13 )
[node name="AnimationPlayer" parent="Tutorials/RightTut" index="5"] [node name="AnimationPlayer" parent="Tutorials/RightTut" index="4"]
anims/RESET = SubResource( 9 ) anims/RESET = SubResource( 9 )
anims/cease_4_exist = SubResource( 10 ) anims/cease_4_exist = SubResource( 10 )
@ -213,7 +213,7 @@ position = Vector2( -70, 1 )
scale = Vector2( 0.878906, 0.936025 ) scale = Vector2( 0.878906, 0.936025 )
[node name="BlobbySprite" parent="Blobby" index="5"] [node name="BlobbySprite" parent="Blobby" index="5"]
frame = 8 frame = 6
[node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"] [node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"]
parameters/playback = SubResource( 14 ) parameters/playback = SubResource( 14 )

View File

@ -49,9 +49,6 @@ unique_name_in_owner = true
position = Vector2( 251, -24 ) position = Vector2( 251, -24 )
scale = Vector2( 0.878906, 0.936025 ) scale = Vector2( 0.878906, 0.936025 )
[node name="BlobbySprite" parent="Blobby" index="5"]
frame = 6
[node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"] [node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"]
parameters/playback = SubResource( 1 ) parameters/playback = SubResource( 1 )

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=26 format=2] [gd_scene load_steps=22 format=2]
[ext_resource path="res://src/BenefitialObjects/Coin.tscn" type="PackedScene" id=1] [ext_resource path="res://src/BenefitialObjects/Coin.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Actors/BlobbyCam.tscn" type="PackedScene" id=2] [ext_resource path="res://src/Actors/BlobbyCam.tscn" type="PackedScene" id=2]
@ -9,7 +9,6 @@
[ext_resource path="res://src/Levels/Templates/LevelTemplate.gd" type="Script" id=7] [ext_resource path="res://src/Levels/Templates/LevelTemplate.gd" type="Script" id=7]
[ext_resource path="res://src/Contraptions/Portal/Portal.tscn" type="PackedScene" id=8] [ext_resource path="res://src/Contraptions/Portal/Portal.tscn" type="PackedScene" id=8]
[ext_resource path="res://assets/sounds/AMBIENCE_SciFi_Large_Space_Hangar_Deep_Smooth_loop_stereo.wav" type="AudioStream" id=9] [ext_resource path="res://assets/sounds/AMBIENCE_SciFi_Large_Space_Hangar_Deep_Smooth_loop_stereo.wav" type="AudioStream" id=9]
[ext_resource path="res://src/Platforms/legacy/FlyingPlatformClean.tscn" type="PackedScene" id=10]
[ext_resource path="res://src/ObstacleObjects/Mine.tscn" type="PackedScene" id=11] [ext_resource path="res://src/ObstacleObjects/Mine.tscn" type="PackedScene" id=11]
[ext_resource path="res://src/Platforms/FlyingLaserCutter.tscn" type="PackedScene" id=12] [ext_resource path="res://src/Platforms/FlyingLaserCutter.tscn" type="PackedScene" id=12]
[ext_resource path="res://src/Platforms/legacy/DropThroughPlatform.tscn" type="PackedScene" id=13] [ext_resource path="res://src/Platforms/legacy/DropThroughPlatform.tscn" type="PackedScene" id=13]
@ -20,77 +19,10 @@
[ext_resource path="res://src/ObstacleObjects/Spikes.tscn" type="PackedScene" id=18] [ext_resource path="res://src/ObstacleObjects/Spikes.tscn" type="PackedScene" id=18]
[ext_resource path="res://src/BenefitialObjects/SavePoint.tscn" type="PackedScene" id=19] [ext_resource path="res://src/BenefitialObjects/SavePoint.tscn" type="PackedScene" id=19]
[ext_resource path="res://src/Environment/Legacy/Greenhouse.tscn" type="PackedScene" id=20] [ext_resource path="res://src/Environment/Legacy/Greenhouse.tscn" type="PackedScene" id=20]
[ext_resource path="res://src/Platforms/FlyingPlatformSmol.tscn" type="PackedScene" id=21]
[sub_resource type="AnimationNodeStateMachinePlayback" id=9] [sub_resource type="AnimationNodeStateMachinePlayback" id=9]
[sub_resource type="Animation" id=5]
resource_name = "Horizontal"
length = 6.0
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("KinematicBody2D:position")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 3 ),
"transitions": PoolRealArray( 1.33, 1.33 ),
"update": 0,
"values": [ Vector2( 0, 0 ), Vector2( -84, 0 ) ]
}
[sub_resource type="Animation" id=6]
resource_name = "Horizontal"
length = 6.0
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("KinematicBody2D:position")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 3 ),
"transitions": PoolRealArray( 1.33, 1.33 ),
"update": 0,
"values": [ Vector2( 0, 0 ), Vector2( 0, 48 ) ]
}
[sub_resource type="Animation" id=8]
resource_name = "Horizontal"
length = 6.0
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("KinematicBody2D:position")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 3 ),
"transitions": PoolRealArray( 1.33, 1.33 ),
"update": 0,
"values": [ Vector2( 0, 0 ), Vector2( 0, -48 ) ]
}
[sub_resource type="Animation" id=7]
resource_name = "Horizontal"
length = 6.0
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("KinematicBody2D:position")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 3 ),
"transitions": PoolRealArray( 1.33, 1.33 ),
"update": 0,
"values": [ Vector2( 0, 0 ), Vector2( -48, -24 ) ]
}
[node name="Actual Level 3" type="Node2D"] [node name="Actual Level 3" type="Node2D"]
script = ExtResource( 7 ) script = ExtResource( 7 )
__meta__ = { __meta__ = {
@ -114,17 +46,14 @@ unique_name_in_owner = true
drag_margin_top = 0.08 drag_margin_top = 0.08
drag_margin_bottom = 0.08 drag_margin_bottom = 0.08
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
frame = 8
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
frame = 1
[node name="Blobby" parent="." instance=ExtResource( 5 )] [node name="Blobby" parent="." instance=ExtResource( 5 )]
unique_name_in_owner = true unique_name_in_owner = true
position = Vector2( -168, 95 ) position = Vector2( -168, 95 )
scale = Vector2( 0.878906, 0.936025 ) scale = Vector2( 0.878906, 0.936025 )
[node name="BlobbySprite" parent="Blobby" index="5"]
frame = 6
[node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"] [node name="BlobbymationTree" parent="Blobby/BlobbySprite" index="0"]
parameters/playback = SubResource( 9 ) parameters/playback = SubResource( 9 )
@ -277,32 +206,30 @@ position = Vector2( 756, 660 )
[node name="Spikes17" parent="." instance=ExtResource( 18 )] [node name="Spikes17" parent="." instance=ExtResource( 18 )]
position = Vector2( 780, 660 ) position = Vector2( 780, 660 )
[node name="FlyingPlatformClean" parent="." instance=ExtResource( 10 )] [node name="FlyingPlatformSmol" parent="." instance=ExtResource( 21 )]
position = Vector2( 456, 600 ) position = Vector2( 456, 594 )
x_target = 84
speed = 24
[node name="FlyingPlatformClean2" parent="." instance=ExtResource( 10 )] [node name="FlyingPlatformSmol2" parent="." instance=ExtResource( 21 )]
position = Vector2( 720, 600 ) position = Vector2( 720, 594 )
x_target = -84
speed = 24
[node name="anim" parent="FlyingPlatformClean2" index="1"] [node name="FlyingPlatformSmol4" parent="." instance=ExtResource( 21 )]
anims/Horizontal = SubResource( 5 ) position = Vector2( 1080, 330 )
y_target = 48
speed = 24
[node name="FlyingPlatformClean3" parent="." instance=ExtResource( 10 )] [node name="FlyingPlatformSmol5" parent="." instance=ExtResource( 21 )]
position = Vector2( 1080, 336 ) position = Vector2( 984, 282 )
y_target = -48
speed = 24
[node name="anim" parent="FlyingPlatformClean3" index="1"] [node name="FlyingPlatformSmol3" parent="." instance=ExtResource( 21 )]
anims/Horizontal = SubResource( 6 ) position = Vector2( 1176, 432 )
y_target = -48
[node name="FlyingPlatformClean5" parent="." instance=ExtResource( 10 )] speed = 24
position = Vector2( 984, 288 )
[node name="anim" parent="FlyingPlatformClean5" index="1"]
anims/Horizontal = SubResource( 8 )
[node name="FlyingPlatformClean4" parent="." instance=ExtResource( 10 )]
position = Vector2( 1185, 456 )
[node name="anim" parent="FlyingPlatformClean4" index="1"]
anims/Horizontal = SubResource( 7 )
[node name="FlyingLaserCutter" parent="." instance=ExtResource( 12 )] [node name="FlyingLaserCutter" parent="." instance=ExtResource( 12 )]
position = Vector2( 924, 132 ) position = Vector2( 924, 132 )
@ -344,8 +271,3 @@ bus = "Music"
[editable path="BlobbyCam"] [editable path="BlobbyCam"]
[editable path="Blobby"] [editable path="Blobby"]
[editable path="TileMap"] [editable path="TileMap"]
[editable path="FlyingPlatformClean"]
[editable path="FlyingPlatformClean2"]
[editable path="FlyingPlatformClean3"]
[editable path="FlyingPlatformClean5"]
[editable path="FlyingPlatformClean4"]

View File

@ -88,7 +88,6 @@ theme = ExtResource( 2 )
script = ExtResource( 5 ) script = ExtResource( 5 )
[node name="ControlsMenu" type="Control" parent="."] [node name="ControlsMenu" type="Control" parent="."]
physics_interpolation_mode = 1
unique_name_in_owner = true unique_name_in_owner = true
visible = false visible = false
anchor_right = 1.0 anchor_right = 1.0
@ -450,7 +449,6 @@ text = "Quit Don't Save"
script = ExtResource( 23 ) script = ExtResource( 23 )
[node name="AudioMenu" type="Control" parent="."] [node name="AudioMenu" type="Control" parent="."]
physics_interpolation_mode = 1
visible = false visible = false
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
@ -685,7 +683,6 @@ text = "80"
align = 1 align = 1
[node name="PauseOverlay" type="TextureRect" parent="."] [node name="PauseOverlay" type="TextureRect" parent="."]
physics_interpolation_mode = 1
unique_name_in_owner = true unique_name_in_owner = true
visible = false visible = false
anchor_right = 1.0 anchor_right = 1.0
@ -792,6 +789,7 @@ volume_db = -10.0
[connection signal="button_up" from="ControlsMenu/ReallyQuitMenu/VBoxContainer/ContinueEdit" to="ControlsMenu/ReallyQuitMenu" method="close"] [connection signal="button_up" from="ControlsMenu/ReallyQuitMenu/VBoxContainer/ContinueEdit" to="ControlsMenu/ReallyQuitMenu" method="close"]
[connection signal="button_up" from="ControlsMenu/ReallyQuitMenu/VBoxContainer/QuitDontSave" to="ControlsMenu" method="close"] [connection signal="button_up" from="ControlsMenu/ReallyQuitMenu/VBoxContainer/QuitDontSave" to="ControlsMenu" method="close"]
[connection signal="button_up" from="AudioMenu/Panel/Back" to="." method="close_audio_menu"] [connection signal="button_up" from="AudioMenu/Panel/Back" to="." method="close_audio_menu"]
[connection signal="button_up" from="AudioMenu/Panel/Back" to="AudioMenu" method="save"]
[connection signal="button_up" from="PauseOverlay/Panel/VBoxContainer/Continue" to="PauseOverlay/Panel/VBoxContainer/Continue" method="_on_button_up"] [connection signal="button_up" from="PauseOverlay/Panel/VBoxContainer/Continue" to="PauseOverlay/Panel/VBoxContainer/Continue" method="_on_button_up"]
[connection signal="button_up" from="PauseOverlay/Panel/VBoxContainer/Controls" to="." method="_on_Controls_button_up"] [connection signal="button_up" from="PauseOverlay/Panel/VBoxContainer/Controls" to="." method="_on_Controls_button_up"]
[connection signal="button_up" from="PauseOverlay/Panel/VBoxContainer/Audio" to="." method="open_audio_menu"] [connection signal="button_up" from="PauseOverlay/Panel/VBoxContainer/Audio" to="." method="open_audio_menu"]

View File

@ -37,17 +37,17 @@ func _spawn_level_options(levels: Array):
check_box.focus_neighbour_left = $"%PlayButton".get_path() check_box.focus_neighbour_left = $"%PlayButton".get_path()
check_box.text = level.trim_suffix(".tscn") check_box.text = level.trim_suffix(".tscn")
check_box.set_button_group(BUTTON_GROUP) check_box.set_button_group(BUTTON_GROUP)
if first: if first || GlobalState.gsr.last_played_level.ends_with(level):
$"%PlayButton".focus_neighbour_right = check_box.get_path() $"%PlayButton".focus_neighbour_right = check_box.get_path()
$"%Controlls".focus_neighbour_right = check_box.get_path() $"%Controlls".focus_neighbour_right = check_box.get_path()
$"%Audio".focus_neighbour_right = check_box.get_path()
$"%QuitButton".focus_neighbour_right = check_box.get_path() $"%QuitButton".focus_neighbour_right = check_box.get_path()
check_box.pressed = true check_box.pressed = true
prev_checkbox = check_box
first = false first = false
else: yield(get_tree(), "idle_frame")
ensure_control_visible(check_box)
if prev_checkbox != null:
prev_checkbox.focus_neighbour_bottom = check_box.get_path() prev_checkbox.focus_neighbour_bottom = check_box.get_path()
check_box.focus_neighbour_top = prev_checkbox.get_path() check_box.focus_neighbour_top = prev_checkbox.get_path()
prev_checkbox = check_box prev_checkbox = check_box
if GlobalState.gsr.last_played_level.ends_with(level):
check_box.pressed = true
return return

View File

@ -31,8 +31,8 @@ func check_goal_state() -> void:
if press_limit == -1 : if press_limit == -1 :
# Should delete itself from the progress dictionary when destroyed # Should delete itself from the progress dictionary when destroyed
if visible: if visible:
$Label.visible = false $"%Label".visible = false
$Label2.visible = false $"%Label2".visible = false
$TextureRect.visible = false $TextureRect.visible = false
$TextureRect2.visible = false $TextureRect2.visible = false
$TextureRect3.visible = false $TextureRect3.visible = false
@ -53,7 +53,7 @@ func _ready() -> void:
timer.start() timer.start()
$Button1/ControllerButton.path = action1 $Button1/ControllerButton.path = action1
$Button2/ControllerButton.path = action2 $Button2/ControllerButton.path = action2
$Label.text = tutorial_text $"%Label".text = tutorial_text
button1.texture = $Button1/ControllerButton.icon button1.texture = $Button1/ControllerButton.icon
button1.scale.x = 0.5 button1.scale.x = 0.5
button1.scale.y = 0.5 button1.scale.y = 0.5
@ -72,9 +72,9 @@ func _physics_process(delta: float) -> void:
if(cam == null): if(cam == null):
cam = get_tree().root.get_child(4).get_node("%BlobbyCam") cam = get_tree().root.get_child(4).get_node("%BlobbyCam")
return return
if(moving == false): return
button1.texture = $Button1/ControllerButton.icon button1.texture = $Button1/ControllerButton.icon
button2.texture = $Button2/ControllerButton.icon button2.texture = $Button2/ControllerButton.icon
if(moving == false): return
# TODO process less in each frame # TODO process less in each frame
var up_left_pos = cam.get_global_transform().affine_inverse() * (position - tex_size * self.scale) var up_left_pos = cam.get_global_transform().affine_inverse() * (position - tex_size * self.scale)
var down_right_pos = cam.get_global_transform().affine_inverse() * (position + tex_size * self.scale) var down_right_pos = cam.get_global_transform().affine_inverse() * (position + tex_size * self.scale)
@ -99,7 +99,6 @@ func _on_Area_area_entered(area: Area2D) -> void:
print(d) print(d)
if(abs(d.y) > tex_size.y * 2 - 1): if(abs(d.y) > tex_size.y * 2 - 1):
velocity.y *= -1 velocity.y *= -1
pass
else: else:
velocity.x *=-1 velocity.x *=-1
@ -118,9 +117,17 @@ func start_tutorial():
velocity.x = velocity.x * sign(rng.randf_range(-1,1)) velocity.x = velocity.x * sign(rng.randf_range(-1,1))
velocity.y = velocity.y * sign(rng.randf_range(-1,1)) velocity.y = velocity.y * sign(rng.randf_range(-1,1))
tutorial_begun = true tutorial_begun = true
visible = true var timer = Timer.new()
add_child(timer)
timer.wait_time = 0.2
timer.one_shot = true
timer.connect("timeout", self, "enable_visibility")
timer.start()
moving = true moving = true
func enable_visibility() -> void:
visible = true
func _on_StartTutorialArea_area_entered(area: Area2D) -> void: func _on_StartTutorialArea_area_entered(area: Area2D) -> void:
tutorial_area_entered = true tutorial_area_entered = true
if(tutorial_begun || initial_wait_time > 0): return if(tutorial_begun || initial_wait_time > 0): return

View File

@ -77,6 +77,10 @@ fill = 1
fill_from = Vector2( 0.5, 0.5 ) fill_from = Vector2( 0.5, 0.5 )
fill_to = Vector2( 0.155994, 0.791965 ) fill_to = Vector2( 0.155994, 0.791965 )
[sub_resource type="DynamicFont" id=14]
size = 14
font_data = ExtResource( 2 )
[sub_resource type="Gradient" id=15] [sub_resource type="Gradient" id=15]
interpolation_mode = 2 interpolation_mode = 2
colors = PoolColorArray( 1, 1, 1, 1, 0, 0, 0, 0 ) colors = PoolColorArray( 1, 1, 1, 1, 0, 0, 0, 0 )
@ -90,10 +94,6 @@ fill = 1
fill_from = Vector2( 0.5, 0.5 ) fill_from = Vector2( 0.5, 0.5 )
fill_to = Vector2( 0.155994, 0.791965 ) fill_to = Vector2( 0.155994, 0.791965 )
[sub_resource type="DynamicFont" id=14]
size = 14
font_data = ExtResource( 2 )
[sub_resource type="RectangleShape2D" id=3] [sub_resource type="RectangleShape2D" id=3]
[sub_resource type="Animation" id=4] [sub_resource type="Animation" id=4]
@ -151,6 +151,10 @@ script = ExtResource( 1 )
goal_state = "running" goal_state = "running"
tutorial_text = "Press to run:" tutorial_text = "Press to run:"
[node name="VisibilityEnabler2D" type="VisibilityEnabler2D" parent="."]
position = Vector2( 3.00001, -7.5 )
scale = Vector2( 6.8, 3.85 )
[node name="Button1" type="Sprite" parent="."] [node name="Button1" type="Sprite" parent="."]
physics_interpolation_mode = 2 physics_interpolation_mode = 2
material = SubResource( 12 ) material = SubResource( 12 )
@ -188,6 +192,40 @@ margin_right = 250.0
margin_bottom = 125.0 margin_bottom = 125.0
texture = SubResource( 8 ) texture = SubResource( 8 )
[node name="Label" type="Label" parent="TextureRect"]
physics_interpolation_mode = 2
unique_name_in_owner = true
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -118.0
margin_top = -66.0
margin_right = 15.0
margin_bottom = 33.0
custom_fonts/font = ExtResource( 5 )
text = "This is a test
"
align = 1
uppercase = true
[node name="Label2" type="Label" parent="TextureRect"]
physics_interpolation_mode = 2
unique_name_in_owner = true
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -54.0
margin_top = -31.0
margin_right = -44.0
margin_bottom = -18.0
custom_fonts/font = SubResource( 14 )
text = "+"
align = 1
valign = 1
uppercase = true
[node name="TextureRect2" type="TextureRect" parent="."] [node name="TextureRect2" type="TextureRect" parent="."]
anchor_left = 0.5 anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
@ -210,40 +248,7 @@ margin_right = 80.0
margin_bottom = 50.0 margin_bottom = 50.0
texture = SubResource( 11 ) texture = SubResource( 11 )
[node name="Label" type="Label" parent="."]
physics_interpolation_mode = 2
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -68.0
margin_top = -41.0
margin_right = 65.0
margin_bottom = 58.0
custom_fonts/font = ExtResource( 5 )
text = "This is a test
"
align = 1
uppercase = true
[node name="Label2" type="Label" parent="."]
physics_interpolation_mode = 2
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -4.0
margin_top = -6.0
margin_right = 6.0
margin_bottom = 7.0
custom_fonts/font = SubResource( 14 )
text = "+"
align = 1
valign = 1
uppercase = true
[node name="Area" type="Area2D" parent="."] [node name="Area" type="Area2D" parent="."]
visible = false
collision_layer = 512 collision_layer = 512
collision_mask = 512 collision_mask = 512

View File

@ -22,7 +22,7 @@ func _unhandled_input(event: InputEvent) -> void:
press_limit -= 1 press_limit -= 1
if press_limit == 0: if press_limit == 0:
if visible: if visible:
$Label.visible = false $"%Label".visible = false
$TextureRect.visible = false $TextureRect.visible = false
$TextureRect2.visible = false $TextureRect2.visible = false
$AudioStreamPlayer.play() $AudioStreamPlayer.play()
@ -43,7 +43,7 @@ func _ready() -> void:
timer.connect("timeout", self, "finished_waiting") timer.connect("timeout", self, "finished_waiting")
timer.start() timer.start()
$Button/ControllerButton.path = action $Button/ControllerButton.path = action
$Label.text = tutorial_text $"%Label".text = tutorial_text
button.texture = $Button/ControllerButton.icon button.texture = $Button/ControllerButton.icon
button.scale.x = 0.5 button.scale.x = 0.5
button.scale.y = 0.5 button.scale.y = 0.5
@ -65,13 +65,14 @@ func _physics_process(_delta: float) -> void:
cam = get_tree().root.get_child(4).get_node("%BlobbyCam") cam = get_tree().root.get_child(4).get_node("%BlobbyCam")
return return
if button.texture != $Button/ControllerButton.icon:
button.texture = $Button/ControllerButton.icon
# TODO process less in each frame # TODO process less in each frame
if moving == false: if moving == false:
return return
# TODO process less in each frame # TODO process less in each frame
button.texture = $Button/ControllerButton.icon
# TODO process less in each frame
var up_left_pos = ( var up_left_pos = (
cam.get_global_transform().affine_inverse() cam.get_global_transform().affine_inverse()
* (position - tex_size * self.scale) * (position - tex_size * self.scale)
@ -89,8 +90,7 @@ func _physics_process(_delta: float) -> void:
velocity.y = abs(velocity.y) velocity.y = abs(velocity.y)
elif down_right_pos.y >= cam.screen_bottom.y: elif down_right_pos.y >= cam.screen_bottom.y:
velocity.y = -abs(velocity.y) velocity.y = -abs(velocity.y)
self.position += velocity position += velocity
func _on_Area_area_entered(area: Area2D) -> void: func _on_Area_area_entered(area: Area2D) -> void:
if !area.get_parent().visible: if !area.get_parent().visible:
@ -112,17 +112,26 @@ func _lesson_learned(animation_name: String) -> void:
queue_free() queue_free()
func start_tutorial(): func start_tutorial() -> void:
var rng = RandomNumberGenerator.new() var rng = RandomNumberGenerator.new()
rng.randomize() rng.randomize()
position.x += rng.randf_range(-50, 50) position.x += rng.randf_range(-50, 50)
position.y += rng.randf_range(-50, 50) position.y += rng.randf_range(-50, 50)
position = cam.get_global_transform() * position
print(position)
velocity.x = velocity.x * sign(rng.randf_range(-1, 1)) velocity.x = velocity.x * sign(rng.randf_range(-1, 1))
velocity.y = velocity.y * sign(rng.randf_range(-1, 1)) velocity.y = velocity.y * sign(rng.randf_range(-1, 1))
tutorial_begun = true tutorial_begun = true
visible = true var timer = Timer.new()
add_child(timer)
timer.wait_time = 0.2
timer.one_shot = true
timer.connect("timeout", self, "enable_visibility")
timer.start()
moving = true moving = true
func enable_visibility() -> void:
visible = true
func _on_StartTutorialArea_area_entered(_area: Area2D) -> void: func _on_StartTutorialArea_area_entered(_area: Area2D) -> void:
tutorial_area_entered = true tutorial_area_entered = true

View File

@ -1,9 +1,8 @@
[gd_scene load_steps=18 format=2] [gd_scene load_steps=17 format=2]
[ext_resource path="res://assets/sounds/vibing.wav" type="AudioStream" id=1] [ext_resource path="res://assets/sounds/vibing.wav" type="AudioStream" id=1]
[ext_resource path="res://src/UserInterface/TutorialThingy.gd" type="Script" id=2] [ext_resource path="res://src/UserInterface/TutorialThingy.gd" type="Script" id=2]
[ext_resource path="res://addons/controller_icons/objects/Button.gd" type="Script" id=3] [ext_resource path="res://addons/controller_icons/objects/Button.gd" type="Script" id=3]
[ext_resource path="res://assets/environment/decor/screen/Screen3.png" type="Texture" id=4]
[ext_resource path="res://assets/ui/fonts/kenny_thick.tres" type="DynamicFont" id=5] [ext_resource path="res://assets/ui/fonts/kenny_thick.tres" type="DynamicFont" id=5]
[ext_resource path="res://addons/controller_icons/assets/ps4/cross.png" type="Texture" id=6] [ext_resource path="res://addons/controller_icons/assets/ps4/cross.png" type="Texture" id=6]
[ext_resource path="res://assets/effects/noise.png" type="Texture" id=8] [ext_resource path="res://assets/effects/noise.png" type="Texture" id=8]
@ -140,7 +139,7 @@ tracks/1/keys = {
extents = Vector2( 62, 71 ) extents = Vector2( 62, 71 )
[node name="TutorialThingy" type="Node2D"] [node name="TutorialThingy" type="Node2D"]
physics_interpolation_mode = 2 physics_interpolation_mode = 1
visible = false visible = false
z_index = 10 z_index = 10
script = ExtResource( 2 ) script = ExtResource( 2 )
@ -170,6 +169,25 @@ margin_right = 250.0
margin_bottom = 125.0 margin_bottom = 125.0
texture = SubResource( 8 ) texture = SubResource( 8 )
[node name="Label" type="Label" parent="TextureRect"]
physics_interpolation_mode = 2
unique_name_in_owner = true
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -118.0
margin_top = -66.0
margin_right = 15.0
margin_bottom = 33.0
grow_horizontal = 2
grow_vertical = 2
custom_fonts/font = ExtResource( 5 )
text = "This is a test
"
align = 1
uppercase = true
[node name="TextureRect2" type="TextureRect" parent="."] [node name="TextureRect2" type="TextureRect" parent="."]
anchor_left = 0.5 anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
@ -181,24 +199,7 @@ margin_right = 50.0
margin_bottom = 50.0 margin_bottom = 50.0
texture = SubResource( 11 ) texture = SubResource( 11 )
[node name="Label" type="Label" parent="."]
physics_interpolation_mode = 2
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -68.0
margin_top = -41.0
margin_right = 65.0
margin_bottom = 58.0
custom_fonts/font = ExtResource( 5 )
text = "This is a test
"
align = 1
uppercase = true
[node name="Area" type="Area2D" parent="."] [node name="Area" type="Area2D" parent="."]
visible = false
collision_layer = 512 collision_layer = 512
collision_mask = 512 collision_mask = 512
@ -209,10 +210,6 @@ shape = SubResource( 3 )
anims/RESET = SubResource( 4 ) anims/RESET = SubResource( 4 )
anims/cease_4_exist = SubResource( 5 ) anims/cease_4_exist = SubResource( 5 )
[node name="Sprite" type="Sprite" parent="."]
visible = false
texture = ExtResource( 4 )
[node name="StartTutorialArea" type="Area2D" parent="."] [node name="StartTutorialArea" type="Area2D" parent="."]
collision_layer = 0 collision_layer = 0
monitorable = false monitorable = false
@ -225,6 +222,8 @@ stream = ExtResource( 1 )
volume_db = -17.477 volume_db = -17.477
bus = "UI" bus = "UI"
[node name="Sprite" type="Sprite" parent="."]
[connection signal="area_entered" from="Area" to="." method="_on_Area_area_entered"] [connection signal="area_entered" from="Area" to="." method="_on_Area_area_entered"]
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_lesson_learned"] [connection signal="animation_finished" from="AnimationPlayer" to="." method="_lesson_learned"]
[connection signal="area_entered" from="StartTutorialArea" to="." method="_on_StartTutorialArea_area_entered"] [connection signal="area_entered" from="StartTutorialArea" to="." method="_on_StartTutorialArea_area_entered"]