Wicked-Depths/Node2D.gd

50 lines
1.6 KiB
GDScript3
Raw Normal View History

extends Node2D
var can_move = true
# Called when the node enters the scene tree for the first time.
func _ready():
if SaveHandler.settings["checkpoint"] == "":
$continue.modulate = Color("747474")
can_move = false
$"new game".text = "[u][center]new game"
var switch = false
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if Input.is_action_just_pressed("ui_down") and can_move:
if switch == false:
switch = true
$"new game".text = "[center]new game"
$continue.text = "[u][center]continue"
else:
switch = false
$"new game".text = "[u][center]new game"
$continue.text = "[center]continue"
if Input.is_action_just_pressed("ui_up") and can_move:
if switch == false:
switch = true
$"new game".text = "[center]new game"
$continue.text = "[u][center]continue"
else:
switch = false
$"new game".text = "[u][center]new game"
$continue.text = "[center]continue"
if Input.is_action_just_pressed("interact") or Input.is_action_just_pressed("ui_accept"):
if switch == false:
SaveHandler.set_setting("LoadSave",false)
else:
SaveHandler.set_setting("LoadSave",true)
var tweener = get_tree().create_tween()
var tweener2 = get_tree().create_tween()
tweener2.tween_property(get_parent().get_node("AudioStreamPlayer2D"),"volume_db",-100,3)
var recter = get_parent().get_node("CanvasLayer/ColorRect")
tweener.set_ease(Tween.EASE_IN)
tweener.set_trans(Tween.TRANS_CUBIC)
tweener.tween_property(recter,"size",Vector2(1152,648),2)
await tweener.finished
await get_tree().create_timer(1).timeout
get_tree().change_scene_to_file("res://node_2d.tscn")