Table of Contents
src / player / ghost_effect / ghost_effect.tscn
Diagram
Overridden virtual functions
_process
func _process(delta: float) -> void:
rest_time -= delta
modulate.a -= delta / ALIVE_TIME
if rest_time < 0: queue_free()
Instantiators
|
Caution
|
No other scene instantiate this scene. |
Scene Tree
-
GhostEffect Node2D
-
Sprite2D Sprite2D
-
Signal Connections
|
Note
|
No signal connections. |
Properties
| Name | Value |
|---|---|
scale |
|
script |
| Name | Value |
|---|---|
unique_name_in_owner |
|
modulate |
|
material |
|
texture |
|
offset |
|
hframes |
|
ghost_effect.gd
extends Node2D
const ALIVE_TIME = 0.5
var rest_time := ALIVE_TIME
func spawn(player: Player) -> void:
position = player.position
var sprite = player.current_sprite_state().duplicate()
%Sprite2D.texture = sprite.texture
%Sprite2D.hframes = sprite.hframes
%Sprite2D.frame = sprite.frame
%Sprite2D.flip_h = sprite.flip_h
%Sprite2D.flip_v = sprite.flip_v
player.get_parent().add_child(self)
func _process(delta: float) -> void:
rest_time -= delta
modulate.a -= delta / ALIVE_TIME
if rest_time < 0: queue_free()
