12
scripts/building_manager.gd
Normal file
12
scripts/building_manager.gd
Normal file
@@ -0,0 +1,12 @@
|
||||
extends Node2D
|
||||
|
||||
@onready var world: World = $".."
|
||||
var base = preload("res://scene/base.tscn")
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventMouseButton and event.is_pressed() and event.button_index == MOUSE_BUTTON_LEFT:
|
||||
var build = base.instantiate()
|
||||
build.position = get_global_mouse_position()
|
||||
build.world = world
|
||||
add_child(build)
|
||||
#world_grid.set_cell(2, world_grid.local_to_map(get_global_mouse_position()), 0, Vector2i(16,2))
|
||||
Reference in New Issue
Block a user