Fixed Bugs; Added Score overview
This commit is contained in:
parent
fdfb6a7d39
commit
6d71780f36
9 changed files with 152 additions and 33 deletions
6
Theme/labelBig.tres
Normal file
6
Theme/labelBig.tres
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_resource type="LabelSettings" format=3 uid="uid://5mlweyjje7c4"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
font_size = 128
|
||||||
|
outline_size = 10
|
||||||
|
outline_color = Color(0, 0, 0, 1)
|
||||||
|
|
@ -111,3 +111,8 @@ 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_debanding=true
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ var turningPoint = false
|
||||||
|
|
||||||
var type = GLOBAL.BLOCKTYPES.LIGHT
|
var type = GLOBAL.BLOCKTYPES.LIGHT
|
||||||
|
|
||||||
|
var expand = false
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
secretPosition = position
|
secretPosition = position
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ var lastUID = 1
|
||||||
|
|
||||||
var currentUID = lastUID
|
var currentUID = lastUID
|
||||||
|
|
||||||
var time = 0
|
var time = 60
|
||||||
|
|
||||||
var lost = false
|
var lost = false
|
||||||
|
|
||||||
|
|
@ -38,10 +38,11 @@ func getNewUID() -> int:
|
||||||
|
|
||||||
|
|
||||||
func resetGame():
|
func resetGame():
|
||||||
|
lost = false
|
||||||
points = 0
|
points = 0
|
||||||
lastUID = 0
|
lastUID = 0
|
||||||
currentUID = lastUID
|
currentUID = lastUID
|
||||||
time = 0
|
time = 60
|
||||||
lost = false
|
lost = false
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,7 @@ func _ready() -> void:
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
|
|
||||||
for i in getBlockGroupsList():
|
|
||||||
if i != GLOBAL.currentUID:
|
|
||||||
moveUidGroup(GLOBAL.Direction.BOTTOM, i)
|
|
||||||
var blockGroups = getBlockGroupsList()
|
var blockGroups = getBlockGroupsList()
|
||||||
#if Input.is_action_pressed("down"):
|
#if Input.is_action_pressed("down"):
|
||||||
|
|
||||||
|
|
@ -53,10 +51,10 @@ func _physics_process(delta: float) -> void:
|
||||||
for i in blockGroups[GLOBAL.currentUID]:
|
for i in blockGroups[GLOBAL.currentUID]:
|
||||||
if i.turningPoint:
|
if i.turningPoint:
|
||||||
if currentPattern != null:
|
if currentPattern != null:
|
||||||
|
if not stopped:
|
||||||
currentPattern.turn(GLOBAL.Direction.RIGHT,i.position-spawnpoint.position + Vector2(GLOBAL.GRID/2, GLOBAL.GRID/2))
|
currentPattern.turn(GLOBAL.Direction.RIGHT,i.position-spawnpoint.position + Vector2(GLOBAL.GRID/2, GLOBAL.GRID/2))
|
||||||
#turnBlocks()
|
#turnBlocks()
|
||||||
if turnTickTimer.is_stopped():
|
if turnTickTimer.is_stopped():
|
||||||
print(5*delta)
|
|
||||||
turnTickTimer.start(9*delta)
|
turnTickTimer.start(9*delta)
|
||||||
|
|
||||||
if Input.is_action_just_pressed("rotate_left") and not stopped:
|
if Input.is_action_just_pressed("rotate_left") and not stopped:
|
||||||
|
|
@ -64,10 +62,10 @@ func _physics_process(delta: float) -> void:
|
||||||
for i in blockGroups[GLOBAL.currentUID]:
|
for i in blockGroups[GLOBAL.currentUID]:
|
||||||
if i.turningPoint:
|
if i.turningPoint:
|
||||||
if currentPattern != null:
|
if currentPattern != null:
|
||||||
|
if not stopped:
|
||||||
currentPattern.turn(GLOBAL.Direction.LEFT,i.position-spawnpoint.position + Vector2(GLOBAL.GRID/2, GLOBAL.GRID/2))
|
currentPattern.turn(GLOBAL.Direction.LEFT,i.position-spawnpoint.position + Vector2(GLOBAL.GRID/2, GLOBAL.GRID/2))
|
||||||
#turnBlocks()
|
#turnBlocks()
|
||||||
if turnTickTimer.is_stopped():
|
if turnTickTimer.is_stopped():
|
||||||
print(5*delta)
|
|
||||||
turnTickTimer.start(9*delta)
|
turnTickTimer.start(9*delta)
|
||||||
|
|
||||||
if Input.is_action_just_pressed("left"):
|
if Input.is_action_just_pressed("left"):
|
||||||
|
|
@ -174,6 +172,7 @@ func PlacePattern():
|
||||||
block.modulate = newColor
|
block.modulate = newColor
|
||||||
block.position = spawnpoint.position + i.position
|
block.position = spawnpoint.position + i.position
|
||||||
block.type = currentPattern.type
|
block.type = currentPattern.type
|
||||||
|
block.expand = currentPattern.expand
|
||||||
if i.turningPoint:
|
if i.turningPoint:
|
||||||
block.turningPoint = true
|
block.turningPoint = true
|
||||||
blocks.add_child(block)
|
blocks.add_child(block)
|
||||||
|
|
@ -188,8 +187,6 @@ func getNewPatterns():
|
||||||
newPatterns.shuffle()
|
newPatterns.shuffle()
|
||||||
newPatterns[0].expand = true
|
newPatterns[0].expand = true
|
||||||
newPatterns.shuffle()
|
newPatterns.shuffle()
|
||||||
for i in newPatterns:
|
|
||||||
i.expand = true
|
|
||||||
patternsArray.append_array(newPatterns)
|
patternsArray.append_array(newPatterns)
|
||||||
|
|
||||||
func turnBlocks():
|
func turnBlocks():
|
||||||
|
|
@ -209,7 +206,7 @@ func _on_turn_tick_timeout() -> void:
|
||||||
func _on_ticker_timeout() -> void:
|
func _on_ticker_timeout() -> void:
|
||||||
stopped = true
|
stopped = true
|
||||||
if getBlockedDirection(GLOBAL.Direction.BOTTOM, GLOBAL.currentUID):
|
if getBlockedDirection(GLOBAL.Direction.BOTTOM, GLOBAL.currentUID):
|
||||||
coyoteTimer.start(0.1)
|
coyoteTimer.start(0.08)
|
||||||
|
|
||||||
|
|
||||||
for i in getBlockGroupsList():
|
for i in getBlockGroupsList():
|
||||||
|
|
@ -220,21 +217,21 @@ func _on_ticker_timeout() -> void:
|
||||||
|
|
||||||
|
|
||||||
func _on_game_timer_timeout() -> void:
|
func _on_game_timer_timeout() -> void:
|
||||||
if GLOBAL.time + 1 > 0:
|
if GLOBAL.time - 1 > 0:
|
||||||
GLOBAL.time += 1
|
GLOBAL.time -= 1
|
||||||
#else:
|
else:
|
||||||
#GLOBAL.lose()
|
GLOBAL.lose()
|
||||||
gameTimer.start(1)
|
gameTimer.start(1)
|
||||||
|
|
||||||
|
|
||||||
func _on_coyote_timer_timeout() -> void:
|
func _on_coyote_timer_timeout() -> void:
|
||||||
|
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
|
||||||
if loseArea.get_overlapping_areas() != []:
|
|
||||||
GLOBAL.lose()
|
|
||||||
if currentPattern.expand:
|
if currentPattern.expand:
|
||||||
if currentPattern.get_scale() != Vector2(2,2):
|
if currentPattern.get_scale() != Vector2(2,2):
|
||||||
for i in getBlockGroupsList()[GLOBAL.currentUID]:
|
for i in getBlockGroupsList()[GLOBAL.currentUID]:
|
||||||
|
|
@ -243,9 +240,12 @@ func _on_coyote_timer_timeout() -> void:
|
||||||
currentPattern.moveToPosition(i.global_position-spawnpoint.position - Vector2(64,64*4))
|
currentPattern.moveToPosition(i.global_position-spawnpoint.position - Vector2(64,64*4))
|
||||||
#if await currentPattern.getCollidingBorder() != []:
|
#if await currentPattern.getCollidingBorder() != []:
|
||||||
for i in await currentPattern.getCollidingBorder():
|
for i in await currentPattern.getCollidingBorder():
|
||||||
if i.is_in_group("Floor"):
|
#if i.is_in_group("Floor"):
|
||||||
currentPattern.position.y -= 64
|
#for j in range(1,3):
|
||||||
elif i.is_in_group("LeftBorder"):
|
#if not await currentPattern.getCollidingBorder() == []:
|
||||||
|
#break
|
||||||
|
#currentPattern.position.y -= 64
|
||||||
|
if i.is_in_group("LeftBorder"):
|
||||||
for j in range(1,8):
|
for j in range(1,8):
|
||||||
if await currentPattern.getCollidingBorder() == []:
|
if await currentPattern.getCollidingBorder() == []:
|
||||||
break
|
break
|
||||||
|
|
@ -295,6 +295,14 @@ func _on_coyote_timer_timeout() -> void:
|
||||||
if i.isCompleted():
|
if i.isCompleted():
|
||||||
for j in i.getRow():
|
for j in i.getRow():
|
||||||
splitOphansUID(j.UID)
|
splitOphansUID(j.UID)
|
||||||
|
if j.expand:
|
||||||
|
GLOBAL.points += j.type * 2
|
||||||
|
GLOBAL.time += j.type * 2
|
||||||
|
elif not j.expand:
|
||||||
GLOBAL.points += j.type
|
GLOBAL.points += j.type
|
||||||
|
GLOBAL.time += j.type
|
||||||
j.queue_free()
|
j.queue_free()
|
||||||
|
for j in getBlockGroupsList():
|
||||||
|
if j != GLOBAL.currentUID:
|
||||||
|
moveUidGroup(GLOBAL.Direction.BOTTOM, j)
|
||||||
PlacePattern()
|
PlacePattern()
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,19 @@ extends Node
|
||||||
|
|
||||||
# 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() -> void:
|
func _ready() -> void:
|
||||||
pass # Replace with function body.
|
loadGrid()
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
if get_children() != []:
|
||||||
|
if GLOBAL.lost and get_child(0).name == "Grid":
|
||||||
|
scoreOverview()
|
||||||
|
|
||||||
|
func loadGrid():
|
||||||
|
if $ScoreOverview != null:
|
||||||
|
$ScoreOverview.queue_free()
|
||||||
|
add_child(load("res://scenes/Grid/grid.tscn").instantiate())
|
||||||
|
|
||||||
|
func scoreOverview():
|
||||||
|
if $Grid != null:
|
||||||
|
$Grid.queue_free()
|
||||||
|
add_child(load("res://scenes/ScoreOverview/score_overview.tscn").instantiate())
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,6 @@
|
||||||
[gd_scene load_steps=4 format=3 uid="uid://bq5hrqgv0f6hp"]
|
[gd_scene load_steps=2 format=3 uid="uid://bq5hrqgv0f6hp"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dwl4lotl1d3ij" path="res://scenes/Grid/grid.tscn" id="1_88eap"]
|
|
||||||
[ext_resource type="Script" path="res://scenes/Main/main.gd" id="1_dtde6"]
|
[ext_resource type="Script" path="res://scenes/Main/main.gd" id="1_dtde6"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c03h0nwewolfx" path="res://scenes/Grid/SpeedScale.tscn" id="2_mnoeo"]
|
|
||||||
|
|
||||||
[node name="main" type="Node"]
|
[node name="main" type="Node"]
|
||||||
script = ExtResource("1_dtde6")
|
script = ExtResource("1_dtde6")
|
||||||
|
|
||||||
[node name="Grid" parent="." instance=ExtResource("1_88eap")]
|
|
||||||
position = Vector2(128, 256)
|
|
||||||
|
|
||||||
[node name="Node2D" parent="." instance=ExtResource("2_mnoeo")]
|
|
||||||
visible = false
|
|
||||||
position = Vector2(960, 896)
|
|
||||||
|
|
|
||||||
19
scenes/ScoreOverview/score_overview.gd
Normal file
19
scenes/ScoreOverview/score_overview.gd
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
@onready var score = $VBoxContainer3/VBoxContainer2/ScoreValue
|
||||||
|
@onready var time = $VBoxContainer3/VBoxContainer/TimeValue
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
score.text = str(GLOBAL.points)
|
||||||
|
time.text = str(GLOBAL.time)
|
||||||
|
GLOBAL.resetGame()
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func _on_left_button_pressed() -> void:
|
||||||
|
get_parent().loadGrid()
|
||||||
72
scenes/ScoreOverview/score_overview.tscn
Normal file
72
scenes/ScoreOverview/score_overview.tscn
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
[gd_scene load_steps=6 format=3 uid="uid://crnamktl6ltt"]
|
||||||
|
|
||||||
|
[ext_resource type="Theme" uid="uid://1nebbd65iyce" path="res://Theme/main.tres" id="1_pyjb5"]
|
||||||
|
[ext_resource type="LabelSettings" uid="uid://cd783ubpcytc8" path="res://Theme/label.tres" id="2_4dys4"]
|
||||||
|
[ext_resource type="Script" path="res://scenes/ScoreOverview/score_overview.gd" id="2_vv54r"]
|
||||||
|
[ext_resource type="LabelSettings" uid="uid://5mlweyjje7c4" path="res://Theme/labelBig.tres" id="4_dfemu"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://ct4dkk00pyv6v" path="res://assets/Buttons/RotationLeft.png" id="5_xkigm"]
|
||||||
|
|
||||||
|
[node name="ScoreOverview" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
size_flags_horizontal = 6
|
||||||
|
size_flags_vertical = 6
|
||||||
|
theme = ExtResource("1_pyjb5")
|
||||||
|
script = ExtResource("2_vv54r")
|
||||||
|
|
||||||
|
[node name="VBoxContainer3" type="VBoxContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -166.0
|
||||||
|
offset_top = -182.0
|
||||||
|
offset_right = 166.0
|
||||||
|
offset_bottom = 182.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="VBoxContainer2" type="VBoxContainer" parent="VBoxContainer3"]
|
||||||
|
layout_mode = 2
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Score" type="Label" parent="VBoxContainer3/VBoxContainer2"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Your Score"
|
||||||
|
label_settings = ExtResource("2_4dys4")
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="ScoreValue" type="Label" parent="VBoxContainer3/VBoxContainer2"]
|
||||||
|
layout_mode = 2
|
||||||
|
label_settings = ExtResource("4_dfemu")
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer3"]
|
||||||
|
layout_mode = 2
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Time" type="Label" parent="VBoxContainer3/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Time Left"
|
||||||
|
label_settings = ExtResource("2_4dys4")
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="TimeValue" type="Label" parent="VBoxContainer3/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
label_settings = ExtResource("4_dfemu")
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="left_Button" type="Button" parent="VBoxContainer3"]
|
||||||
|
layout_mode = 2
|
||||||
|
action_mode = 0
|
||||||
|
text = "Play Again"
|
||||||
|
icon = ExtResource("5_xkigm")
|
||||||
|
expand_icon = true
|
||||||
|
|
||||||
|
[connection signal="pressed" from="VBoxContainer3/left_Button" to="." method="_on_left_button_pressed"]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue