Fixed Expand Block Bug

This commit is contained in:
Exobyt 2024-08-20 13:48:28 +02:00
parent 6d71780f36
commit e7d50232b2
4 changed files with 52 additions and 72 deletions

View file

@ -10,8 +10,9 @@ config_version=5
[application] [application]
config/name="GmtkGameJam2024" config/name="Texpand"
config/description="Submission for the GMTK Game jam 2024. Tetris with special Blocks that expands" config/description="Submission for the GMTK Game jam 2024. Tetris with special Blocks that expands"
config/version="0.1.1"
config/tags=PackedStringArray("game_jam") config/tags=PackedStringArray("game_jam")
run/main_scene="res://scenes/Main/main.tscn" run/main_scene="res://scenes/Main/main.tscn"
config/features=PackedStringArray("4.3", "GL Compatibility") config/features=PackedStringArray("4.3", "GL Compatibility")
@ -29,6 +30,7 @@ window/size/viewport_width=1080
window/size/viewport_height=1280 window/size/viewport_height=1280
window/stretch/mode="viewport" window/stretch/mode="viewport"
window/stretch/aspect="expand" window/stretch/aspect="expand"
window/stretch/scale=0.5
window/handheld/orientation=1 window/handheld/orientation=1
[editor] [editor]
@ -111,8 +113,5 @@ textures/canvas_textures/default_texture_filter=0
renderer/rendering_method="gl_compatibility" renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility" renderer/rendering_method.mobile="gl_compatibility"
textures/vram_compression/import_etc2_astc=true textures/vram_compression/import_etc2_astc=true
anti_aliasing/quality/msaa_2d=1
anti_aliasing/quality/msaa_3d=1
anti_aliasing/quality/screen_space_aa=1
anti_aliasing/quality/use_taa=true anti_aliasing/quality/use_taa=true
anti_aliasing/quality/use_debanding=true anti_aliasing/quality/use_debanding=true

View file

@ -7,7 +7,6 @@ extends Node2D
@onready var turnTickTimer = $TurnTick @onready var turnTickTimer = $TurnTick
@onready var loseArea = $LoseArea @onready var loseArea = $LoseArea
@onready var gameTimer = $GameTimer @onready var gameTimer = $GameTimer
@onready var coyoteTimer = $CoyoteTimer
var nextBlocks = [] var nextBlocks = []
@ -186,6 +185,7 @@ func getNewPatterns():
newPatterns[0].type = GLOBAL.BLOCKTYPES.HEAVY newPatterns[0].type = GLOBAL.BLOCKTYPES.HEAVY
newPatterns.shuffle() newPatterns.shuffle()
newPatterns[0].expand = true newPatterns[0].expand = true
newPatterns.shuffle() newPatterns.shuffle()
patternsArray.append_array(newPatterns) patternsArray.append_array(newPatterns)
@ -204,16 +204,25 @@ func _on_turn_tick_timeout() -> void:
turnBlocks() turnBlocks()
func _on_ticker_timeout() -> void: func _on_ticker_timeout() -> void:
stopped = true
if getBlockedDirection(GLOBAL.Direction.BOTTOM, GLOBAL.currentUID): if getBlockedDirection(GLOBAL.Direction.BOTTOM, GLOBAL.currentUID):
coyoteTimer.start(0.08)
stopped = true
test()
for i in getBlockGroupsList(): for i in getBlockGroupsList():
moveUidGroup(GLOBAL.Direction.BOTTOM, i) moveUidGroup(GLOBAL.Direction.BOTTOM, i)
tickerTimer.start(blockSpeed) if not stopped:
stopped = false tickerTimer.start(blockSpeed)
stopped = false
elif stopped:
if loseArea.get_overlapping_areas() != []:
GLOBAL.lose()
tickerTimer.start(GLOBAL.minSpeed)
stopped = false
func _on_game_timer_timeout() -> void: func _on_game_timer_timeout() -> void:
@ -224,72 +233,47 @@ func _on_game_timer_timeout() -> void:
gameTimer.start(1) gameTimer.start(1)
func _on_coyote_timer_timeout() -> void: func test():
if loseArea.get_overlapping_areas() != []:
GLOBAL.lose()
for i in $RowTests.get_children(): for i in $RowTests.get_children():
for j in getBlockGroupsList(): for j in getBlockGroupsList():
if j != GLOBAL.currentUID: if j != GLOBAL.currentUID:
moveUidGroup(GLOBAL.Direction.BOTTOM, i) moveUidGroup(GLOBAL.Direction.BOTTOM, i)
stopped = true stopped = true
var previousPosition = currentPattern.position
if currentPattern.expand: if currentPattern.expand:
if currentPattern.get_scale() != Vector2(2,2): if currentPattern.get_scale() != Vector2(2,2):
#currentPattern.position.y -= 64
for i in getBlockGroupsList()[GLOBAL.currentUID]: for i in getBlockGroupsList()[GLOBAL.currentUID]:
print(i.name)
if i.turningPoint: if i.turningPoint:
currentPattern.set_scale(Vector2(2,2)) currentPattern.set_scale(Vector2(2,2))
currentPattern.moveToPosition(i.global_position-spawnpoint.position - Vector2(64,64*4)) currentPattern.moveToPosition(i.global_position-spawnpoint.position)
#if await currentPattern.getCollidingBorder() != []: #currentPattern.position.x - 64
for i in await currentPattern.getCollidingBorder(): #if i.is_in_group("Block"):
#if i.is_in_group("Floor"):
#for j in range(1,3): for j in await currentPattern.getCollidingBorder():
#if not await currentPattern.getCollidingBorder() == []: if j.is_in_group("Floor"):
#break currentPattern.position.y -= GLOBAL.GRID
#currentPattern.position.y -= 64
if i.is_in_group("LeftBorder"):
for j in range(1,8):
if await currentPattern.getCollidingBorder() == []: if await currentPattern.getCollidingBorder() == []:
break break
currentPattern.position.x += 64 if j.is_in_group("LeftBorder"):
elif i.is_in_group("RightBorder"): for s in range(1,7):
for j in range(1,8): currentPattern.position.x += GLOBAL.GRID
if await currentPattern.getCollidingBorder() == []: if await currentPattern.getCollidingBorder() == []:
break break
currentPattern.position.x -= 64 elif j.is_in_group("RightBorder"):
#for i in range(1,8): for s in range(1,7):
#print(await currentPattern.getCollidingBorder()) currentPattern.position.x -= GLOBAL.GRID
#if await currentPattern.getCollidingBorder() == []: if await currentPattern.getCollidingBorder() == []:
#break 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
#if await currentPattern.getCollidingBorder() != []: if await currentPattern.getCollidingBorder() == []:
#currentPattern.position.x -= 64 for i in getBlockGroupsList()[GLOBAL.currentUID].size():
for i in getBlockGroupsList()[GLOBAL.currentUID].size(): getBlockGroupsList()[GLOBAL.currentUID][i].global_position = currentPattern.getPositions()[i].global_position - Vector2(GLOBAL.GRID, GLOBAL.GRID)
getBlockGroupsList()[GLOBAL.currentUID][i].global_position = currentPattern.getPositions()[i].global_position - Vector2(GLOBAL.GRID, GLOBAL.GRID) getBlockGroupsList()[GLOBAL.currentUID][i].set_scale(Vector2(2,2))
getBlockGroupsList()[GLOBAL.currentUID][i].set_scale(Vector2(2,2))
for i in await currentPattern.getCollidingBlocks(): for i in await currentPattern.getCollidingBlocks():
i.queue_free() i.queue_free()
#for i in blocks.get_children():
#if i.get_scale() != Vector2(2,2):
#i.set_scale(Vector2(2,2))
#i.move(-64,-64)
#var turningPointBlock
#for g in currentPattern.getPositions().size():
#if not getBlockGroupsList()[GLOBAL.currentUID][g].turningPoint:
#getBlockGroupsList()[GLOBAL.currentUID][g].global_position = currentPattern.getPositions()[g].global_position- Vector2(32,32)
#else:
#turningPointBlock = getBlockGroupsList()[GLOBAL.currentUID][g]
#for g in currentPattern.getPositions():
#if g.turningPoint:
#turningPointBlock.global_position = g.global_position- Vector2(32,32)
#if i.turningPoint:
#currentPattern.global_position = i.global_position- Vector2(32,32)
for i in $RowTests.get_children(): for i in $RowTests.get_children():
if i.isCompleted(): if i.isCompleted():
@ -297,12 +281,14 @@ func _on_coyote_timer_timeout() -> void:
splitOphansUID(j.UID) splitOphansUID(j.UID)
if j.expand: if j.expand:
GLOBAL.points += j.type * 2 GLOBAL.points += j.type * 2
GLOBAL.time += j.type * 2 GLOBAL.time += j.type * 4
elif not j.expand: elif not j.expand:
GLOBAL.points += j.type GLOBAL.points += j.type
GLOBAL.time += j.type GLOBAL.time += j.type * 2
j.queue_free() j.queue_free()
for j in getBlockGroupsList(): for j in getBlockGroupsList():
if j != GLOBAL.currentUID: if j != GLOBAL.currentUID:
moveUidGroup(GLOBAL.Direction.BOTTOM, j) moveUidGroup(GLOBAL.Direction.BOTTOM, j)
PlacePattern() PlacePattern()

View file

@ -119,13 +119,13 @@ one_shot = true
[node name="Border" parent="Borders" groups=["LeftBorder"] instance=ExtResource("4_3j08q")] [node name="Border" parent="Borders" groups=["LeftBorder"] instance=ExtResource("4_3j08q")]
[node name="CollisionShape2D" parent="Borders/Border" index="0"] [node name="CollisionShape2D" parent="Borders/Border" index="0" groups=["LeftBorder"]]
position = Vector2(-64, 512) position = Vector2(-64, 512)
shape = SubResource("RectangleShape2D_flipi") shape = SubResource("RectangleShape2D_flipi")
[node name="Border2" parent="Borders" groups=["RightBorder"] instance=ExtResource("4_3j08q")] [node name="Border2" parent="Borders" groups=["RightBorder"] instance=ExtResource("4_3j08q")]
[node name="CollisionShape2D" parent="Borders/Border2" index="0"] [node name="CollisionShape2D" parent="Borders/Border2" index="0" groups=["RightBorder"]]
position = Vector2(704, 512) position = Vector2(704, 512)
shape = SubResource("RectangleShape2D_flipi") shape = SubResource("RectangleShape2D_flipi")
@ -285,9 +285,6 @@ action_mode = 0
icon = ExtResource("14_i1yud") icon = ExtResource("14_i1yud")
icon_alignment = 1 icon_alignment = 1
[node name="CoyoteTimer" type="Timer" parent="."]
one_shot = true
[connection signal="timeout" from="Ticker" to="." method="_on_ticker_timeout"] [connection signal="timeout" from="Ticker" to="." method="_on_ticker_timeout"]
[connection signal="timeout" from="TurnTick" to="." method="_on_turn_tick_timeout"] [connection signal="timeout" from="TurnTick" to="." method="_on_turn_tick_timeout"]
[connection signal="timeout" from="GameTimer" to="." method="_on_game_timer_timeout"] [connection signal="timeout" from="GameTimer" to="." method="_on_game_timer_timeout"]
@ -297,7 +294,6 @@ one_shot = true
[connection signal="pressed" from="Camera2D/CanvasLayer/Control/HBoxContainer4/rotate_right_Button" to="Camera2D/CanvasLayer/Control" method="_on_rotate_right_button_pressed"] [connection signal="pressed" from="Camera2D/CanvasLayer/Control/HBoxContainer4/rotate_right_Button" to="Camera2D/CanvasLayer/Control" method="_on_rotate_right_button_pressed"]
[connection signal="button_down" from="Camera2D/CanvasLayer/Control/HBoxContainer5/down_Button" to="Camera2D/CanvasLayer/Control" method="_on_down_button_button_down"] [connection signal="button_down" from="Camera2D/CanvasLayer/Control/HBoxContainer5/down_Button" to="Camera2D/CanvasLayer/Control" method="_on_down_button_button_down"]
[connection signal="button_up" from="Camera2D/CanvasLayer/Control/HBoxContainer5/down_Button" to="Camera2D/CanvasLayer/Control" method="_on_down_button_button_up"] [connection signal="button_up" from="Camera2D/CanvasLayer/Control/HBoxContainer5/down_Button" to="Camera2D/CanvasLayer/Control" method="_on_down_button_button_up"]
[connection signal="timeout" from="CoyoteTimer" to="." method="_on_coyote_timer_timeout"]
[editable path="Borders/Border"] [editable path="Borders/Border"]
[editable path="Borders/Border2"] [editable path="Borders/Border2"]

View file

@ -16,7 +16,6 @@ func isCompleted():
amount += 2 amount += 2
else: else:
amount += 1 amount += 1
if amount >= 10: if amount >= 10:
return true return true
else: else: