34 lines
733 B
GDScript
34 lines
733 B
GDScript
extends Node
|
|
class_name CRT
|
|
|
|
@export var normal_filter: Control
|
|
@export var distortion_filter: Control
|
|
|
|
var clicksNeeded: int
|
|
var distortionEnabled: bool
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
normal_filter.visible = true
|
|
distortion_filter.visible = false
|
|
|
|
|
|
func _process(_delta):
|
|
if distortionEnabled and Input.is_action_just_pressed("BTN_6"):
|
|
clicksNeeded -= 1
|
|
if clicksNeeded <= 0:
|
|
disable_distortion()
|
|
|
|
|
|
func enable_distortion(clicks: int):
|
|
normal_filter.visible = false
|
|
distortion_filter.visible = true
|
|
clicksNeeded = clicks
|
|
distortionEnabled = true
|
|
|
|
|
|
func disable_distortion():
|
|
normal_filter.visible = true
|
|
distortion_filter.visible = false
|
|
distortionEnabled = false
|