added freeze frame after death

This commit is contained in:
pennyrigate 2023-01-17 19:25:15 -05:00
parent 62c91bb21f
commit f4dda0ab1b
8 changed files with 53 additions and 5 deletions

View file

@ -120,6 +120,13 @@ func restart_level():
Game.ac_climb.stop() Game.ac_climb.stop()
Game.change_map(load(Game.get_map().filename)) Game.change_map(load(Game.get_map().filename))
#Freeze frame
func freeze_frame(time):
get_tree().paused = true
var timer = get_tree().create_timer(time, true)
timer.connect("timeout", get_tree(), "set_pause", [false])
return timer
func _process(delta): func _process(delta):
if Debug.entry == false: if Debug.entry == false:
#CRT FILTER #CRT FILTER

View file

@ -3,6 +3,7 @@
[ext_resource path="res://game.gd" type="Script" id=1] [ext_resource path="res://game.gd" type="Script" id=1]
[node name="Game" type="Node"] [node name="Game" type="Node"]
pause_mode = 2
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="CollecitbleSound" type="AudioStreamPlayer" parent="."] [node name="CollecitbleSound" type="AudioStreamPlayer" parent="."]

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/canopy.png-45821e386b9d22afb42cbd5bc48148fb.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://graphics/backgrounds/canopy.png"
dest_files=[ "res://.import/canopy.png-45821e386b9d22afb42cbd5bc48148fb.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -28,7 +28,7 @@
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 4, 96 ) extents = Vector2( 4, 96 )
[node name="Map" type="Node2D" groups=["map"]] [node name="Map2" type="Node2D" groups=["map"]]
pause_mode = 1 pause_mode = 1
script = ExtResource( 11 ) script = ExtResource( 11 )
save_location = 2 save_location = 2

View file

@ -18,6 +18,7 @@ save_location = 420
music = ExtResource( 12 ) music = ExtResource( 12 )
[node name="Camera2D" parent="." instance=ExtResource( 6 )] [node name="Camera2D" parent="." instance=ExtResource( 6 )]
current = false
[node name="Sprite" type="Sprite" parent="Camera2D"] [node name="Sprite" type="Sprite" parent="Camera2D"]
modulate = Color( 0.862745, 0.054902, 0.054902, 1 ) modulate = Color( 0.862745, 0.054902, 0.054902, 1 )

View file

@ -250,13 +250,16 @@ func die():
get_parent().add_child(new_particles) get_parent().add_child(new_particles)
new_particles.global_position = global_position new_particles.global_position = global_position
new_particles.emitting = true new_particles.emitting = true
position = Game.respawn_point sprite.visible = false
Game.lives -= 1
Game.play_sound(Game.a_die,Game.ac_die) Game.play_sound(Game.a_die,Game.ac_die)
yield(Game.freeze_frame(0.3), "timeout")
position = Game.respawn_point
sprite.visible = true
current_state = State.IDLE
Game.lives -= 1
if Game.lives < 0: if Game.lives < 0:
Game.call_deferred("restart_level") Game.call_deferred("restart_level")
func _on_AnimationPlayer_animation_finished(anim_name): func _on_AnimationPlayer_animation_finished(anim_name):
#Return to idle after slash #Return to idle after slash
if anim_name == "stab": if anim_name == "stab":

View file

@ -707,6 +707,7 @@ shape = SubResource( 34 )
disabled = true disabled = true
[node name="DeathSplatter" type="Particles2D" parent="."] [node name="DeathSplatter" type="Particles2D" parent="."]
pause_mode = 2
emitting = false emitting = false
amount = 16 amount = 16
lifetime = 0.3 lifetime = 0.3

View file

@ -53,7 +53,7 @@ func _physics_process(delta):
Game.change_map(load("res://maps/level_select.tscn")) Game.change_map(load("res://maps/level_select.tscn"))
#Debug 2 #Debug 2
if Input.is_action_just_pressed("debug_2"): if Input.is_action_just_pressed("debug_2"):
Engine.set_target_fps(1) Game.freeze_frame(1.0)
func print(text): func print(text):
lines += 1 lines += 1