Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
class_name ChampSequencePuzzle
extends SequencePuzzle

const CAMERA_MAX_OFFSET_Y: int = 475
const CAMERA_OFFSET_Y: int = 25
const CAMERA_TIMEOUT_INTERVAL: float = 0.03
const CAMERA_ZOOM_SCALAR: float = 0.005
const CHECKPOINT_POS: Vector2 = Vector2(1400,180)
const RESPAWN_DELAY: float = 1.5
const ROCK_WIDTH: int = 3
Expand All @@ -29,6 +25,7 @@ var solve_progress: int = 0
@onready var puzzle_steps: Node2D = $Steps

func _ready() -> void:
camera.global_position = player.global_position
sequences = puzzle_steps.get_children()
platforms = Array(long_rocks.get_children())
objs = Array(objects.get_children())
Expand Down Expand Up @@ -136,13 +133,8 @@ func _on_champ_long_rock_water_entered() -> void:
## Signal from hint sign to reset camera view and sequence
func _on_hint_sign_hint_sequence_finished() -> void:
await get_tree().create_timer(RESPAWN_DELAY).timeout
if _current_step == 1:
var goal: float = camera.offset.y + CAMERA_MAX_OFFSET_Y
while camera.offset.y < goal:
await get_tree().create_timer(CAMERA_TIMEOUT_INTERVAL).timeout
camera.offset.y = camera.offset.y + CAMERA_OFFSET_Y
camera.zoom.y = camera.zoom.y + CAMERA_ZOOM_SCALAR
camera.zoom.x = camera.zoom.x + CAMERA_ZOOM_SCALAR
camera.global_position = player.global_position
player._toggle_player_behavior(player.player_interaction, true)
reset_all()

## Function to rest all sequence objets after displaying via hint sequence
Expand All @@ -163,9 +155,10 @@ func reset_all() -> void:

## Function to move camera position so entire sequence is shown (for second sequence)
func _on_hint_sign_2_demonstrate_sequence() -> void:
var goal: float = camera.offset.y - CAMERA_MAX_OFFSET_Y
while camera.offset.y > goal:
await get_tree().create_timer(CAMERA_TIMEOUT_INTERVAL).timeout
camera.offset.y = camera.offset.y - CAMERA_OFFSET_Y
camera.zoom.y = camera.zoom.y - CAMERA_ZOOM_SCALAR
camera.zoom.x = camera.zoom.x - CAMERA_ZOOM_SCALAR
player._toggle_player_behavior(player.player_interaction, false)
camera.global_position = $Objects/Middle8.global_position


func _on_hint_sign_1_demonstrate_sequence() -> void:
player._toggle_player_behavior(player.player_interaction, false)
camera.global_position = $Objects/Middle3.global_position
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ sprite_frames = ExtResource("3_6wj4q")

[node name="Camera2D" type="Camera2D" parent="OnTheGround/Player" unique_id=1912677060]
position = Vector2(-526, -360)
anchor_mode = 0
position_smoothing_enabled = true

[node name="SequencePuzzle" type="Node2D" parent="OnTheGround" unique_id=414554150]
Expand Down Expand Up @@ -266,6 +265,7 @@ sprite_frames = ExtResource("20_ey61o")
[connection signal="water_entered" from="LongRocks/ChampLongRock10" to="OnTheGround/SequencePuzzle" method="_on_champ_long_rock_water_entered"]
[connection signal="solved" from="OnTheGround/SequencePuzzle" to="OnTheGround/CollectibleItem" method="reveal"]
[connection signal="step_solved" from="OnTheGround/SequencePuzzle" to="OnTheGround/SequencePuzzle" method="_on_step_solved"]
[connection signal="demonstrate_sequence" from="OnTheGround/SequencePuzzle/Signs/HintSign1" to="OnTheGround/SequencePuzzle" method="_on_hint_sign_1_demonstrate_sequence"]
[connection signal="hint_sequence_finished" from="OnTheGround/SequencePuzzle/Signs/HintSign1" to="OnTheGround/SequencePuzzle" method="_on_hint_sign_hint_sequence_finished"]
[connection signal="demonstrate_sequence" from="OnTheGround/SequencePuzzle/Signs/HintSign2" to="OnTheGround/SequencePuzzle" method="_on_hint_sign_2_demonstrate_sequence"]
[connection signal="hint_sequence_finished" from="OnTheGround/SequencePuzzle/Signs/HintSign2" to="OnTheGround/SequencePuzzle" method="_on_hint_sign_hint_sequence_finished"]