online multiplayer chess game (note server currently down)
Diffstat (limited to 'ui/barbutton/BarTextureButton.gd')
| -rw-r--r-- | ui/barbutton/BarTextureButton.gd | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ui/barbutton/BarTextureButton.gd b/ui/barbutton/BarTextureButton.gd index 3a7e488..579d4b1 100644 --- a/ui/barbutton/BarTextureButton.gd +++ b/ui/barbutton/BarTextureButton.gd @@ -1,7 +1,7 @@ extends TextureButton class_name BarTextureButton -var focused: bool +var focused: bool setget _focused export(Color) var normal_color := Color.black export(Color) var highlight_color := Color(0.670588, 0.352941, 0.352941) @@ -10,9 +10,12 @@ export(Color) var disabled_color := Color(0.501961, 0.501961, 0.501961) onready var background := $Background +var n := 0 + func _ready() -> void: _focused(false) + n = round(rand_range(10, 20)) func set_disabled(new: bool) -> void: @@ -21,8 +24,9 @@ func set_disabled(new: bool) -> void: mouse_default_cursor_shape = CURSOR_FORBIDDEN if disabled else CURSOR_POINTING_HAND -func _input(_event: InputEvent): - _update() +func _process(_delta): + if visible and Engine.get_idle_frames() % n == 0: + _update() func _update(): |