Add ice effect component to enemies and adjust collapsing bridge collapse time
This commit is contained in:
@@ -40,9 +40,8 @@ to_collapse_timer = NodePath("../ToCollapseTimer")
|
||||
reset_timer = NodePath("../ResetTimer")
|
||||
sprite2d = NodePath("../Sprite2D")
|
||||
collision_shape = NodePath("../CollisionShape2D")
|
||||
collapse_time = 2.0
|
||||
collapse_time = 0.75
|
||||
reset_time = 3.0
|
||||
anim_time = 0.5
|
||||
|
||||
[connection signal="body_entered" from="Collapsable detector" to="CollapsableComponent" method="_on_collapsable_detector_body_entered"]
|
||||
[connection signal="body_exited" from="Collapsable detector" to="CollapsableComponent" method="_on_collapsable_detector_body_exited"]
|
||||
|
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=19 format=3 uid="uid://bwdlmualj6xbw"]
|
||||
[gd_scene load_steps=20 format=3 uid="uid://bwdlmualj6xbw"]
|
||||
|
||||
[ext_resource type="Shader" uid="uid://bs4xvm4qkurpr" path="res://shaders/hit_flash.tres" id="1_ep4yr"]
|
||||
[ext_resource type="Texture2D" uid="uid://cu72810eyk4dx" path="res://sprites/enemy-robot.png" id="2_hjtwe"]
|
||||
@@ -15,6 +15,7 @@
|
||||
[ext_resource type="AudioStream" uid="uid://b3tsqhr06pbrs" path="res://sfx/enemy_hurt.wav" id="13_u4k3d"]
|
||||
[ext_resource type="AudioStream" uid="uid://dyev46uqusimi" path="res://sfx/shoot.wav" id="14_tdjks"]
|
||||
[ext_resource type="PackedScene" uid="uid://dx80ivlvuuew4" path="res://objects/fire_fx.tscn" id="15_mc6rj"]
|
||||
[ext_resource type="PackedScene" uid="uid://ck6nml06tm6ue" path="res://objects/ice_fx.tscn" id="16_68hnm"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pwwji"]
|
||||
size = Vector2(25, 31)
|
||||
@@ -123,10 +124,11 @@ status_effect_component = NodePath("../StatusEffectComponent")
|
||||
root = NodePath("..")
|
||||
fire_fx = NodePath("../FireFX")
|
||||
|
||||
[node name="IceEffectComponent" type="Node" parent="." node_paths=PackedStringArray("status_effect_component")]
|
||||
[node name="IceEffectComponent" type="Node" parent="." node_paths=PackedStringArray("status_effect_component", "ice_fx")]
|
||||
script = ExtResource("11_pq0k7")
|
||||
components_to_disable = [NodePath("../SideToSideMovement"), NodePath("../PeriodicShootingComponent"), NodePath("../DamageComponent")]
|
||||
status_effect_component = NodePath("../StatusEffectComponent")
|
||||
ice_fx = NodePath("../Ice FX")
|
||||
|
||||
[node name="sfx_hurt" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("13_u4k3d")
|
||||
@@ -138,3 +140,6 @@ stream = ExtResource("14_tdjks")
|
||||
position = Vector2(0, 9)
|
||||
emitting = false
|
||||
amount = 2048
|
||||
|
||||
[node name="Ice FX" parent="." instance=ExtResource("16_68hnm")]
|
||||
visible = false
|
||||
|
22
objects/ice_fx.tscn
Normal file
22
objects/ice_fx.tscn
Normal file
@@ -0,0 +1,22 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://ck6nml06tm6ue"]
|
||||
|
||||
[ext_resource type="Material" uid="uid://d1m2qrclercr" path="res://shaders/shine_shader.tres" id="2_t41v2"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_yh4st"]
|
||||
offsets = PackedFloat32Array(0, 0.461783, 0.993631)
|
||||
colors = PackedColorArray(0.380392, 0.827451, 0.890196, 0.501961, 0.188235, 0.317647, 0.509804, 0.501961, 0.380392, 0.827451, 0.890196, 0.501961)
|
||||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_of20b"]
|
||||
gradient = SubResource("Gradient_yh4st")
|
||||
width = 16
|
||||
height = 16
|
||||
|
||||
[node name="Ice FX" type="Node2D"]
|
||||
|
||||
[node name="Ice" type="Sprite2D" parent="."]
|
||||
modulate = Color(1, 1, 1, 0.392157)
|
||||
self_modulate = Color(1, 1, 1, 0.556863)
|
||||
material = ExtResource("2_t41v2")
|
||||
position = Vector2(-1.25, 0.75)
|
||||
scale = Vector2(1.96875, 1.96875)
|
||||
texture = SubResource("GradientTexture2D_of20b")
|
@@ -3,6 +3,7 @@ extends Node
|
||||
|
||||
@export var components_to_disable: Array = []
|
||||
@export var status_effect_component: StatusEffectComponent
|
||||
@export var ice_fx: Node2D
|
||||
|
||||
var data: StatusEffectDataResource = null
|
||||
var ice_effects_applied: int = 0
|
||||
@@ -35,6 +36,9 @@ func on_effect_removed(effect_type: StatusEffectComponent.EffectType) -> void:
|
||||
|
||||
|
||||
func apply_freeze() -> void:
|
||||
if ice_fx:
|
||||
ice_fx.visible = true
|
||||
|
||||
for component_path in components_to_disable:
|
||||
var component: Node = get_node_or_null(component_path)
|
||||
if not component or ice_effects_applied == 0:
|
||||
@@ -44,9 +48,15 @@ func apply_freeze() -> void:
|
||||
|
||||
|
||||
func remove_freeze() -> void:
|
||||
if ice_effects_applied > 0:
|
||||
return
|
||||
|
||||
if ice_fx:
|
||||
ice_fx.visible = false
|
||||
|
||||
for component_path in components_to_disable:
|
||||
var component: Node = get_node_or_null(component_path)
|
||||
if not component or ice_effects_applied > 0:
|
||||
if not component:
|
||||
continue
|
||||
|
||||
component.process_mode = PROCESS_MODE_ALWAYS
|
21
shaders/shine_shader.gdshader
Normal file
21
shaders/shine_shader.gdshader
Normal file
@@ -0,0 +1,21 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform vec4 shine_color : source_color = vec4(1.0);
|
||||
uniform float shine_speed : hint_range(-10.0, 10.0, 0.1) = 1.0;
|
||||
uniform float shine_size : hint_range(0.001, 1.0, 0.01) = 0.01;
|
||||
uniform float shine_frequency: hint_range(1.0, 45.0, 0.5) = 5.0;
|
||||
uniform float shine_angle_deg : hint_range(-360.0, 360.0, 1.0) = 45.0;
|
||||
|
||||
void fragment() {
|
||||
COLOR = texture(TEXTURE, UV);
|
||||
// Convert degrees to radians
|
||||
float angle_rad = radians(shine_angle_deg);
|
||||
|
||||
// Calculate direction vector for the shine line
|
||||
vec2 shine_dir = vec2(cos(angle_rad), sin(angle_rad));
|
||||
|
||||
// Project UV onto shine direction
|
||||
float projection = dot(UV, shine_dir);
|
||||
float shine = step(1.0 - shine_size * 0.5, 0.5 + 0.5 * sin(projection + TIME * shine_speed * shine_frequency));
|
||||
COLOR.rgb = mix(COLOR.rgb, shine_color.rgb, shine * shine_color.a);
|
||||
}
|
11
shaders/shine_shader.tres
Normal file
11
shaders/shine_shader.tres
Normal file
@@ -0,0 +1,11 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://d1m2qrclercr"]
|
||||
|
||||
[ext_resource type="Shader" path="res://shaders/shine_shader.gdshader" id="1_a47lf"]
|
||||
|
||||
[resource]
|
||||
shader = ExtResource("1_a47lf")
|
||||
shader_parameter/shine_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/shine_speed = -1.0
|
||||
shader_parameter/shine_size = 0.011
|
||||
shader_parameter/shine_frequency = 3.0
|
||||
shader_parameter/shine_angle_deg = 45.0
|
BIN
sprites/ice.png
Normal file
BIN
sprites/ice.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 195 B |
34
sprites/ice.png.import
Normal file
34
sprites/ice.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cfx1se2ffypeh"
|
||||
path="res://.godot/imported/ice.png-0c1ed6b8c4de11f3b863ad9105ae6ec3.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://sprites/ice.png"
|
||||
dest_files=["res://.godot/imported/ice.png-0c1ed6b8c4de11f3b863ad9105ae6ec3.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
Reference in New Issue
Block a user