Start screen

This commit is contained in:
adrienmalin 2019-01-03 20:59:47 +01:00
parent ff9cb32d15
commit 9b1f223abe
12 changed files with 361 additions and 135 deletions

View File

@ -17,6 +17,10 @@ func _ready():
add_child(exploding_lines[y])
exploding_lines[y].translation = Vector3(NB_COLLUMNS/2, y, 1)
func clear():
for position in get_used_cells():
set_cell_item(position.x, position.y, position.z, EMPTY_CELL)
func is_free_cell(position):
return (
0 <= position.x and position.x < NB_COLLUMNS

106
Main.gd
View File

@ -30,14 +30,13 @@ var current_piece_held = false
var autoshift_action = ""
var playing = true
var playing = false
signal piece_dropped(score)
signal piece_locked(lines, t_spin)
func _ready():
load_user_data()
new_game()
func load_user_data():
var save_game = File.new()
@ -49,26 +48,21 @@ func load_user_data():
$Stats/VBC/HighScore.text = str($Stats.high_score)
save_game.close()
func new_game():
$Stats.visible = true
func _on_Start_start(level):
$GridMap.clear()
if held_piece:
remove_child(held_piece)
held_piece = null
next_piece = random_piece()
new_piece()
$Stats.new_game()
$MidiPlayer.position = 0
$Start.visible = false
$Stats.new_game(level)
resume()
func random_piece():
if not random_bag:
random_bag = [
TetroI, TetroJ, TetroL, TetroO,
TetroS, TetroT, TetroZ
]
var choice = randi() % random_bag.size()
var piece = random_bag[choice].instance()
random_bag.remove(choice)
add_child(piece)
return piece
func new_piece():
if current_piece:
remove_child(current_piece)
current_piece = next_piece
current_piece.translation = START_POSITION
current_piece.emit_trail(true)
@ -82,10 +76,28 @@ func new_piece():
else:
game_over()
func random_piece():
if not random_bag:
random_bag = [
TetroI, TetroJ, TetroL, TetroO,
TetroS, TetroT, TetroZ
]
var choice = randi() % random_bag.size()
var piece = random_bag[choice].instance()
random_bag.remove(choice)
add_child(piece)
return piece
func _on_Stats_level_up():
$DropTimer.wait_time = pow(0.8 - (($Stats.level - 1) * 0.007), $Stats.level - 1)
if $Stats.level > 15:
$LockDelay.wait_time = 0.5 * pow(0.9, $Stats.level-15)
func _process(delta):
if Input.is_action_just_pressed("pause"):
if playing:
pause()
$controls_ui.visible = true
elif $controls_ui.enable_resume:
resume()
if playing:
@ -104,9 +116,11 @@ func _process(delta):
if Input.is_action_just_pressed("hard_drop"):
hard_drop()
if Input.is_action_just_pressed("rotate_clockwise"):
rotate(Tetromino.CLOCKWISE)
if rotate(Tetromino.CLOCKWISE):
$MidiPlayer.move()
if Input.is_action_just_pressed("rotate_counterclockwise"):
rotate(Tetromino.COUNTERCLOCKWISE)
if rotate(Tetromino.COUNTERCLOCKWISE):
$MidiPlayer.move()
if Input.is_action_just_pressed("hold"):
hold()
@ -121,10 +135,12 @@ func _on_AutoShiftTimer_timeout():
func process_autoshift_action():
if move(movements[autoshift_action]):
$MidiPlayer.move()
if autoshift_action == "soft_drop":
emit_signal("piece_dropped", 1)
func hard_drop():
$MidiPlayer.move()
var score = 0
while move(movements["soft_drop"]):
score += 2
@ -154,24 +170,22 @@ func _on_LockDelay_timeout():
func lock():
$GridMap.lock(current_piece)
remove_child(current_piece)
emit_signal("piece_locked", $GridMap.clear_lines(), current_piece.t_spin)
new_piece()
func hold():
if not current_piece_held:
current_piece_held = true
if held_piece:
var tmp = held_piece
held_piece = current_piece
current_piece = tmp
var swap = current_piece
current_piece = held_piece
held_piece = swap
held_piece.emit_trail(false)
held_piece.translation = HOLD_POSITION
if current_piece:
current_piece.translation = START_POSITION
current_piece.emit_trail(true)
else:
held_piece = current_piece
new_piece()
held_piece.emit_trail(false)
held_piece.translation = HOLD_POSITION
func resume():
playing = true
@ -179,38 +193,52 @@ func resume():
$LockDelay.start()
$Stats.time = OS.get_system_time_secs() - $Stats.time
$Stats/Clock.start()
$MidiPlayer.mute_channels($MidiPlayer.LINE_CLEAR_MIDI_CHANNELS)
$MidiPlayer.resume()
$controls_ui.visible = false
$Stats.visible = true
$GridMap.visible = true
$Backs.visible = true
current_piece.visible = true
if held_piece:
held_piece.visible = true
next_piece.visible = true
func pause(show_controls_ui=true):
func pause(hide=true):
playing = false
$Stats.time = OS.get_system_time_secs() - $Stats.time
if hide:
$Stats.visible = false
$GridMap.visible = false
$Backs.visible = false
current_piece.visible = false
if held_piece:
held_piece.visible = false
next_piece.visible = false
$MidiPlayer.stop()
$DropTimer.stop()
$LockDelay.stop()
$Stats.time = OS.get_system_time_secs() - $Stats.time
$Stats/Clock.stop()
if show_controls_ui:
$controls_ui.visible = true
$MidiPlayer.stop()
func game_over():
$FlashText.print("GAME\nOVER")
pause(false)
$ReplayButton.visible = true
func _on_ReplayButton_pressed():
pause()
$ReplayButton.visible = false
$Start.visible = true
func _notification(what):
match what:
MainLoop.NOTIFICATION_WM_FOCUS_OUT:
if playing:
pause()
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($Stats.high_score))
save_game.close()
func _on_Stats_level_up():
$DropTimer.wait_time = pow(0.8 - (($Stats.level - 1) * 0.007), $Stats.level - 1)
if $Stats.level > 15:
$LockDelay.wait_time = 0.5 * pow(0.9, $Stats.level-15)

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=2]
[gd_scene load_steps=21 format=2]
[ext_resource path="res://starmap_g8k.jpg" type="Texture" id=1]
[ext_resource path="res://Main.gd" type="Script" id=2]
@ -10,6 +10,8 @@
[ext_resource path="res://fonts/525-ROUN.TTF" type="DynamicFontData" id=8]
[ext_resource path="res://Stats.tscn" type="PackedScene" id=9]
[ext_resource path="res://controls.tscn" type="PackedScene" id=10]
[ext_resource path="res://fonts/Gamer.ttf" type="DynamicFontData" id=11]
[ext_resource path="res://Start.tscn" type="PackedScene" id=12]
[sub_resource type="PanoramaSky" id=1]
@ -170,7 +172,7 @@ subdivide_depth = 0
[sub_resource type="DynamicFont" id=6]
size = 50
size = 20
use_mipmaps = true
use_filter = false
font_data = ExtResource( 8 )
@ -219,6 +221,15 @@ tracks/2/keys = {
"values": [ Vector2( 0, 110 ), Vector2( 0, -50 ), Vector2( 0, -60 ), Vector2( 0, -100 ) ]
}
[sub_resource type="DynamicFont" id=8]
size = 20
use_mipmaps = false
use_filter = false
extra_spacing_bottom = 5
font_data = ExtResource( 11 )
_sections_unfolded = [ "Extra Spacing", "Font", "Settings" ]
[node name="Main" type="WorldEnvironment"]
environment = SubResource( 2 )
@ -271,6 +282,7 @@ _sections_unfolded = [ "Light", "Transform" ]
[node name="GridMap" type="GridMap" parent="." index="2"]
visible = false
theme = ExtResource( 3 )
cell_size = Vector3( 1, 1, 1 )
cell_octant_size = 8
@ -292,7 +304,12 @@ __meta__ = {
NB_LINES = 20
NB_COLLUMNS = 10
[node name="GridBack" type="MeshInstance" parent="." index="3"]
[node name="Backs" type="Spatial" parent="." index="3"]
editor/display_folded = true
visible = false
[node name="GridBack" type="MeshInstance" parent="Backs" index="0"]
transform = Transform( 10, 0, 0, 0, 20, 0, 0, 0, 0.1, 4.5, 9.5, -1 )
layers = 1
@ -309,7 +326,7 @@ skeleton = NodePath("..")
material/0 = null
_sections_unfolded = [ "Transform" ]
[node name="HoldBack" type="MeshInstance" parent="." index="4"]
[node name="HoldBack" type="MeshInstance" parent="Backs" index="1"]
transform = Transform( 7, 0, 0, 0, 7, 0, 0, 0, 0.1, -5, 16, -1 )
layers = 1
@ -326,7 +343,7 @@ skeleton = NodePath("..")
material/0 = null
_sections_unfolded = [ "Transform" ]
[node name="NextBack" type="MeshInstance" parent="." index="5"]
[node name="NextBack" type="MeshInstance" parent="Backs" index="2"]
transform = Transform( 7, 0, 0, 0, 7, 0, 0, 0, 0.1, 14, 16, -1 )
layers = 1
@ -343,35 +360,35 @@ skeleton = NodePath("..")
material/0 = null
_sections_unfolded = [ "Transform" ]
[node name="DropTimer" type="Timer" parent="." index="6"]
[node name="DropTimer" type="Timer" parent="." index="4"]
process_mode = 1
wait_time = 1.0
one_shot = false
autostart = false
[node name="LockDelay" type="Timer" parent="." index="7"]
[node name="LockDelay" type="Timer" parent="." index="5"]
process_mode = 1
wait_time = 0.5
one_shot = true
autostart = false
[node name="AutoShiftDelay" type="Timer" parent="." index="8"]
[node name="AutoShiftDelay" type="Timer" parent="." index="6"]
process_mode = 1
wait_time = 0.17
one_shot = true
autostart = false
[node name="AutoShiftTimer" type="Timer" parent="." index="9"]
[node name="AutoShiftTimer" type="Timer" parent="." index="7"]
process_mode = 1
wait_time = 0.03
one_shot = false
autostart = false
[node name="MidiPlayer" parent="." index="10" instance=ExtResource( 5 )]
[node name="MidiPlayer" parent="." index="8" instance=ExtResource( 5 )]
script = ExtResource( 6 )
file = "res://midi/Tetris - Song A.mid"
@ -387,7 +404,7 @@ wait_time = 1.41
one_shot = true
autostart = false
[node name="FlashText" type="Control" parent="." index="11"]
[node name="FlashText" type="Control" parent="." index="9"]
anchor_left = 0.5
anchor_top = 0.5
@ -411,10 +428,9 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 1.0
margin_top = -100.0
margin_right = 501.0
margin_bottom = 400.0
margin_top = -50.0
margin_right = 500.0
margin_bottom = 450.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
@ -422,7 +438,7 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
custom_fonts/font = SubResource( 6 )
custom_colors/font_color = Color( 0.445404, 0.710476, 0.820313, 0 )
custom_colors/font_color = Color( 0.445404, 0.710476, 0.820313, 0.533765 )
align = 1
valign = 1
percent_visible = 1.0
@ -441,20 +457,51 @@ anims/Flash = SubResource( 7 )
blend_times = [ ]
_sections_unfolded = [ "Playback Options" ]
[node name="Stats" parent="." index="12" instance=ExtResource( 9 )]
[node name="Stats" parent="." index="10" instance=ExtResource( 9 )]
visible = false
[node name="controls_ui" parent="." index="13" instance=ExtResource( 10 )]
[node name="controls_ui" parent="." index="11" instance=ExtResource( 10 )]
visible = false
[node name="ReplayButton" type="Button" parent="." index="12"]
visible = false
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -100.0
margin_top = -60.0
margin_right = -27.0
margin_bottom = -26.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
custom_fonts/font = SubResource( 8 )
custom_colors/font_color = Color( 1, 1, 1, 1 )
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "REPLAY"
flat = false
align = 1
_sections_unfolded = [ "Margin", "custom_colors", "custom_fonts" ]
[node name="Start" parent="." index="13" instance=ExtResource( 12 )]
[connection signal="piece_dropped" from="." to="Stats" method="_on_Main_piece_dropped"]
[connection signal="piece_locked" from="." to="Stats" method="_on_Main_piece_locked"]
[connection signal="piece_locked" from="." to="MidiPlayer" method="_on_Main_piece_locked"]
[connection signal="piece_locked" from="." to="Stats" method="_on_Main_piece_locked"]
[connection signal="timeout" from="DropTimer" to="." method="_on_DropTimer_timeout"]
[connection signal="timeout" from="LockDelay" to="." method="_on_LockDelay_timeout"]
@ -471,4 +518,8 @@ visible = false
[connection signal="level_up" from="Stats" to="." method="_on_Stats_level_up"]
[connection signal="pressed" from="ReplayButton" to="." method="_on_ReplayButton_pressed"]
[connection signal="start" from="Start" to="." method="_on_Start_start"]

View File

@ -1,19 +1,43 @@
extends "midi/MidiPlayer.gd"
const LINE_CLEAR_MIDI_CHANNELS = [2, 6]
const Tetromino = preload("res://Tetrominos/Tetromino.gd")
const LINE_CLEAR_CHANNELS = [2, 6]
const MOVE_CHANNELS = [3]
func _ready():
mute_channels(MOVE_CHANNELS+LINE_CLEAR_CHANNELS)
resume()
func resume():
play(position)
func mute_channels(channels):
for channel_id in channels:
channel_mute[channel_id] = true
func unmute_channels(channels):
for channel_id in channels:
channel_mute[channel_id] = false
for note in muted_events[channel_id]:
_process_track_event_note_on(channel_status[channel_id], muted_events[channel_id][note])
func move():
unmute_channels(MOVE_CHANNELS)
mute_channels(MOVE_CHANNELS)
func _on_Main_piece_locked(lines, t_spin):
if lines or t_spin:
if lines == Tetromino.NB_MINOES:
for channel in LINE_CLEAR_MIDI_CHANNELS:
for channel in LINE_CLEAR_CHANNELS:
channel_status[channel].vomume = 127
$LineCLearTimer.wait_time = 0.86
else:
for channel in LINE_CLEAR_MIDI_CHANNELS:
for channel in LINE_CLEAR_CHANNELS:
channel_status[channel].vomume = 100
$LineCLearTimer.wait_time = 0.43
unmute_channels(LINE_CLEAR_MIDI_CHANNELS)
unmute_channels(LINE_CLEAR_CHANNELS)
$LineCLearTimer.start()
func _on_LineCLearTimer_timeout():
mute_channels(LINE_CLEAR_MIDI_CHANNELS)
mute_channels(LINE_CLEAR_CHANNELS)

6
Start.gd Normal file
View File

@ -0,0 +1,6 @@
extends Control
signal start(level)
func _on_PlayButton_pressed():
emit_signal("start", $SpinBox.value)

123
Start.tscn Normal file
View File

@ -0,0 +1,123 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://Start.gd" type="Script" id=1]
[ext_resource path="res://fonts/TitleFont.tres" type="DynamicFont" id=2]
[ext_resource path="res://fonts/Gamer.ttf" type="DynamicFontData" id=3]
[ext_resource path="res://fonts/ButtonFont.tres" type="DynamicFont" id=4]
[sub_resource type="DynamicFont" id=1]
size = 20
use_mipmaps = false
use_filter = false
font_data = ExtResource( 3 )
_sections_unfolded = [ "Extra Spacing", "Font", "Font/fallback", "Settings" ]
[sub_resource type="Theme" id=2]
default_font = SubResource( 1 )
[node name="Start" type="Control"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -20.0
margin_top = -20.0
margin_right = 20.0
margin_bottom = 20.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
script = ExtResource( 1 )
[node name="Label" type="Label" parent="." index="0"]
anchor_left = 0.5
anchor_top = 0.0
anchor_right = 0.5
anchor_bottom = 0.0
margin_left = -250.0
margin_top = -100.0
margin_right = 250.0
margin_bottom = -26.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
custom_fonts/font = ExtResource( 2 )
custom_colors/font_color = Color( 0.443137, 0.709804, 0.819608, 0.533333 )
custom_colors/font_color_shadow = Color( 1, 1, 1, 0.101333 )
text = "TETRIS
3000"
align = 1
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
_sections_unfolded = [ "custom_colors", "custom_fonts" ]
[node name="SpinBox" type="SpinBox" parent="." index="1"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -78.0
margin_top = -20.0
margin_right = 118.0
margin_bottom = 17.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
theme = SubResource( 2 )
min_value = 1.0
max_value = 15.0
step = 1.0
page = 0.0
value = 1.0
exp_edit = false
rounded = false
editable = true
prefix = "Level "
suffix = ""
_sections_unfolded = [ "Margin", "Theme" ]
[node name="PlayButton" type="Button" parent="." index="2"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -80.0
margin_top = 29.0
margin_right = 90.0
margin_bottom = 69.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
custom_fonts/font = ExtResource( 4 )
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "Play"
flat = false
align = 1
_sections_unfolded = [ "custom_fonts" ]
[connection signal="pressed" from="PlayButton" to="." method="_on_PlayButton_pressed"]

View File

@ -20,11 +20,13 @@ var combos
signal flash_text(text)
signal level_up
func new_game():
level = 0
func new_game(start_level):
level = start_level - 1
goal = 0
score = 0
$VBC/Score.text = str(score)
time = 0
$VBC/Time.text = "0:00:00"
combos = -1
new_level()
@ -37,6 +39,9 @@ func new_level():
emit_signal("level_up")
func _on_Clock_timeout():
show_time()
func show_time():
var time_elapsed = OS.get_system_time_secs() - time
var seconds = time_elapsed % 60
var minutes = int(time_elapsed/60) % 60

View File

@ -155,6 +155,7 @@ align = 2
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
_sections_unfolded = [ "custom_colors" ]
[node name="Label3" type="Label" parent="VBC" index="4"]

View File

@ -1,16 +1,9 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=6 format=2]
[ext_resource path="res://controls.gd" type="Script" id=1]
[ext_resource path="res://fonts/525-ROUN.TTF" type="DynamicFontData" id=2]
[ext_resource path="res://fonts/TitleFont.tres" type="DynamicFont" id=2]
[ext_resource path="res://fonts/Gamer.ttf" type="DynamicFontData" id=3]
[sub_resource type="DynamicFont" id=1]
size = 30
use_mipmaps = false
use_filter = false
font_data = ExtResource( 2 )
_sections_unfolded = [ "Font", "Settings" ]
[ext_resource path="res://fonts/ButtonFont.tres" type="DynamicFont" id=4]
[sub_resource type="DynamicFont" id=2]
@ -22,15 +15,6 @@ extra_spacing_bottom = -4
font_data = ExtResource( 3 )
_sections_unfolded = [ "Extra Spacing", "Font", "Settings" ]
[sub_resource type="DynamicFont" id=3]
size = 20
use_mipmaps = false
use_filter = false
extra_spacing_top = -4
font_data = ExtResource( 3 )
_sections_unfolded = [ "Extra Spacing", "Font", "Settings" ]
[node name="controls_ui" type="Control"]
anchor_left = 0.5
@ -52,25 +36,7 @@ __meta__ = {
"__editor_plugin_screen__": "2D"
}
[node name="ColorRect" type="ColorRect" parent="." index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = -2990.0
margin_top = -1560.0
margin_right = 2720.0
margin_bottom = 1060.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
color = Color( 0.0816994, 0.0912621, 0.115234, 1 )
[node name="pause" type="Label" parent="." index="1"]
[node name="pause" type="Label" parent="." index="0"]
anchor_left = 0.0
anchor_top = 0.0
@ -86,15 +52,16 @@ mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 0
custom_fonts/font = SubResource( 1 )
custom_colors/font_color = Color( 0.443137, 0.709804, 0.819608, 1 )
custom_fonts/font = ExtResource( 2 )
custom_colors/font_color = Color( 0.443137, 0.709804, 0.819608, 0.533333 )
custom_colors/font_color_shadow = Color( 1, 1, 1, 0.0968627 )
text = "PAUSE"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
_sections_unfolded = [ "custom_colors", "custom_fonts" ]
[node name="bindings" type="Control" parent="." index="2"]
[node name="bindings" type="Control" parent="." index="1"]
anchor_left = 0.0
anchor_top = 0.0
@ -143,6 +110,7 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 0
custom_fonts/font = SubResource( 2 )
custom_colors/font_color = Color( 0.752941, 0.921569, 0.988235, 1 )
text = "move
left"
valign = 1
@ -167,7 +135,7 @@ mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 2
custom_fonts/font = SubResource( 3 )
custom_fonts/font = ExtResource( 4 )
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
@ -210,6 +178,7 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 0
custom_fonts/font = SubResource( 2 )
custom_colors/font_color = Color( 0.752941, 0.921569, 0.988235, 1 )
text = "move
right"
valign = 1
@ -234,7 +203,7 @@ mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 2
custom_fonts/font = SubResource( 3 )
custom_fonts/font = ExtResource( 4 )
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
@ -274,6 +243,7 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 0
custom_fonts/font = SubResource( 2 )
custom_colors/font_color = Color( 0.752941, 0.921569, 0.988235, 1 )
text = "rotate
clockwise"
valign = 1
@ -297,13 +267,14 @@ mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 2
custom_fonts/font = SubResource( 3 )
custom_fonts/font = ExtResource( 4 )
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
flat = false
align = 1
_sections_unfolded = [ "custom_fonts" ]
[node name="rotate_counterclockwise" type="Control" parent="bindings" index="3"]
@ -339,6 +310,7 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 0
custom_fonts/font = SubResource( 2 )
custom_colors/font_color = Color( 0.752941, 0.921569, 0.988235, 1 )
text = "rotate
counter
clockwise"
@ -364,7 +336,7 @@ mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 2
custom_fonts/font = SubResource( 3 )
custom_fonts/font = ExtResource( 4 )
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
@ -405,6 +377,7 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 0
custom_fonts/font = SubResource( 2 )
custom_colors/font_color = Color( 0.752941, 0.921569, 0.988235, 1 )
text = "soft
drop"
valign = 1
@ -428,7 +401,7 @@ mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 2
custom_fonts/font = SubResource( 3 )
custom_fonts/font = ExtResource( 4 )
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
@ -470,6 +443,7 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 0
custom_fonts/font = SubResource( 2 )
custom_colors/font_color = Color( 0.752941, 0.921569, 0.988235, 1 )
text = "hard
drop"
valign = 1
@ -494,7 +468,7 @@ mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 2
custom_fonts/font = SubResource( 3 )
custom_fonts/font = ExtResource( 4 )
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
@ -534,6 +508,7 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 0
custom_fonts/font = SubResource( 2 )
custom_colors/font_color = Color( 0.752941, 0.921569, 0.988235, 1 )
text = "hold"
valign = 1
percent_visible = 1.0
@ -556,7 +531,7 @@ mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 2
custom_fonts/font = SubResource( 3 )
custom_fonts/font = ExtResource( 4 )
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
@ -598,6 +573,7 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 0
custom_fonts/font = SubResource( 2 )
custom_colors/font_color = Color( 0.752941, 0.921569, 0.988235, 1 )
text = "pause
resume"
valign = 1
@ -623,7 +599,7 @@ mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 2
custom_fonts/font = SubResource( 3 )
custom_fonts/font = ExtResource( 4 )
toggle_mode = false
enabled_focus_mode = 2
shortcut = null

13
fonts/ButtonFont.tres Normal file
View File

@ -0,0 +1,13 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://fonts/Gamer.ttf" type="DynamicFontData" id=1]
[resource]
size = 20
use_mipmaps = false
use_filter = false
extra_spacing_top = -4
font_data = ExtResource( 1 )
_sections_unfolded = [ "Extra Spacing", "Font", "Settings" ]

12
fonts/TitleFont.tres Normal file
View File

@ -0,0 +1,12 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://fonts/525-ROUN.TTF" type="DynamicFontData" id=1]
[resource]
size = 30
use_mipmaps = false
use_filter = false
font_data = ExtResource( 1 )
_sections_unfolded = [ "Font", "Settings" ]

View File

@ -1,7 +1,5 @@
extends Node
const Tetromino = preload("res://Tetrominos/Tetromino.gd")
const max_track = 16
const max_channel = 16
const max_note_number = 128
@ -407,18 +405,3 @@ func get_now_playing_polyphony( ):
if audio_stream_player.playing:
polyphony += 1
return polyphony
func resume():
play(position)
func mute_channels(channels):
for channel_id in channels:
channel_mute[channel_id] = true
func unmute_channels(channels):
for channel_id in channels:
channel_mute[channel_id] = false
for note in muted_events[channel_id]:
_process_track_event_note_on(channel_status[channel_id], muted_events[channel_id][note])