Added underpinnings for advanced screen flash; tweaked default values
for existing screen flash.
This commit is contained in:
parent
20b657c7b1
commit
8679e817ee
5 changed files with 23 additions and 7 deletions
|
|
@ -62,7 +62,7 @@ func boss_horse():
|
||||||
if heart_taken == false:
|
if heart_taken == false:
|
||||||
print("Boss horse!")
|
print("Boss horse!")
|
||||||
await get_tree().create_timer(2).timeout
|
await get_tree().create_timer(2).timeout
|
||||||
EventBus.flash_screen.emit(.25)
|
EventBus.flash_screen.emit(.15)
|
||||||
$Heart.hide()
|
$Heart.hide()
|
||||||
$Heart.monitoring = false
|
$Heart.monitoring = false
|
||||||
$Sprite2D.frame = 7
|
$Sprite2D.frame = 7
|
||||||
|
|
@ -71,7 +71,7 @@ func boss_horse():
|
||||||
var horse_player = $Horse/AnimationPlayer
|
var horse_player = $Horse/AnimationPlayer
|
||||||
horse_player.play("run")
|
horse_player.play("run")
|
||||||
await get_tree().create_timer(10).timeout
|
await get_tree().create_timer(10).timeout
|
||||||
EventBus.flash_screen.emit(.25)
|
EventBus.flash_screen.emit(.15)
|
||||||
$Horse.hide()
|
$Horse.hide()
|
||||||
$Horse.end()
|
$Horse.end()
|
||||||
await get_tree().create_timer(5).timeout
|
await get_tree().create_timer(5).timeout
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ func _on_win_game(value: int):
|
||||||
start_button.show()
|
start_button.show()
|
||||||
|
|
||||||
|
|
||||||
func _on_flash_screen(duration: float):
|
func _on_flash_screen(duration: float = .25):
|
||||||
print("flash!")
|
print("flash!")
|
||||||
$CanvasLayer/ColorRect.visible = true
|
$CanvasLayer/ColorRect.visible = true
|
||||||
await get_tree().create_timer(duration).timeout
|
await get_tree().create_timer(duration).timeout
|
||||||
|
|
|
||||||
|
|
@ -53,11 +53,11 @@ func spawn_enemies():
|
||||||
enemy_count = rows_mod * cols_mod
|
enemy_count = rows_mod * cols_mod
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
|
|
||||||
if wave_count == 2 : #This if for Mirror
|
if wave_count == 2: #This if for Mirror
|
||||||
print("Enemy Wave: ", wave_count)
|
print("Enemy Wave: ", wave_count)
|
||||||
|
|
||||||
# Spawn Table
|
# Spawn Table
|
||||||
EventBus.flash_screen.emit(.25)
|
EventBus.flash_screen.emit(.15)
|
||||||
var t = TABLE.instantiate()
|
var t = TABLE.instantiate()
|
||||||
add_child(t)
|
add_child(t)
|
||||||
t.position = Vector2(screensize.x / 2, position.y + 125)
|
t.position = Vector2(screensize.x / 2, position.y + 125)
|
||||||
|
|
@ -67,7 +67,7 @@ func spawn_enemies():
|
||||||
ts.play()
|
ts.play()
|
||||||
ts = t.get_child(0)
|
ts = t.get_child(0)
|
||||||
ts.frame = 1
|
ts.frame = 1
|
||||||
EventBus.flash_screen.emit(.25)
|
EventBus.flash_screen.emit(.15)
|
||||||
await get_tree().create_timer(1.5).timeout
|
await get_tree().create_timer(1.5).timeout
|
||||||
|
|
||||||
# Spawn Mirror
|
# Spawn Mirror
|
||||||
|
|
@ -89,7 +89,7 @@ func spawn_enemies():
|
||||||
s.start_all_animations()
|
s.start_all_animations()
|
||||||
|
|
||||||
|
|
||||||
if wave_count == 3 : #This is for Boss
|
if wave_count == 3: #This is for Boss
|
||||||
|
|
||||||
# Hide the player
|
# Hide the player
|
||||||
|
|
||||||
|
|
|
||||||
15
shaders/flash_screen.gdshader
Normal file
15
shaders/flash_screen.gdshader
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
shader_type canvas_item;
|
||||||
|
|
||||||
|
uniform vec4 flash_color : source_color = vec4(1.0, 0.0, 0.0, 1.0);
|
||||||
|
uniform float intensity : hint_range(0.0, 1.0) = 0.0;
|
||||||
|
uniform float edge_power : hint_range(0.1, 4.0) = 2.5;
|
||||||
|
uniform float inner_ratio : hint_range(0.0, 1.0) = 0.75;
|
||||||
|
uniform float feather : hint_range(0.01, 1.0) = 0.4;
|
||||||
|
|
||||||
|
void fragment() {
|
||||||
|
vec2 uv = UV * 2.0 - 1.0;
|
||||||
|
float dist = length(uv);
|
||||||
|
float a = smoothstep(inner_ratio, inner_ratio + feather, dist);
|
||||||
|
a = pow(a, edge_power);
|
||||||
|
COLOR = vec4(flash_color.rgb, a * flash_color.a * intensity);
|
||||||
|
}
|
||||||
1
shaders/flash_screen.gdshader.uid
Normal file
1
shaders/flash_screen.gdshader.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://d1nem2giyx0sy
|
||||||
Loading…
Add table
Add a link
Reference in a new issue