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