diff --git a/buildings/building.gd b/buildings/building.gd index 58e5d6d..e985b19 100644 --- a/buildings/building.gd +++ b/buildings/building.gd @@ -15,10 +15,10 @@ func _ready() -> void: if blocks_area: Grid.buildings.append(self) - await get_tree().create_timer(0.2).timeout + #await get_tree().create_timer(0.2).timeout if get_node_or_null("ObjectList") != null: var obj_list = $ObjectList - obj_list.reparent(get_tree().get_root().get_node("main"), false) + obj_list.call_deferred("reparent", get_tree().get_root().get_node("main"), false) await get_tree().create_timer(0.2).timeout var objects_to_be_placed = obj_list.get_children() for object in objects_to_be_placed: diff --git a/enemies/boss/boss.gd b/enemies/boss/boss.gd index 1a84b2f..e9c4a35 100644 --- a/enemies/boss/boss.gd +++ b/enemies/boss/boss.gd @@ -102,7 +102,7 @@ func destroy_below(): func wave(): # Raise a wave from the water at the boundary of the screen and move it towards the center. - var angle = player.position.angle + var angle = player.position.angle() var dir = randi_range(0, 1) * 2 - 1 var speed = 3000 / water.radius_base water.create_tsunami(angle - speed * dir * TAU/30, dir, speed) diff --git a/vines_petals/vine_node.gd b/utils/grid_node.gd similarity index 90% rename from vines_petals/vine_node.gd rename to utils/grid_node.gd index a295d91..28f768e 100644 --- a/vines_petals/vine_node.gd +++ b/utils/grid_node.gd @@ -1,18 +1,20 @@ -class_name VineNode extends Node2D +class_name GridNode extends Node2D @export var vine : Vine @export var location : Vector2 : set(new_loc): location = Global.vec_mod(new_loc, Grid.num_collumns, true) -@export var offset : Vector2 + update_position() +@export var offset : Vector2 : + set(new_offset): + offset = new_offset + update_position() @export var depth : int func _get(property: StringName) -> Variant: if property == "position": - update_position() return position if property == "global_position": - update_position() return global_position return null diff --git a/vines_petals/vine_node.gd.uid b/utils/grid_node.gd.uid similarity index 100% rename from vines_petals/vine_node.gd.uid rename to utils/grid_node.gd.uid diff --git a/vines_petals/bud.gd b/vines_petals/bud.gd index db9a246..a47f795 100644 --- a/vines_petals/bud.gd +++ b/vines_petals/bud.gd @@ -1,4 +1,4 @@ -class_name Bud extends VineNode +class_name Bud extends GridNode signal opened var img_path diff --git a/vines_petals/petal.gd b/vines_petals/petal.gd index f83b23d..bc8932c 100644 --- a/vines_petals/petal.gd +++ b/vines_petals/petal.gd @@ -1,4 +1,4 @@ -class_name Petal extends VineNode +class_name Petal extends GridNode @export var vine_resource : PackedScene var activated = false diff --git a/vines_petals/vine.gd b/vines_petals/vine.gd index 3153b15..0ede719 100644 --- a/vines_petals/vine.gd +++ b/vines_petals/vine.gd @@ -59,7 +59,7 @@ func draw_vine(pos1 : Vector2, pos2 : Vector2, depth : int): sprite.z_index = -1 # Grows a sequence of vine segments from grid position 1 to grid position 2, starting at given depth. -func grow_vine_sequence(start : VineNode, target: VineNode, grow_bud = false, quick_spawn = false): +func grow_vine_sequence(start : GridNode, target: GridNode, grow_bud = false, quick_spawn = false): var depth = min(start.depth, max_depth) # Calculate the number and length of segments from the distance of source and target @@ -152,7 +152,7 @@ func _enter_tree() -> void: func random_vine_node_at(location): var offset = random_offset() - return VineNode.new(self, location, offset) + return GridNode.new(self, location, offset) func init_random(): Grid.add_vine_to(self, petal.location)