add kickable tooltips
This commit is contained in:
@@ -22,6 +22,7 @@ var damage_modifier: float = 0.9
|
||||
|
||||
@onready var mesh_node: MeshInstance3D = $IronMesh
|
||||
var iron_mat: StandardMaterial3D
|
||||
var _tooltip: Label3D
|
||||
|
||||
const COLOR_IDLE := Color(0.55, 0.58, 0.62)
|
||||
const COLOR_IMPACT := Color(1.0, 1.0, 1.0)
|
||||
@@ -30,6 +31,23 @@ func _ready() -> void:
|
||||
add_to_group("kickable")
|
||||
iron_mat = mesh_node.material_override.duplicate() as StandardMaterial3D
|
||||
mesh_node.material_override = iron_mat
|
||||
_tooltip = Label3D.new()
|
||||
_tooltip.text = "Iron\nHeavy weapon\n+Leather → Iron Shield\nForge → Metal Plate"
|
||||
_tooltip.billboard = BaseMaterial3D.BILLBOARD_ENABLED
|
||||
_tooltip.font_size = 28
|
||||
_tooltip.outline_size = 6
|
||||
_tooltip.position = Vector3(0, 1.1, 0)
|
||||
_tooltip.modulate = Color(1.0, 0.95, 0.8)
|
||||
_tooltip.visible = false
|
||||
add_child(_tooltip)
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if dead or state != State.IDLE:
|
||||
_tooltip.visible = false
|
||||
return
|
||||
var players := get_tree().get_nodes_in_group("player")
|
||||
_tooltip.visible = not players.is_empty() and \
|
||||
(players[0] as Node3D).global_position.distance_to(global_position) < 2.5
|
||||
|
||||
func apply_collision_damage(dmg: float) -> void:
|
||||
_take_damage(dmg)
|
||||
|
||||
Reference in New Issue
Block a user