From 956b719e62698ae1c482ecd903741317532c4766 Mon Sep 17 00:00:00 2001 From: Exobyt Date: Tue, 20 Aug 2024 01:04:19 +0200 Subject: [PATCH] Fixed Bugs; Temporarily removed I-Block --- scenes/Blocks/Patterns/block_pattern.gd | 12 ++++++++++-- scenes/Globals/global.gd | 2 +- scenes/Grid/grid.gd | 11 +++++++++-- scenes/Main/main.tscn | 13 +++++++------ 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/scenes/Blocks/Patterns/block_pattern.gd b/scenes/Blocks/Patterns/block_pattern.gd index b06a32f..7ad7b3f 100644 --- a/scenes/Blocks/Patterns/block_pattern.gd +++ b/scenes/Blocks/Patterns/block_pattern.gd @@ -115,10 +115,18 @@ func turn(direction, newPosition): func getCollidingAreas(): + collision.force_update_transform() + #collision.monitoring = false + #collision.monitorable = false + #await get_tree().process_frame + #await get_tree().process_frame + #collision.monitoring = true + collision.monitorable = false await get_tree().process_frame + collision.monitorable = true + collision.monitorable = false await get_tree().process_frame - await get_tree().process_frame - await get_tree().process_frame + collision.monitorable = true var collidingAreas = [] for i in collision.get_overlapping_areas(): if i.is_in_group("Block"): diff --git a/scenes/Globals/global.gd b/scenes/Globals/global.gd index 2b9dac2..8eec9ee 100644 --- a/scenes/Globals/global.gd +++ b/scenes/Globals/global.gd @@ -19,7 +19,7 @@ const BLOCKSPATTERS : Dictionary = { "Z-Reverse": "res://scenes/Blocks/Patterns/Z-Reverse/Z-Reverse_block_pattern.tscn", "2x2": "res://scenes/Blocks/Patterns/2x2/2x2_block_pattern.tscn", "T": "res://scenes/Blocks/Patterns/T/T_block_pattern.tscn", - "I": "res://scenes/Blocks/Patterns/I/I_block_pattern.tscn", + #"I": "res://scenes/Blocks/Patterns/I/I_block_pattern.tscn", "1x3": "res://scenes/Blocks/Patterns/1x3/1x3_block_pattern.tscn" } enum Direction {BOTTOM, LEFT, RIGHT, TOP} diff --git a/scenes/Grid/grid.gd b/scenes/Grid/grid.gd index 9266f76..e317b56 100644 --- a/scenes/Grid/grid.gd +++ b/scenes/Grid/grid.gd @@ -51,7 +51,8 @@ func _physics_process(delta: float) -> void: currentPattern.turn(GLOBAL.Direction.RIGHT,i.position-spawnpoint.position + Vector2(GLOBAL.GRID/2, GLOBAL.GRID/2)) #turnBlocks() if turnTickTimer.is_stopped(): - turnTickTimer.start(0.3) + print(5*delta) + turnTickTimer.start(9*delta) if Input.is_action_just_pressed("rotate_left") and not stopped: @@ -62,7 +63,8 @@ func _physics_process(delta: float) -> void: currentPattern.turn(GLOBAL.Direction.LEFT,i.position-spawnpoint.position + Vector2(GLOBAL.GRID/2, GLOBAL.GRID/2)) #turnBlocks() if turnTickTimer.is_stopped(): - turnTickTimer.start(0.3) + print(5*delta) + turnTickTimer.start(9*delta) if Input.is_action_just_pressed("left"): moveUidGroup(GLOBAL.Direction.LEFT, GLOBAL.currentUID) @@ -213,6 +215,11 @@ func _on_ticker_timeout() -> void: if await currentPattern.getCollidingBorder() == []: break currentPattern.position.x -= 64 + currentPattern.position.x = 0 + for i in range(1,8): + if await currentPattern.getCollidingBorder() == []: + break + currentPattern.position.x += 64 #if await currentPattern.getCollidingBorder() != []: #currentPattern.position.y += 64 diff --git a/scenes/Main/main.tscn b/scenes/Main/main.tscn index 7ee4ce1..bee062c 100644 --- a/scenes/Main/main.tscn +++ b/scenes/Main/main.tscn @@ -33,7 +33,7 @@ grow_vertical = 2 layout_mode = 1 offset_left = 56.0 offset_top = 64.0 -offset_right = 266.0 +offset_right = 320.0 offset_bottom = 152.0 [node name="Score" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer"] @@ -54,21 +54,22 @@ layout_mode = 1 anchors_preset = 1 anchor_left = 1.0 anchor_right = 1.0 -offset_left = -376.0 +offset_left = -312.0 offset_top = 64.0 -offset_right = -128.0 +offset_right = -56.0 offset_bottom = 152.0 grow_horizontal = 0 +alignment = 2 -[node name="Time" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer2"] +[node name="TimeValue" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer2"] layout_mode = 2 -text = "Time: " label_settings = ExtResource("3_jopb4") horizontal_alignment = 1 vertical_alignment = 1 -[node name="TimeValue" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer2"] +[node name="Time" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer2"] layout_mode = 2 +text = " :Time" label_settings = ExtResource("3_jopb4") horizontal_alignment = 1 vertical_alignment = 1