added a keyboard panel and a toggle button

This commit is contained in:
2026-06-10 04:39:23 -05:00
parent 625f1eb1f9
commit 6c38b05832
20 changed files with 826 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
extends StaticBody3D
var baseColor : Color
var pressedColor : Color
@onready var Animator = $Animator
var pressed : bool = false
var ButtonMaterial : StandardMaterial3D = StandardMaterial3D.new()
var isBeingHeld = false
func _initButton(BaseColor:Color,PressedColor:Color,char:String):
baseColor=BaseColor
pressedColor=PressedColor
ButtonMaterial.albedo_color = BaseColor
$Label3D.text = char
func _ready() -> void:
$MeshRoot.material_override = ButtonMaterial
ButtonMaterial.albedo_color = baseColor
Animator.get_animation("interact").loop_mode = Animation.LOOP_NONE
func press():
if !pressed:
$"..".buttonPressed.emit($Label3D.text)
$"..".buttonUpdated.emit()
Animator.play("interact")
ButtonMaterial.albedo_color = pressedColor
pressed = true
else:
$"..".buttonReleased.emit()
$"..".buttonUpdated.emit()
Animator.play_backwards("interact")
ButtonMaterial.albedo_color = baseColor
pressed = false
func release():
pass