midi move
This commit is contained in:
parent
0f8ac8d6ea
commit
3c5fc96be3
@ -55,6 +55,7 @@ func _on_Start_start(level):
|
|||||||
remove_child(held_piece)
|
remove_child(held_piece)
|
||||||
held_piece = null
|
held_piece = null
|
||||||
current_piece_held = false
|
current_piece_held = false
|
||||||
|
autoshift_action = ""
|
||||||
next_piece = random_piece()
|
next_piece = random_piece()
|
||||||
new_piece()
|
new_piece()
|
||||||
$MidiPlayer.position = 0
|
$MidiPlayer.position = 0
|
||||||
@ -68,7 +69,6 @@ func new_piece():
|
|||||||
current_piece = next_piece
|
current_piece = next_piece
|
||||||
current_piece.translation = START_POSITION
|
current_piece.translation = START_POSITION
|
||||||
current_piece.emit_trail(true)
|
current_piece.emit_trail(true)
|
||||||
autoshift_action = ""
|
|
||||||
next_piece = random_piece()
|
next_piece = random_piece()
|
||||||
next_piece.translation = NEXT_POSITION
|
next_piece.translation = NEXT_POSITION
|
||||||
if move(THERE):
|
if move(THERE):
|
||||||
@ -126,9 +126,11 @@ 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)
|
if rotate(Tetromino.CLOCKWISE):
|
||||||
|
$MidiPlayer.move()
|
||||||
if event.is_action_pressed("rotate_counterclockwise"):
|
if event.is_action_pressed("rotate_counterclockwise"):
|
||||||
rotate(Tetromino.COUNTERCLOCKWISE)
|
if rotate(Tetromino.COUNTERCLOCKWISE):
|
||||||
|
$MidiPlayer.move()
|
||||||
if event.is_action_pressed("hold"):
|
if event.is_action_pressed("hold"):
|
||||||
hold()
|
hold()
|
||||||
|
|
||||||
@ -142,7 +144,9 @@ func _on_AutoShiftTimer_timeout():
|
|||||||
process_autoshift()
|
process_autoshift()
|
||||||
|
|
||||||
func process_autoshift():
|
func process_autoshift():
|
||||||
if move(movements[autoshift_action]) and autoshift_action == "soft_drop":
|
if move(movements[autoshift_action]):
|
||||||
|
$MidiPlayer.move()
|
||||||
|
if autoshift_action == "soft_drop":
|
||||||
emit_signal("piece_dropped", 1)
|
emit_signal("piece_dropped", 1)
|
||||||
|
|
||||||
func hard_drop():
|
func hard_drop():
|
||||||
|
@ -3,12 +3,13 @@ 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)
|
mute_channels(LINE_CLEAR_CHANNELS+MOVE_CHANNELS)
|
||||||
|
|
||||||
func _init_channel( ):
|
func _init_channel( ):
|
||||||
._init_channel()
|
._init_channel()
|
||||||
@ -52,3 +53,7 @@ func _on_Main_piece_locked(lines, t_spin):
|
|||||||
|
|
||||||
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)
|
Loading…
x
Reference in New Issue
Block a user