src / player / ghost_effect / ghost_effect.tscn

Diagram

Diagram

Assets

200

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

Table 1. Root properties
Name Value

scale

Vector2(6, 6)

script

Table 2. $Sprite2D properties
Name Value

unique_name_in_owner

true

modulate

Color(1, 1, 1, 0.392157)

material

SubResource("ShaderMaterial_7eytl")

texture

Player run
Figure 1. res://assets/images/player/Player_run.png

offset

Vector2(0, -12)

hframes

7

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()