commit
This commit is contained in:
parent
e45c31a2c6
commit
2b86cdec5c
@ -83,10 +83,12 @@ func random_piece():
|
|||||||
add_child(piece)
|
add_child(piece)
|
||||||
return piece
|
return piece
|
||||||
|
|
||||||
func _on_Stats_level_up():
|
func _on_Stats_level_up(level):
|
||||||
$DropTimer.wait_time = pow(0.8 - (($Stats.level - 1) * 0.007), $Stats.level - 1)
|
if level <= 15:
|
||||||
if $Stats.level > 15:
|
$DropTimer.wait_time = pow(0.8 - ((level - 1) * 0.007), level - 1)
|
||||||
$LockDelay.wait_time = 0.5 * pow(0.9, $Stats.level-15)
|
else:
|
||||||
|
$DropTimer.wait_time = 0.01
|
||||||
|
$LockDelay.wait_time = 0.5 * pow(0.9, level-15)
|
||||||
|
|
||||||
func _unhandled_input(event):
|
func _unhandled_input(event):
|
||||||
if event.is_action_pressed("pause"):
|
if event.is_action_pressed("pause"):
|
||||||
@ -95,7 +97,7 @@ func _unhandled_input(event):
|
|||||||
elif $controls_ui.enable_resume:
|
elif $controls_ui.enable_resume:
|
||||||
resume()
|
resume()
|
||||||
if event.is_action_pressed("toggle_fullscreen"):
|
if event.is_action_pressed("toggle_fullscreen"):
|
||||||
OS.window_fullscreen = !OS.window_fullscreen
|
OS.window_fullscreen = not OS.window_fullscreen
|
||||||
if playing:
|
if playing:
|
||||||
if autoshift_action and event.is_action_released(autoshift_action):
|
if autoshift_action and event.is_action_released(autoshift_action):
|
||||||
$AutoShiftDelay.stop()
|
$AutoShiftDelay.stop()
|
||||||
@ -134,9 +136,8 @@ func _on_AutoShiftTimer_timeout():
|
|||||||
process_autoshift()
|
process_autoshift()
|
||||||
|
|
||||||
func process_autoshift():
|
func process_autoshift():
|
||||||
if move(movements[autoshift_action]):
|
var moved = move(movements[autoshift_action])
|
||||||
$MidiPlayer.move()
|
if moved and (autoshift_action == "soft_drop"):
|
||||||
if autoshift_action == "soft_drop":
|
|
||||||
$Stats.piece_dropped(1)
|
$Stats.piece_dropped(1)
|
||||||
|
|
||||||
func hard_drop():
|
func hard_drop():
|
||||||
@ -144,7 +145,6 @@ func hard_drop():
|
|||||||
while move(movements["soft_drop"]):
|
while move(movements["soft_drop"]):
|
||||||
score += 2
|
score += 2
|
||||||
$Stats.piece_dropped(score)
|
$Stats.piece_dropped(score)
|
||||||
$MidiPlayer.move()
|
|
||||||
$LockDelay.stop()
|
$LockDelay.stop()
|
||||||
lock()
|
lock()
|
||||||
|
|
||||||
@ -157,7 +157,6 @@ func move(movement):
|
|||||||
func rotate(direction):
|
func rotate(direction):
|
||||||
if current_piece.rotate(direction):
|
if current_piece.rotate(direction):
|
||||||
$LockDelay.start()
|
$LockDelay.start()
|
||||||
$MidiPlayer.move()
|
|
||||||
|
|
||||||
func _on_DropTimer_timeout():
|
func _on_DropTimer_timeout():
|
||||||
move(movements["soft_drop"])
|
move(movements["soft_drop"])
|
||||||
@ -236,7 +235,7 @@ func _notification(what):
|
|||||||
match what:
|
match what:
|
||||||
MainLoop.NOTIFICATION_WM_FOCUS_OUT:
|
MainLoop.NOTIFICATION_WM_FOCUS_OUT:
|
||||||
if playing:
|
if playing:
|
||||||
pause($controls_ui.visible)
|
pause($controls_ui)
|
||||||
MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
|
MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
|
||||||
save_user_data()
|
save_user_data()
|
||||||
get_tree().quit()
|
get_tree().quit()
|
||||||
|
@ -3,13 +3,12 @@ extends "midi/MidiPlayer.gd"
|
|||||||
const Tetromino = preload("res://Tetrominos/Tetromino.gd")
|
const Tetromino = preload("res://Tetrominos/Tetromino.gd")
|
||||||
|
|
||||||
const LINE_CLEAR_CHANNELS = [2, 6]
|
const LINE_CLEAR_CHANNELS = [2, 6]
|
||||||
const MOVE_CHANNELS = []
|
|
||||||
|
|
||||||
var muted_events = []
|
var muted_events = []
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
._ready()
|
._ready()
|
||||||
mute_channels(LINE_CLEAR_CHANNELS+MOVE_CHANNELS)
|
mute_channels(LINE_CLEAR_CHANNELS)
|
||||||
|
|
||||||
func _init_channel( ):
|
func _init_channel( ):
|
||||||
._init_channel()
|
._init_channel()
|
||||||
@ -52,7 +51,3 @@ func piece_locked(lines):
|
|||||||
|
|
||||||
func _on_LineCLearTimer_timeout():
|
func _on_LineCLearTimer_timeout():
|
||||||
mute_channels(LINE_CLEAR_CHANNELS)
|
mute_channels(LINE_CLEAR_CHANNELS)
|
||||||
|
|
||||||
func move():
|
|
||||||
unmute_channels(MOVE_CHANNELS)
|
|
||||||
mute_channels(MOVE_CHANNELS)
|
|
@ -18,7 +18,7 @@ var time
|
|||||||
var combos
|
var combos
|
||||||
|
|
||||||
signal flash_text(text)
|
signal flash_text(text)
|
||||||
signal level_up
|
signal level_up(level)
|
||||||
|
|
||||||
func new_game(start_level):
|
func new_game(start_level):
|
||||||
level = start_level - 1
|
level = start_level - 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user