Blud_Mage/Scenes/Player/player.gd

26 lines
605 B
GDScript3
Raw Normal View History

2023-10-10 20:26:50 -04:00
extends Node2D
@export var batTemplatePath : PackedScene
func _ready():
pass
func _process(delta):
2023-10-10 20:37:31 -04:00
handle_menu_inputs()
2023-10-10 20:26:50 -04:00
if Input.is_action_just_pressed("place_spawnable"):
2023-10-10 20:37:31 -04:00
spawn_bat()
func handle_menu_inputs():
if Input.is_action_just_pressed("fullscreen_toggle"):
if get_window().mode == Window.MODE_EXCLUSIVE_FULLSCREEN:
get_window().mode = Window.MODE_WINDOWED
else:
get_window().mode = Window.MODE_EXCLUSIVE_FULLSCREEN
2023-10-10 20:26:50 -04:00
2023-10-10 20:37:31 -04:00
func spawn_bat():
2023-10-10 20:26:50 -04:00
var bat = batTemplatePath.instantiate()
bat.global_position = get_global_mouse_position()
$"..".add_child(bat)
$"../Enemy".add_foe(bat)