reorg
This commit is contained in:
parent
5b4008a55c
commit
e50e05558f
@ -11,8 +11,8 @@ var nb_collumns
|
|||||||
var nb_lines
|
var nb_lines
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
nb_collumns = int($Matrix.scale.x)
|
nb_collumns = int(get_parent().scale.x)
|
||||||
nb_lines = int($Matrix.scale.y)
|
nb_lines = int(get_parent().scale.y)
|
||||||
for y in range(nb_lines):
|
for y in range(nb_lines):
|
||||||
exploding_lines.append(ExplodingLine.instance())
|
exploding_lines.append(ExplodingLine.instance())
|
||||||
add_child(exploding_lines[y])
|
add_child(exploding_lines[y])
|
||||||
|
@ -9,8 +9,6 @@ const TetroS = preload("res://Tetrominos/TetroS.tscn")
|
|||||||
const TetroT = preload("res://Tetrominos/TetroT.tscn")
|
const TetroT = preload("res://Tetrominos/TetroT.tscn")
|
||||||
const TetroZ = preload("res://Tetrominos/TetroZ.tscn")
|
const TetroZ = preload("res://Tetrominos/TetroZ.tscn")
|
||||||
|
|
||||||
const password = "TETRIS 3000"
|
|
||||||
|
|
||||||
const THERE = Vector3(0, 0, 0)
|
const THERE = Vector3(0, 0, 0)
|
||||||
|
|
||||||
const movements = {
|
const movements = {
|
||||||
@ -30,21 +28,8 @@ var autoshift_action = ""
|
|||||||
|
|
||||||
var playing = false
|
var playing = false
|
||||||
|
|
||||||
func _ready():
|
|
||||||
load_user_data()
|
|
||||||
|
|
||||||
func load_user_data():
|
|
||||||
var save_game = File.new()
|
|
||||||
if not save_game.file_exists("user://data.save"):
|
|
||||||
$Stats.high_score = 0
|
|
||||||
else:
|
|
||||||
save_game.open_encrypted_with_pass("user://data.save", File.READ, password)
|
|
||||||
$Stats.high_score = int(save_game.get_line())
|
|
||||||
$Stats/VBC/HighScore.text = str($Stats.high_score)
|
|
||||||
save_game.close()
|
|
||||||
|
|
||||||
func new_game(level):
|
func new_game(level):
|
||||||
$GridMap.clear()
|
$Matrix/GridMap.clear()
|
||||||
if current_piece:
|
if current_piece:
|
||||||
remove_child(current_piece)
|
remove_child(current_piece)
|
||||||
if held_piece:
|
if held_piece:
|
||||||
@ -60,11 +45,11 @@ func new_game(level):
|
|||||||
|
|
||||||
func new_piece():
|
func new_piece():
|
||||||
current_piece = next_piece
|
current_piece = next_piece
|
||||||
current_piece.translation = $GridMap/Matrix/Position3D.translation
|
current_piece.translation = $Matrix/Position3D.translation
|
||||||
current_piece.emit_trail(true)
|
current_piece.emit_trail(true)
|
||||||
next_piece = random_piece()
|
next_piece = random_piece()
|
||||||
next_piece.translation = $GridMap/Next/Position3D.translation
|
next_piece.translation = $Next/Position3D.translation
|
||||||
if move(THERE):
|
if current_piece.move(THERE):
|
||||||
$DropTimer.start()
|
$DropTimer.start()
|
||||||
$LockDelay.start()
|
$LockDelay.start()
|
||||||
current_piece_held = false
|
current_piece_held = false
|
||||||
@ -120,9 +105,9 @@ func _unhandled_input(event):
|
|||||||
if event.is_action_pressed("hard_drop"):
|
if event.is_action_pressed("hard_drop"):
|
||||||
hard_drop()
|
hard_drop()
|
||||||
if event.is_action_pressed("rotate_clockwise"):
|
if event.is_action_pressed("rotate_clockwise"):
|
||||||
rotate(Tetromino.CLOCKWISE)
|
current_piece.rotate(Tetromino.CLOCKWISE)
|
||||||
if event.is_action_pressed("rotate_counterclockwise"):
|
if event.is_action_pressed("rotate_counterclockwise"):
|
||||||
rotate(Tetromino.COUNTERCLOCKWISE)
|
current_piece.rotate(Tetromino.COUNTERCLOCKWISE)
|
||||||
if event.is_action_pressed("hold"):
|
if event.is_action_pressed("hold"):
|
||||||
hold()
|
hold()
|
||||||
|
|
||||||
@ -136,38 +121,28 @@ func _on_AutoShiftTimer_timeout():
|
|||||||
process_autoshift()
|
process_autoshift()
|
||||||
|
|
||||||
func process_autoshift():
|
func process_autoshift():
|
||||||
var moved = move(movements[autoshift_action])
|
var moved = current_piece.move(movements[autoshift_action])
|
||||||
if moved and (autoshift_action == "soft_drop"):
|
if moved and (autoshift_action == "soft_drop"):
|
||||||
$Stats.piece_dropped(1)
|
$Stats.piece_dropped(1)
|
||||||
|
|
||||||
func hard_drop():
|
func hard_drop():
|
||||||
var score = 0
|
var score = 0
|
||||||
while move(movements["soft_drop"]):
|
while current_piece.move(movements["soft_drop"]):
|
||||||
score += 2
|
score += 2
|
||||||
$Stats.piece_dropped(score)
|
$Stats.piece_dropped(score)
|
||||||
$LockDelay.stop()
|
$LockDelay.stop()
|
||||||
lock()
|
lock()
|
||||||
|
|
||||||
func move(movement):
|
|
||||||
var moved = current_piece.move(movement)
|
|
||||||
if moved:
|
|
||||||
$LockDelay.start()
|
|
||||||
return moved
|
|
||||||
|
|
||||||
func rotate(direction):
|
|
||||||
if current_piece.rotate(direction):
|
|
||||||
$LockDelay.start()
|
|
||||||
|
|
||||||
func _on_DropTimer_timeout():
|
func _on_DropTimer_timeout():
|
||||||
move(movements["soft_drop"])
|
current_piece.move(movements["soft_drop"])
|
||||||
|
|
||||||
func _on_LockDelay_timeout():
|
func _on_LockDelay_timeout():
|
||||||
if not move(movements["soft_drop"]):
|
if not current_piece.move(movements["soft_drop"]):
|
||||||
lock()
|
lock()
|
||||||
|
|
||||||
func lock():
|
func lock():
|
||||||
if $GridMap.lock(current_piece):
|
if $Matrix/GridMap.lock(current_piece):
|
||||||
var lines_cleared = $GridMap.clear_lines()
|
var lines_cleared = $Matrix/GridMap.clear_lines()
|
||||||
$Stats.piece_locked(lines_cleared, current_piece.t_spin)
|
$Stats.piece_locked(lines_cleared, current_piece.t_spin)
|
||||||
if lines_cleared or current_piece.t_spin:
|
if lines_cleared or current_piece.t_spin:
|
||||||
$MidiPlayer.piece_locked(lines_cleared)
|
$MidiPlayer.piece_locked(lines_cleared)
|
||||||
@ -183,9 +158,9 @@ func hold():
|
|||||||
current_piece = held_piece
|
current_piece = held_piece
|
||||||
held_piece = swap
|
held_piece = swap
|
||||||
held_piece.emit_trail(false)
|
held_piece.emit_trail(false)
|
||||||
held_piece.translation = $GridMap/Hold/Position3D.translation
|
held_piece.translation = $Hold/Position3D.translation
|
||||||
if current_piece:
|
if current_piece:
|
||||||
current_piece.translation = $GridMap/Matrix/Position3D.translation
|
current_piece.translation = $Matrix/Position3D.translation
|
||||||
current_piece.emit_trail(true)
|
current_piece.emit_trail(true)
|
||||||
else:
|
else:
|
||||||
new_piece()
|
new_piece()
|
||||||
@ -199,7 +174,9 @@ func resume():
|
|||||||
$MidiPlayer.resume()
|
$MidiPlayer.resume()
|
||||||
$controls_ui.visible = false
|
$controls_ui.visible = false
|
||||||
$Stats.visible = true
|
$Stats.visible = true
|
||||||
$GridMap.visible = true
|
$Matrix.visible = true
|
||||||
|
$Hold.visible = true
|
||||||
|
$Next.visible = true
|
||||||
current_piece.visible = true
|
current_piece.visible = true
|
||||||
if held_piece:
|
if held_piece:
|
||||||
held_piece.visible = true
|
held_piece.visible = true
|
||||||
@ -217,7 +194,9 @@ func pause(gui=null):
|
|||||||
if gui:
|
if gui:
|
||||||
gui.visible = true
|
gui.visible = true
|
||||||
$Stats.visible = false
|
$Stats.visible = false
|
||||||
$GridMap.visible = false
|
$Matrix.visible = false
|
||||||
|
$Hold.visible = false
|
||||||
|
$Next.visible = false
|
||||||
current_piece.visible = false
|
current_piece.visible = false
|
||||||
if held_piece:
|
if held_piece:
|
||||||
held_piece.visible = false
|
held_piece.visible = false
|
||||||
@ -238,12 +217,3 @@ func _notification(what):
|
|||||||
MainLoop.NOTIFICATION_WM_FOCUS_OUT:
|
MainLoop.NOTIFICATION_WM_FOCUS_OUT:
|
||||||
if playing:
|
if playing:
|
||||||
pause($controls_ui)
|
pause($controls_ui)
|
||||||
MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
|
|
||||||
save_user_data()
|
|
||||||
get_tree().quit()
|
|
||||||
|
|
||||||
func save_user_data():
|
|
||||||
var save_game = File.new()
|
|
||||||
save_game.open_encrypted_with_pass("user://data.save", File.WRITE, password)
|
|
||||||
save_game.store_line(str($Stats.high_score))
|
|
||||||
save_game.close()
|
|
||||||
|
@ -234,7 +234,7 @@ _sections_unfolded = [ "Extra Spacing", "Font", "Settings" ]
|
|||||||
environment = SubResource( 2 )
|
environment = SubResource( 2 )
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="Sprite3D" type="Sprite3D" parent="." index="0"]
|
[node name="Background" type="Sprite3D" parent="." index="0"]
|
||||||
|
|
||||||
transform = Transform( 12.8, 0, 0, 0, 8.53, 0, 0, 0, 1, 5, 10, -32 )
|
transform = Transform( 12.8, 0, 0, 0, 8.53, 0, 0, 0, 1, 5, 10, -32 )
|
||||||
layers = 1
|
layers = 1
|
||||||
@ -311,9 +311,27 @@ directional_shadow_depth_range = 0
|
|||||||
directional_shadow_max_distance = 200.0
|
directional_shadow_max_distance = 200.0
|
||||||
_sections_unfolded = [ "Light", "Transform" ]
|
_sections_unfolded = [ "Light", "Transform" ]
|
||||||
|
|
||||||
[node name="GridMap" type="GridMap" parent="." index="3"]
|
[node name="Matrix" type="MeshInstance" parent="." index="3"]
|
||||||
|
|
||||||
|
transform = Transform( 10, 0, 0, 0, 20, 0, 0, 0, 1, 4.5, 9.5, 0 )
|
||||||
visible = false
|
visible = false
|
||||||
|
layers = 1
|
||||||
|
material_override = null
|
||||||
|
cast_shadow = 1
|
||||||
|
extra_cull_margin = 0.0
|
||||||
|
use_in_baked_light = false
|
||||||
|
lod_min_distance = 0.0
|
||||||
|
lod_min_hysteresis = 0.0
|
||||||
|
lod_max_distance = 0.0
|
||||||
|
lod_max_hysteresis = 0.0
|
||||||
|
mesh = SubResource( 4 )
|
||||||
|
skeleton = NodePath("..")
|
||||||
|
material/0 = null
|
||||||
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
|
[node name="GridMap" type="GridMap" parent="Matrix" index="0"]
|
||||||
|
|
||||||
|
transform = Transform( 0.1, 0, 0, 0, 0.05, 0, 0, 0, 1, -0.45, -0.475, 0 )
|
||||||
theme = ExtResource( 3 )
|
theme = ExtResource( 3 )
|
||||||
cell_size = Vector3( 1, 1, 1 )
|
cell_size = Vector3( 1, 1, 1 )
|
||||||
cell_octant_size = 8
|
cell_octant_size = 8
|
||||||
@ -333,31 +351,15 @@ __meta__ = {
|
|||||||
"_editor_floor_": Vector3( 0, -1, 0 )
|
"_editor_floor_": Vector3( 0, -1, 0 )
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Matrix" type="MeshInstance" parent="GridMap" index="0"]
|
[node name="Position3D" type="Position3D" parent="Matrix" index="1"]
|
||||||
|
|
||||||
transform = Transform( 10, 0, 0, 0, 20, 0, 0, 0, 1, 4.5, 9.5, 0 )
|
|
||||||
layers = 1
|
|
||||||
material_override = null
|
|
||||||
cast_shadow = 1
|
|
||||||
extra_cull_margin = 0.0
|
|
||||||
use_in_baked_light = false
|
|
||||||
lod_min_distance = 0.0
|
|
||||||
lod_min_hysteresis = 0.0
|
|
||||||
lod_max_distance = 0.0
|
|
||||||
lod_max_hysteresis = 0.0
|
|
||||||
mesh = SubResource( 4 )
|
|
||||||
skeleton = NodePath("..")
|
|
||||||
material/0 = null
|
|
||||||
_sections_unfolded = [ "Transform" ]
|
|
||||||
|
|
||||||
[node name="Position3D" type="Position3D" parent="GridMap/Matrix" index="0"]
|
|
||||||
|
|
||||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 20, 0 )
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 20, 0 )
|
||||||
_sections_unfolded = [ "Transform" ]
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
[node name="Hold" type="MeshInstance" parent="GridMap" index="1"]
|
[node name="Hold" type="MeshInstance" parent="." index="4"]
|
||||||
|
|
||||||
transform = Transform( 7, 0, 0, 0, 7, 0, 0, 0, 1, -5, 16, 0 )
|
transform = Transform( 7, 0, 0, 0, 7, 0, 0, 0, 1, -5, 16, 0 )
|
||||||
|
visible = false
|
||||||
layers = 1
|
layers = 1
|
||||||
material_override = null
|
material_override = null
|
||||||
cast_shadow = 1
|
cast_shadow = 1
|
||||||
@ -372,14 +374,15 @@ skeleton = NodePath("..")
|
|||||||
material/0 = null
|
material/0 = null
|
||||||
_sections_unfolded = [ "Transform" ]
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
[node name="Position3D" type="Position3D" parent="GridMap/Hold" index="0"]
|
[node name="Position3D" type="Position3D" parent="Hold" index="0"]
|
||||||
|
|
||||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 16, 0 )
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 16, 0 )
|
||||||
_sections_unfolded = [ "Transform" ]
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
[node name="Next" type="MeshInstance" parent="GridMap" index="2"]
|
[node name="Next" type="MeshInstance" parent="." index="5"]
|
||||||
|
|
||||||
transform = Transform( 7, 0, 0, 0, 7, 0, 0, 0, 1, 14, 16, 0 )
|
transform = Transform( 7, 0, 0, 0, 7, 0, 0, 0, 1, 14, 16, 0 )
|
||||||
|
visible = false
|
||||||
layers = 1
|
layers = 1
|
||||||
material_override = null
|
material_override = null
|
||||||
cast_shadow = 1
|
cast_shadow = 1
|
||||||
@ -394,40 +397,40 @@ skeleton = NodePath("..")
|
|||||||
material/0 = null
|
material/0 = null
|
||||||
_sections_unfolded = [ "Transform" ]
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
[node name="Position3D" type="Position3D" parent="GridMap/Next" index="0"]
|
[node name="Position3D" type="Position3D" parent="Next" index="0"]
|
||||||
|
|
||||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 13, 16, 0 )
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 13, 16, 0 )
|
||||||
_sections_unfolded = [ "Transform" ]
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
[node name="DropTimer" type="Timer" parent="." index="4"]
|
[node name="DropTimer" type="Timer" parent="." index="6"]
|
||||||
|
|
||||||
process_mode = 1
|
process_mode = 1
|
||||||
wait_time = 1.0
|
wait_time = 1.0
|
||||||
one_shot = false
|
one_shot = false
|
||||||
autostart = false
|
autostart = false
|
||||||
|
|
||||||
[node name="LockDelay" type="Timer" parent="." index="5"]
|
[node name="LockDelay" type="Timer" parent="." index="7"]
|
||||||
|
|
||||||
process_mode = 1
|
process_mode = 1
|
||||||
wait_time = 0.5
|
wait_time = 0.5
|
||||||
one_shot = true
|
one_shot = true
|
||||||
autostart = false
|
autostart = false
|
||||||
|
|
||||||
[node name="AutoShiftDelay" type="Timer" parent="." index="6"]
|
[node name="AutoShiftDelay" type="Timer" parent="." index="8"]
|
||||||
|
|
||||||
process_mode = 1
|
process_mode = 1
|
||||||
wait_time = 0.2
|
wait_time = 0.2
|
||||||
one_shot = true
|
one_shot = true
|
||||||
autostart = false
|
autostart = false
|
||||||
|
|
||||||
[node name="AutoShiftTimer" type="Timer" parent="." index="7"]
|
[node name="AutoShiftTimer" type="Timer" parent="." index="9"]
|
||||||
|
|
||||||
process_mode = 1
|
process_mode = 1
|
||||||
wait_time = 0.03
|
wait_time = 0.03
|
||||||
one_shot = false
|
one_shot = false
|
||||||
autostart = false
|
autostart = false
|
||||||
|
|
||||||
[node name="MidiPlayer" parent="." index="8" instance=ExtResource( 5 )]
|
[node name="MidiPlayer" parent="." index="10" instance=ExtResource( 5 )]
|
||||||
|
|
||||||
editor/display_folded = true
|
editor/display_folded = true
|
||||||
script = ExtResource( 6 )
|
script = ExtResource( 6 )
|
||||||
@ -444,7 +447,7 @@ wait_time = 1.41
|
|||||||
one_shot = true
|
one_shot = true
|
||||||
autostart = false
|
autostart = false
|
||||||
|
|
||||||
[node name="FlashText" type="Control" parent="." index="9"]
|
[node name="FlashText" type="Control" parent="." index="11"]
|
||||||
|
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
@ -498,7 +501,7 @@ anims/Flash = SubResource( 7 )
|
|||||||
blend_times = [ ]
|
blend_times = [ ]
|
||||||
_sections_unfolded = [ "Playback Options" ]
|
_sections_unfolded = [ "Playback Options" ]
|
||||||
|
|
||||||
[node name="Stats" parent="." index="10" instance=ExtResource( 9 )]
|
[node name="Stats" parent="." index="12" instance=ExtResource( 9 )]
|
||||||
|
|
||||||
visible = false
|
visible = false
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
@ -510,13 +513,13 @@ margin_top = -260.0
|
|||||||
margin_right = 130.0
|
margin_right = 130.0
|
||||||
margin_bottom = -50.0
|
margin_bottom = -50.0
|
||||||
|
|
||||||
[node name="controls_ui" parent="." index="11" instance=ExtResource( 10 )]
|
[node name="controls_ui" parent="." index="13" instance=ExtResource( 10 )]
|
||||||
|
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
[node name="Start" parent="." index="12" instance=ExtResource( 11 )]
|
[node name="Start" parent="." index="14" instance=ExtResource( 11 )]
|
||||||
|
|
||||||
[node name="ReplayButton" type="Button" parent="." index="13"]
|
[node name="ReplayButton" type="Button" parent="." index="15"]
|
||||||
|
|
||||||
visible = false
|
visible = false
|
||||||
anchor_left = 1.0
|
anchor_left = 1.0
|
||||||
|
@ -9,6 +9,7 @@ const SCORES = [
|
|||||||
]
|
]
|
||||||
const LINES_CLEARED_NAMES = ["", "SINGLE", "DOUBLE", "TRIPLE", "TETRIS"]
|
const LINES_CLEARED_NAMES = ["", "SINGLE", "DOUBLE", "TRIPLE", "TETRIS"]
|
||||||
const T_SPIN_NAMES = ["", "T-SPIN", "MINI T-SPIN"]
|
const T_SPIN_NAMES = ["", "T-SPIN", "MINI T-SPIN"]
|
||||||
|
const password = "TETRIS 3000"
|
||||||
|
|
||||||
var level
|
var level
|
||||||
var goal
|
var goal
|
||||||
@ -19,6 +20,19 @@ var combos
|
|||||||
|
|
||||||
signal flash_text(text)
|
signal flash_text(text)
|
||||||
signal level_up(level)
|
signal level_up(level)
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
load_user_data()
|
||||||
|
|
||||||
|
func load_user_data():
|
||||||
|
var save_game = File.new()
|
||||||
|
if not save_game.file_exists("user://data.save"):
|
||||||
|
high_score = 0
|
||||||
|
else:
|
||||||
|
save_game.open_encrypted_with_pass("user://data.save", File.READ, password)
|
||||||
|
high_score = int(save_game.get_line())
|
||||||
|
$VBC/HighScore.text = str(high_score)
|
||||||
|
save_game.close()
|
||||||
|
|
||||||
func new_game(start_level):
|
func new_game(start_level):
|
||||||
level = start_level - 1
|
level = start_level - 1
|
||||||
@ -86,3 +100,14 @@ func piece_locked(lines, t_spin):
|
|||||||
combos = -1
|
combos = -1
|
||||||
if goal <= 0:
|
if goal <= 0:
|
||||||
new_level()
|
new_level()
|
||||||
|
|
||||||
|
func _notification(what):
|
||||||
|
match what:
|
||||||
|
MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
|
||||||
|
save_user_data()
|
||||||
|
|
||||||
|
func save_user_data():
|
||||||
|
var save_game = File.new()
|
||||||
|
save_game.open_encrypted_with_pass("user://data.save", File.WRITE, password)
|
||||||
|
save_game.store_line(str(high_score))
|
||||||
|
save_game.close()
|
@ -11,7 +11,7 @@ use_filter = false
|
|||||||
font_data = ExtResource( 2 )
|
font_data = ExtResource( 2 )
|
||||||
_sections_unfolded = [ "Font", "Settings" ]
|
_sections_unfolded = [ "Font", "Settings" ]
|
||||||
|
|
||||||
[node name="Stats" type="MarginContainer"]
|
[node name="Stats" type="MarginContainer" index="0"]
|
||||||
|
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
|
@ -75,6 +75,7 @@ const SUPER_ROTATION_SYSTEM = [
|
|||||||
|
|
||||||
var minoes = []
|
var minoes = []
|
||||||
var grid_map
|
var grid_map
|
||||||
|
var lock_delay
|
||||||
var orientation = 0
|
var orientation = 0
|
||||||
var t_spin = NO_T_SPIN
|
var t_spin = NO_T_SPIN
|
||||||
|
|
||||||
@ -82,7 +83,8 @@ func _ready():
|
|||||||
randomize()
|
randomize()
|
||||||
for i in range(NB_MINOES):
|
for i in range(NB_MINOES):
|
||||||
minoes.append(get_node("Mino"+str(i)))
|
minoes.append(get_node("Mino"+str(i)))
|
||||||
grid_map = get_parent().get_node("GridMap")
|
grid_map = get_node("../Matrix/GridMap")
|
||||||
|
lock_delay = get_node("../LockDelay")
|
||||||
|
|
||||||
func set_translations(translations):
|
func set_translations(translations):
|
||||||
for i in range(NB_MINOES):
|
for i in range(NB_MINOES):
|
||||||
@ -97,6 +99,7 @@ func get_translations():
|
|||||||
func move(movement):
|
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()
|
||||||
return true
|
return true
|
||||||
return false
|
return false
|
||||||
|
|
||||||
@ -116,6 +119,7 @@ func rotate(direction):
|
|||||||
orientation %= NB_MINOES
|
orientation %= NB_MINOES
|
||||||
set_translations(rotated_translations)
|
set_translations(rotated_translations)
|
||||||
translate(movements[i])
|
translate(movements[i])
|
||||||
|
lock_delay.start()
|
||||||
return i+1
|
return i+1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user