Fixed Bugs; Added Score overview
This commit is contained in:
parent
fdfb6a7d39
commit
6d71780f36
9 changed files with 152 additions and 33 deletions
|
|
@ -36,9 +36,7 @@ func _ready() -> void:
|
|||
|
||||
func _physics_process(delta: float) -> void:
|
||||
|
||||
for i in getBlockGroupsList():
|
||||
if i != GLOBAL.currentUID:
|
||||
moveUidGroup(GLOBAL.Direction.BOTTOM, i)
|
||||
|
||||
var blockGroups = getBlockGroupsList()
|
||||
#if Input.is_action_pressed("down"):
|
||||
|
||||
|
|
@ -53,10 +51,10 @@ func _physics_process(delta: float) -> void:
|
|||
for i in blockGroups[GLOBAL.currentUID]:
|
||||
if i.turningPoint:
|
||||
if currentPattern != null:
|
||||
currentPattern.turn(GLOBAL.Direction.RIGHT,i.position-spawnpoint.position + Vector2(GLOBAL.GRID/2, GLOBAL.GRID/2))
|
||||
if not stopped:
|
||||
currentPattern.turn(GLOBAL.Direction.RIGHT,i.position-spawnpoint.position + Vector2(GLOBAL.GRID/2, GLOBAL.GRID/2))
|
||||
#turnBlocks()
|
||||
if turnTickTimer.is_stopped():
|
||||
print(5*delta)
|
||||
turnTickTimer.start(9*delta)
|
||||
|
||||
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]:
|
||||
if i.turningPoint:
|
||||
if currentPattern != null:
|
||||
currentPattern.turn(GLOBAL.Direction.LEFT,i.position-spawnpoint.position + Vector2(GLOBAL.GRID/2, GLOBAL.GRID/2))
|
||||
if not stopped:
|
||||
currentPattern.turn(GLOBAL.Direction.LEFT,i.position-spawnpoint.position + Vector2(GLOBAL.GRID/2, GLOBAL.GRID/2))
|
||||
#turnBlocks()
|
||||
if turnTickTimer.is_stopped():
|
||||
print(5*delta)
|
||||
turnTickTimer.start(9*delta)
|
||||
|
||||
if Input.is_action_just_pressed("left"):
|
||||
|
|
@ -174,6 +172,7 @@ func PlacePattern():
|
|||
block.modulate = newColor
|
||||
block.position = spawnpoint.position + i.position
|
||||
block.type = currentPattern.type
|
||||
block.expand = currentPattern.expand
|
||||
if i.turningPoint:
|
||||
block.turningPoint = true
|
||||
blocks.add_child(block)
|
||||
|
|
@ -188,8 +187,6 @@ func getNewPatterns():
|
|||
newPatterns.shuffle()
|
||||
newPatterns[0].expand = true
|
||||
newPatterns.shuffle()
|
||||
for i in newPatterns:
|
||||
i.expand = true
|
||||
patternsArray.append_array(newPatterns)
|
||||
|
||||
func turnBlocks():
|
||||
|
|
@ -209,7 +206,7 @@ func _on_turn_tick_timeout() -> void:
|
|||
func _on_ticker_timeout() -> void:
|
||||
stopped = true
|
||||
if getBlockedDirection(GLOBAL.Direction.BOTTOM, GLOBAL.currentUID):
|
||||
coyoteTimer.start(0.1)
|
||||
coyoteTimer.start(0.08)
|
||||
|
||||
|
||||
for i in getBlockGroupsList():
|
||||
|
|
@ -220,21 +217,21 @@ func _on_ticker_timeout() -> void:
|
|||
|
||||
|
||||
func _on_game_timer_timeout() -> void:
|
||||
if GLOBAL.time + 1 > 0:
|
||||
GLOBAL.time += 1
|
||||
#else:
|
||||
#GLOBAL.lose()
|
||||
if GLOBAL.time - 1 > 0:
|
||||
GLOBAL.time -= 1
|
||||
else:
|
||||
GLOBAL.lose()
|
||||
gameTimer.start(1)
|
||||
|
||||
|
||||
func _on_coyote_timer_timeout() -> void:
|
||||
if loseArea.get_overlapping_areas() != []:
|
||||
GLOBAL.lose()
|
||||
for i in $RowTests.get_children():
|
||||
for j in getBlockGroupsList():
|
||||
if j != GLOBAL.currentUID:
|
||||
moveUidGroup(GLOBAL.Direction.BOTTOM, i)
|
||||
stopped = true
|
||||
if loseArea.get_overlapping_areas() != []:
|
||||
GLOBAL.lose()
|
||||
if currentPattern.expand:
|
||||
if currentPattern.get_scale() != Vector2(2,2):
|
||||
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))
|
||||
#if await currentPattern.getCollidingBorder() != []:
|
||||
for i in await currentPattern.getCollidingBorder():
|
||||
if i.is_in_group("Floor"):
|
||||
currentPattern.position.y -= 64
|
||||
elif i.is_in_group("LeftBorder"):
|
||||
#if i.is_in_group("Floor"):
|
||||
#for j in range(1,3):
|
||||
#if not await currentPattern.getCollidingBorder() == []:
|
||||
#break
|
||||
#currentPattern.position.y -= 64
|
||||
if i.is_in_group("LeftBorder"):
|
||||
for j in range(1,8):
|
||||
if await currentPattern.getCollidingBorder() == []:
|
||||
break
|
||||
|
|
@ -295,6 +295,14 @@ func _on_coyote_timer_timeout() -> void:
|
|||
if i.isCompleted():
|
||||
for j in i.getRow():
|
||||
splitOphansUID(j.UID)
|
||||
GLOBAL.points += j.type
|
||||
if j.expand:
|
||||
GLOBAL.points += j.type * 2
|
||||
GLOBAL.time += j.type * 2
|
||||
elif not j.expand:
|
||||
GLOBAL.points += j.type
|
||||
GLOBAL.time += j.type
|
||||
j.queue_free()
|
||||
for j in getBlockGroupsList():
|
||||
if j != GLOBAL.currentUID:
|
||||
moveUidGroup(GLOBAL.Direction.BOTTOM, j)
|
||||
PlacePattern()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue