You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			23 lines
		
	
	
		
			376 B
		
	
	
	
		
			GDScript
		
	
		
		
			
		
	
	
			23 lines
		
	
	
		
			376 B
		
	
	
	
		
			GDScript
		
	
| 
											2 years ago
										 | extends AnimatedSprite3D | ||
|  | class_name Afterimage | ||
|  | 
 | ||
|  | @export var duration_max:float = 0.2 | ||
|  | @export var is_moving:bool = true | ||
|  | 
 | ||
|  | var duration:float | ||
|  | var velocity:Vector3 | ||
|  | 
 | ||
|  | func _ready(): | ||
|  | 	duration = duration_max | ||
|  | 
 | ||
|  | func _process(delta): | ||
|  | 	if is_moving: | ||
|  | 		position += velocity*delta | ||
|  | 	 | ||
|  | 	var rate = duration / duration_max | ||
|  | 	modulate.a = rate | ||
|  | 	 | ||
|  | 	duration-=delta | ||
|  | 	if duration<=0: | ||
|  | 		queue_free() |