Add tooltip component and integrate it into the scene; adjust audio volume for coin sound effect
This commit is contained in:
42
scripts/components/tooltip_component.gd
Normal file
42
scripts/components/tooltip_component.gd
Normal file
@@ -0,0 +1,42 @@
|
||||
class_name TooltipComponent
|
||||
extends Node
|
||||
|
||||
@export var area2d: Area2D
|
||||
@export var ui_root: Control
|
||||
@export var text: String = ""
|
||||
@export var tooltip_label: Label
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if not area2d:
|
||||
printerr("Tooltip node missing Area2D child.")
|
||||
return
|
||||
|
||||
if not ui_root:
|
||||
printerr("Tooltip node missing UI root child.")
|
||||
return
|
||||
|
||||
if not tooltip_label:
|
||||
printerr("Tooltip node missing tooltip label child.")
|
||||
return
|
||||
|
||||
tooltip_label.text = text
|
||||
ui_root.visible = false
|
||||
area2d.body_entered.connect(_on_area2d_body_entered)
|
||||
area2d.body_exited.connect(_on_area2d_body_exited)
|
||||
|
||||
|
||||
func show_tooltip() -> void:
|
||||
ui_root.visible = true
|
||||
|
||||
|
||||
func hide_tooltip() -> void:
|
||||
ui_root.visible = false
|
||||
|
||||
|
||||
func _on_area2d_body_entered(_body: Node) -> void:
|
||||
show_tooltip()
|
||||
|
||||
|
||||
func _on_area2d_body_exited(_body: Node) -> void:
|
||||
hide_tooltip()
|
13
scripts/steam_integration.gd
Normal file
13
scripts/steam_integration.gd
Normal file
@@ -0,0 +1,13 @@
|
||||
class_name SteamIntegration
|
||||
extends Node
|
||||
|
||||
var app_id: String = "3575090"
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
OS.set_environment("STEAM_APP_ID", app_id)
|
||||
OS.set_environment("STEAM_GAME_ID", app_id)
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
Reference in New Issue
Block a user