Initial scaffolding.

This commit is contained in:
Henry Faber 2026-06-23 18:19:28 +01:00
parent 8e821ead28
commit 1200ac7e32
8 changed files with 78 additions and 1 deletions

View file

@ -0,0 +1,6 @@
[gd_scene format=3 uid="uid://bq3xhbfgkt22l"]
[ext_resource type="Script" uid="uid://65d3hbrpm21x" path="res://scripts/effects_component.gd" id="1_ee0kt"]
[node name="EffectsComponent" type="Node2D" unique_id=1393438576]
script = ExtResource("1_ee0kt")

View file

@ -0,0 +1,27 @@
class_name FlashEffect
extends BaseEffect
@export var flash_color: Color = Color.WHITE
@export var flash_speed: float = 10.0
var _timer: float = 0.0
var _original_material: Material
func start(target: Node) -> void:
_timer = 0.0
if target is CanvasItem:
_original_material = target.material
# Apply a ShaderMaterial that handles the flash
var flash_material = ShaderMaterial.new()
flash_material.shader = preload("res://shaders/flash.gdshader")
target.material = flash_material
func process(delta: float, target: Node) -> void:
_timer += delta
if target.material is ShaderMaterial:
var intensity = (sin(_timer * flash_speed) + 1.0) / 2.0
target.material.set_shader_parameter("flash_intensity", intensity)
func stop(target: Node) -> void:
if target is CanvasItem:
target.material = _original_material

View file

@ -0,0 +1 @@
uid://deak7vcr7ss5l