t-spin only if last movement is a rotation
This commit is contained in:
parent
69a21fe12f
commit
6e9f5659ae
@ -75,10 +75,9 @@ func piece_locked(lines, t_spin):
|
||||
flash_text.print(LINES_CLEARED_NAMES[lines])
|
||||
elif t_spin:
|
||||
flash_text.print(t_spin)
|
||||
ds = SCORES[lines][t_spin]
|
||||
goal -= ds
|
||||
goal -= SCORES[lines][""]
|
||||
$VBC/Goal.text = str(goal)
|
||||
ds *= 100 * level
|
||||
ds = 100 * level * SCORES[lines][t_spin]
|
||||
flash_text.print(str(ds))
|
||||
score += ds
|
||||
$VBC/Score.text = str(score)
|
||||
|
@ -8,14 +8,14 @@ const T_SLOT = [
|
||||
]
|
||||
|
||||
func t_spin():
|
||||
var center = to_global(minoes[0].translation)
|
||||
var a = not grid_map.is_free_cell(center + T_SLOT[orientation])
|
||||
var b = not grid_map.is_free_cell(center + T_SLOT[(1+orientation)%4])
|
||||
var c = not grid_map.is_free_cell(center + T_SLOT[(3+orientation)%4])
|
||||
var d = not grid_map.is_free_cell(center + T_SLOT[(2+orientation)%4])
|
||||
if rotation_point_5_used or (a and b and (c or d)):
|
||||
return "T-SPIN"
|
||||
elif c and d and (a or b):
|
||||
return "MINI T-SPIN"
|
||||
else:
|
||||
return ""
|
||||
if rotated_last:
|
||||
var center = to_global(minoes[0].translation)
|
||||
var a = not grid_map.is_free_cell(center + T_SLOT[orientation])
|
||||
var b = not grid_map.is_free_cell(center + T_SLOT[(1+orientation)%4])
|
||||
var c = not grid_map.is_free_cell(center + T_SLOT[(3+orientation)%4])
|
||||
var d = not grid_map.is_free_cell(center + T_SLOT[(2+orientation)%4])
|
||||
if rotation_point_5_used or (a and b and (c or d)):
|
||||
return "T-SPIN"
|
||||
elif c and d and (a or b):
|
||||
return "MINI T-SPIN"
|
||||
return ""
|
@ -75,6 +75,7 @@ var grid_map
|
||||
var lock_delay
|
||||
var orientation = 0
|
||||
var rotation_point_5_used = false
|
||||
var rotated_last = false
|
||||
|
||||
func _ready():
|
||||
for i in range(NB_MINOES):
|
||||
@ -96,18 +97,19 @@ func move(movement):
|
||||
if grid_map.possible_positions(get_translations(), movement):
|
||||
translate(movement)
|
||||
lock_delay.start()
|
||||
rotated_last = false
|
||||
return true
|
||||
return false
|
||||
|
||||
func rotate(direction):
|
||||
var t = get_translations()
|
||||
var rotated_translations = [t[0]]
|
||||
var translations = get_translations()
|
||||
var rotated_translations = [translations[0]]
|
||||
var center = translations[0]
|
||||
for i in range(1, NB_MINOES):
|
||||
var v = t[i]
|
||||
v -= t[0]
|
||||
v = Vector3(-1*direction*v.y, direction*v.x, 0)
|
||||
v += t[0]
|
||||
rotated_translations.append(v)
|
||||
var rt = translations[i] - center
|
||||
rt = Vector3(-1*direction*rt.y, direction*rt.x, 0)
|
||||
rt += center
|
||||
rotated_translations.append(rt)
|
||||
var movements = SUPER_ROTATION_SYSTEM[orientation][direction]
|
||||
for i in range(movements.size()):
|
||||
if grid_map.possible_positions(rotated_translations, movements[i]):
|
||||
@ -117,6 +119,7 @@ func rotate(direction):
|
||||
lock_delay.start()
|
||||
if i == 4:
|
||||
rotation_point_5_used = true
|
||||
rotated_last = true
|
||||
return true
|
||||
return false
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user