T-Spin & stats
This commit is contained in:
@ -7,19 +7,22 @@ const T_SLOT = [
|
||||
Vector3(-1, -1, 0)
|
||||
]
|
||||
|
||||
var rotation_point_5_used = false
|
||||
|
||||
func rotate(direction):
|
||||
var rotation_point = .rotate(direction)
|
||||
if rotation_point and t_spin != T_SPIN:
|
||||
if rotation_point:
|
||||
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[(2+orientation)%4])
|
||||
var d = not grid_map.is_free_cell(center + T_SLOT[(3+orientation)%4])
|
||||
if a and b and (c or d):
|
||||
t_spin = T_SPIN
|
||||
if a and b and (c or d) or rotation_point_5_used:
|
||||
t_spin = "T-SPIN"
|
||||
elif c and d and (a or b):
|
||||
if rotation_point == 5:
|
||||
t_spin = T_SPIN
|
||||
else:
|
||||
t_spin = MINI_T_SPIN
|
||||
t_spin = "MINI T-SPIN"
|
||||
else:
|
||||
t_spin = ""
|
||||
if rotation_point == 5:
|
||||
rotation_point_5_used = true
|
||||
return rotation_point
|
||||
@ -3,9 +3,6 @@ extends Spatial
|
||||
const NB_MINOES = 4
|
||||
const CLOCKWISE = -1
|
||||
const COUNTERCLOCKWISE = 1
|
||||
const NO_T_SPIN = 0
|
||||
const T_SPIN = 1
|
||||
const MINI_T_SPIN = 2
|
||||
const SUPER_ROTATION_SYSTEM = [
|
||||
{
|
||||
COUNTERCLOCKWISE: [
|
||||
@ -77,7 +74,7 @@ var minoes = []
|
||||
var grid_map
|
||||
var lock_delay
|
||||
var orientation = 0
|
||||
var t_spin = NO_T_SPIN
|
||||
var t_spin = ""
|
||||
|
||||
func _ready():
|
||||
randomize()
|
||||
|
||||
Reference in New Issue
Block a user