21 lines
575 B
GDScript3
21 lines
575 B
GDScript3
|
|
extends Node2D
|
||
|
|
|
||
|
|
var loaded : bool = false
|
||
|
|
signal spawn(spawn_position : Vector2)
|
||
|
|
|
||
|
|
# Called when the node enters the scene tree for the first time.
|
||
|
|
func _ready() -> void:
|
||
|
|
pass # Replace with function body.
|
||
|
|
|
||
|
|
|
||
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||
|
|
func _process(delta: float) -> void:
|
||
|
|
visible = loaded
|
||
|
|
if loaded:
|
||
|
|
global_position = get_global_mouse_position()
|
||
|
|
if(Input.is_action_just_pressed("spawn")):
|
||
|
|
loaded = false
|
||
|
|
spawn.emit(get_global_mouse_position())
|
||
|
|
if(Input.is_action_just_pressed("cancel_spawn")):
|
||
|
|
loaded = false
|