Revert "prepare rotate to be moved in main class"
This reverts commit a8dced21f1b66b93704a19f8c9d9604ccf7a284c.
This commit is contained in:
parent
a8dced21f1
commit
11e6e07098
@ -1,5 +1,5 @@
|
|||||||
extends "Tetromino.gd"
|
extends "Tetromino.gd"
|
||||||
|
|
||||||
const CLOCKWISE = -1
|
func rotate(direction):
|
||||||
const COUNTERCLOCKWISE = 1
|
return false
|
||||||
const SUPER_ROTATION_SYSTEM = [{CLOCKWISE: [], COUNTERCLOCKWISE: []}]
|
|
@ -101,24 +101,24 @@ func move(movement):
|
|||||||
return false
|
return false
|
||||||
|
|
||||||
func rotate(direction):
|
func rotate(direction):
|
||||||
var rotations = SUPER_ROTATION_SYSTEM[orientation][direction]
|
var t = get_translations()
|
||||||
if rotations:
|
var rotated_translations = [t[0]]
|
||||||
var translations = get_translations()
|
for i in range(1, NB_MINOES):
|
||||||
var rotated_translations = [translations[0]]
|
var v = t[i]
|
||||||
for i in range(1, NB_MINOES):
|
v -= t[0]
|
||||||
var rotated_translation = translations[i] - translations[0]
|
v = Vector3(-1*direction*v.y, direction*v.x, 0)
|
||||||
rotated_translation = Vector3(-1*direction*rotated_translation.y, direction*rotated_translation.x, 0)
|
v += t[0]
|
||||||
rotated_translation += translations[0]
|
rotated_translations.append(v)
|
||||||
rotated_translations.append(rotated_translation)
|
var movements = SUPER_ROTATION_SYSTEM[orientation][direction]
|
||||||
for i in range(rotations.size()):
|
for i in range(movements.size()):
|
||||||
if grid_map.possible_positions(rotated_translations, rotations[i]):
|
if grid_map.possible_positions(rotated_translations, movements[i]):
|
||||||
orientation = (orientation - direction) % NB_MINOES
|
orientation = (orientation - direction) % NB_MINOES
|
||||||
set_translations(rotated_translations)
|
set_translations(rotated_translations)
|
||||||
translate(rotations[i])
|
translate(movements[i])
|
||||||
lock_delay.start()
|
lock_delay.start()
|
||||||
if i == 4:
|
if i == 4:
|
||||||
rotation_point_5_used = true
|
rotation_point_5_used = true
|
||||||
return true
|
return true
|
||||||
return false
|
return false
|
||||||
|
|
||||||
func t_spin():
|
func t_spin():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user