moved dictionary populating to its own function
This commit is contained in:
parent
5c88414c48
commit
c2188316ab
|
|
@ -10,6 +10,24 @@ var currently_dragged_area: Area2D
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
|
|
||||||
|
populate_board()
|
||||||
|
reorder_areas("dropzone_content")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
|
||||||
|
# Reset information about Areas being dragged, if the mouse is not longer pressed.
|
||||||
|
# Needed because otherwise it can happen that the areas don't register it if you stop clicking on them.
|
||||||
|
if !Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT) and is_area_dragged:
|
||||||
|
currently_dragged_area.is_dragged = false
|
||||||
|
is_area_dragged = false
|
||||||
|
currently_dragged_area = null
|
||||||
|
|
||||||
|
# Will be used later to spawn Cards and Post-Its and remember them in the dictionary
|
||||||
|
func populate_board():
|
||||||
|
|
||||||
# TODO: Currently populating the dictionary with the Nodes currently in the scene
|
# TODO: Currently populating the dictionary with the Nodes currently in the scene
|
||||||
# When opening the scene we need to pass some kind of collection to the Board
|
# When opening the scene we need to pass some kind of collection to the Board
|
||||||
# Then it can display the Card/PostIts and populate its dictionary at the same time
|
# Then it can display the Card/PostIts and populate its dictionary at the same time
|
||||||
|
|
@ -26,21 +44,6 @@ func _ready():
|
||||||
|
|
||||||
currently_selected_node = area_dict["dropzone_content"][0] # set first Card as currently selected node by default
|
currently_selected_node = area_dict["dropzone_content"][0] # set first Card as currently selected node by default
|
||||||
|
|
||||||
reorder_areas("dropzone_content")
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta):
|
|
||||||
|
|
||||||
# Reset information about Areas being dragged, if the mouse is not longer pressed.
|
|
||||||
# Needed because otherwise it can happen that the areas don't register it if you stop clicking on them.
|
|
||||||
if !Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT) and is_area_dragged:
|
|
||||||
currently_dragged_area.is_dragged = false
|
|
||||||
is_area_dragged = false
|
|
||||||
currently_dragged_area = null
|
|
||||||
|
|
||||||
# Will be used later to spawn Cards and Post-Its and remember them in the dictionary
|
|
||||||
func populate_board():
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Checks if a Node is currently inside the dropzone
|
# Checks if a Node is currently inside the dropzone
|
||||||
func is_in_dropzone(to_check: Node) -> bool:
|
func is_in_dropzone(to_check: Node) -> bool:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue