dice-rolling-simulator/Dice.gd

23 lines
688 B
GDScript3
Raw Normal View History

2021-12-01 09:05:08 +00:00
extends RigidBody
var outline_visible = false
# Called when the node enters the scene tree for the first time.
func _ready():
self.mode = RigidBody.MODE_RIGID
get_node("MeshInstance/MeshOutline").visible = false
func _toggle_outline():
outline_visible = !outline_visible
if outline_visible:
self.mode = RigidBody.MODE_STATIC
get_node("MeshInstance/MeshOutline").visible = true
else:
self.mode = RigidBody.MODE_RIGID
get_node("MeshInstance/MeshOutline").visible = false
func _on_Dice_input_event(_camera, event, _click_position, _click_normal, _shape_idx):
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
_toggle_outline()