Starting work on level transition fade.
This commit is contained in:
parent
28f8330282
commit
c51bca1775
4 changed files with 28 additions and 2 deletions
11
Scenes/fade.tscn
Normal file
11
Scenes/fade.tscn
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_scene format=3 uid="uid://ci0yqv1tna0ph"]
|
||||
|
||||
[node name="Fade" type="CanvasLayer"]
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(1, 1, 1, 0)
|
||||
|
|
@ -30,7 +30,16 @@ rect = Rect2(-8, -8, 16, 16)
|
|||
|
||||
[node name="Camera" type="Camera2D" parent="."]
|
||||
top_level = true
|
||||
zoom = Vector2(2.5, 2.5)
|
||||
script = ExtResource("4_vgqql")
|
||||
|
||||
[node name="Fade" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="Rectangle" type="ColorRect" parent="Fade"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(1, 1, 1, 0)
|
||||
|
||||
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"]
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ extends CharacterBody2D
|
|||
@onready var tile_layer : TileMapLayer = $"../TileMapLayer"
|
||||
@onready var level : Node2D = $".."
|
||||
@onready var particles : GPUParticles2D = $GPUParticles2D
|
||||
@onready var fade : ColorRect = $Fade/Rectangle
|
||||
|
||||
@export_category("Movement")
|
||||
@export var acceleration : float = 50
|
||||
|
|
@ -57,7 +58,7 @@ func tilemap_detection() -> void:
|
|||
#Checks for exits.
|
||||
var exit_data = tile_data.get_custom_data("exit")
|
||||
if exit_data == true:
|
||||
get_tree().change_scene_to_file(level.next_level) #Pulls next level data from parent Node2D.
|
||||
next_level(level.next_level) #Pulls next level data from parent Node2D.
|
||||
|
||||
func death(fallen: bool) -> void:
|
||||
dead = true
|
||||
|
|
@ -78,6 +79,10 @@ func respawn() -> void:
|
|||
position.x = level.startPosX
|
||||
position.y = level.startPosY
|
||||
|
||||
func next_level(level : String):
|
||||
dead == true
|
||||
get_tree().change_scene_to_file(level)
|
||||
|
||||
func _on_visible_on_screen_notifier_2d_screen_exited() -> void:
|
||||
if !dead:
|
||||
death(true)
|
||||
|
|
|
|||
|
|
@ -12,3 +12,4 @@ func _ready() -> void:
|
|||
func _physics_process(delta: float) -> void:
|
||||
position.x = lerp(position.x, player.position.x, camera_speed * delta)
|
||||
position.y = lerp(position.y, player.position.y, camera_speed * delta)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue