hide on pause, T-SPIN on rotation 5

This commit is contained in:
adrienmalin
2019-01-02 03:00:47 +01:00
parent 85d26a98bd
commit 792db2f0c8
5 changed files with 35 additions and 25 deletions

View File

@ -8,13 +8,8 @@ const T_SLOT = [
]
func rotate(direction):
if .rotate(direction):
detect_t_spin()
return true
return false
func detect_t_spin():
if t_spin != T_SPIN:
var rotation_point = .rotate(direction)
if rotation_point and t_spin != 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])
@ -23,4 +18,8 @@ func detect_t_spin():
if a and b and (c or d):
t_spin = T_SPIN
elif c and d and (a or b):
t_spin = MINI_T_SPIN
if rotation_point == 5:
t_spin = T_SPIN
else:
t_spin = MINI_T_SPIN
return rotation_point

View File

@ -113,14 +113,14 @@ func move(movement):
func rotate(direction):
var rotated_positions = rotated_positions(direction)
var movements = SUPER_ROTATION_SYSTEM[orientation][direction]
for movement in movements:
if grid_map.possible_positions(rotated_positions, movement):
for i in range(movements.size()):
if grid_map.possible_positions(rotated_positions, movements[i]):
orientation -= direction
orientation %= NB_MINOES
apply_positions(rotated_positions)
translate(movement)
return true
return false
translate(movements[i])
return i+1
return 0
func emit_trail(emit):
var trail