Skip to content

Instantly share code, notes, and snippets.

@MarianoGnu
Created December 27, 2015 21:57
Show Gist options
  • Select an option

  • Save MarianoGnu/f177326d51cb3efaaf31 to your computer and use it in GitHub Desktop.

Select an option

Save MarianoGnu/f177326d51cb3efaaf31 to your computer and use it in GitHub Desktop.
extends Node
var exit_block = load("res://scenes/exit_confirmation.scn")
var open = false
var confirmation = null
var create = false
func _ready():
set_process(true)
get_node("StreamPlayer").set_volume_db(get_node("/root/global").bgm_converter())
func _process(delta):
if get_node("StreamPlayer").is_playing() == false:
get_node("StreamPlayer").play()
if not open:
if Input.is_action_pressed("ui_1"):
Input.action_release("ui_1")
get_node("/root/global").setScene("res://scenes/level_select.scn")
if Input.is_action_pressed("ui_2"):
Input.action_release("ui_2")
get_node("/root/global").setScene("res://scenes/options.scn")
if Input.is_action_pressed("ui_3"):
Input.action_release("ui_3")
confirmation = confirmation_creation()
confirmation.set_name("confirmation")
confirmation.set_pos(Vector2(17,150))
self.add_child(confirmation)
if open:
if Input.is_action_pressed("ui_9"):
Input.action_release("ui_9")
get_node("confirmation").queue_free()
open = false
if Input.is_action_pressed("ui_0"):
Input.action_release("ui_0")
get_tree().quit()
if create:
confirmation = confirmation_creation()
confirmation.set_name("confirmation")
confirmation.set_pos(Vector2(17,150))
self.add_child(confirmation)
create = false
func _notification(what):
if what == 7 and not open:
create = true
func confirmation_creation():
var spawn = exit_block.instance()
open = true
return spawn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment