38 lines
1 KiB
GDScript
38 lines
1 KiB
GDScript
extends Control
|
|
|
|
@onready var gravityText : Label = $txt_gravity
|
|
@onready var posText : Label = $txt_pos
|
|
@onready var levelText : Label = $txt_level
|
|
@onready var currentLevel : Node2D
|
|
@onready var player : Node2D = $".."
|
|
|
|
var textVisible: bool = false
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
currentLevel = player.get_owner()
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
gravityText.text = str(al_globals.y_gravity)
|
|
posText.text = str(player.position.x) + ", " + str(player.position.y)
|
|
levelText.text = str(currentLevel.name)
|
|
|
|
if Input.is_action_just_pressed("toggle_debug"):
|
|
print("detected!")
|
|
if textVisible:
|
|
textVisible = false
|
|
else:
|
|
textVisible = true
|
|
toggle_visibilty()
|
|
|
|
func toggle_visibilty():
|
|
if textVisible:
|
|
gravityText.visible = true
|
|
posText.visible = true
|
|
levelText.visible = true
|
|
else:
|
|
gravityText.visible = false
|
|
posText.visible = false
|
|
levelText.visible = false
|