From 26fa6105a9cd0708a27e2888f53b02a05a1d3c1b Mon Sep 17 00:00:00 2001 From: adrienmalin <41926238+adrienmalin@users.noreply.github.com> Date: Wed, 2 Jan 2019 01:59:10 +0100 Subject: [PATCH] flash text3 --- Main.gd | 15 ++++----- Main.tscn | 4 +-- Stats.tscn | 98 +++++++++++++++++++++++++++--------------------------- 3 files changed, 57 insertions(+), 60 deletions(-) diff --git a/Main.gd b/Main.gd index 99e3db8..40ad2bc 100644 --- a/Main.gd +++ b/Main.gd @@ -26,13 +26,8 @@ const SCORES = [ [5, 16], [8] ] -const SCORE_NAMES = [ - ["", "T-SPIN", "MINI T-SPIN"], - ["SINGLE", "T-SPIN SINGLE", "MINI T-SPIN SINGLE"], - ["DOUBLE", "T-SPIN DOUBLE"], - ["TRIPLE", "T-SPIN TRIPLE"], - ["TETRIS"], -] +const LINES_CLEARED_NAMES = ["", "SINGLE", "DOUBLE", "TRIPLE", "TETRIS"] +const T_SPIN_NAMES = ["", "T-SPIN", "MINI T-SPIN"] const LINE_CLEAR_MIDI_CHANNELS = [2, 6] @@ -160,7 +155,11 @@ func lock(): if lines_cleared or current_piece.t_spin: var new_score = SCORES[lines_cleared][current_piece.t_spin] $Stats.update_score(new_score) - flash_print(SCORE_NAMES[lines_cleared][current_piece.t_spin] + "\n%d"%(100*new_score)) + if current_piece.t_spin: + flash_print(T_SPIN_NAMES[current_piece.t_spin]) + if lines_cleared: + flash_print(LINES_CLEARED_NAMES[lines_cleared]) + flash_print(str(100*new_score)) if lines_cleared == Tetromino.NB_MINOES: for channel in LINE_CLEAR_MIDI_CHANNELS: $MidiPlayer.channel_status[channel].vomume = 127 diff --git a/Main.tscn b/Main.tscn index 886eb29..a2f2544 100644 --- a/Main.tscn +++ b/Main.tscn @@ -216,7 +216,7 @@ tracks/2/keys = { "values": [ Vector2( 0, 110 ), Vector2( 0, -50 ), Vector2( 0, -60 ), Vector2( 0, -100 ) ] } -[node name="Main" type="WorldEnvironment" index="0"] +[node name="Main" type="WorldEnvironment"] environment = SubResource( 2 ) script = ExtResource( 2 ) @@ -420,8 +420,6 @@ 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 ) -text = "TETRIS -3000" align = 1 valign = 1 percent_visible = 1.0 diff --git a/Stats.tscn b/Stats.tscn index d4d8b15..f3b690e 100644 --- a/Stats.tscn +++ b/Stats.tscn @@ -3,17 +3,17 @@ [ext_resource path="res://Stats.gd" type="Script" id=1] [ext_resource path="res://fonts/Gamer.ttf" type="DynamicFontData" id=2] -[sub_resource type="DynamicFont" id=2] +[sub_resource type="DynamicFont" id=1] -size = 18 +size = 20 use_mipmaps = false use_filter = false font_data = ExtResource( 2 ) _sections_unfolded = [ "Font", "Settings" ] -[sub_resource type="DynamicFont" id=1] +[sub_resource type="DynamicFont" id=2] -size = 16 +size = 18 use_mipmaps = false use_filter = false font_data = ExtResource( 2 ) @@ -44,8 +44,8 @@ anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 16.0 -margin_right = 119.0 -margin_bottom = 67.0 +margin_right = 133.0 +margin_bottom = 77.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 1 @@ -61,8 +61,8 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_right = 59.0 -margin_bottom = 67.0 +margin_right = 68.0 +margin_bottom = 77.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 1 @@ -79,15 +79,15 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_right = 59.0 -margin_bottom = 15.0 +margin_right = 68.0 +margin_bottom = 17.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 = SubResource( 2 ) +custom_fonts/font = SubResource( 1 ) custom_colors/font_color = Color( 0.443137, 0.709804, 0.819608, 0.533333 ) text = "Score:" percent_visible = 1.0 @@ -101,16 +101,16 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 15.0 -margin_right = 59.0 -margin_bottom = 28.0 +margin_top = 17.0 +margin_right = 68.0 +margin_bottom = 32.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 = SubResource( 1 ) +custom_fonts/font = SubResource( 2 ) custom_colors/font_color = Color( 0.443137, 0.709804, 0.819608, 0.533333 ) text = "High score:" percent_visible = 1.0 @@ -124,16 +124,16 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 28.0 -margin_right = 59.0 -margin_bottom = 41.0 +margin_top = 32.0 +margin_right = 68.0 +margin_bottom = 47.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 = SubResource( 1 ) +custom_fonts/font = SubResource( 2 ) custom_colors/font_color = Color( 0.443137, 0.709804, 0.819608, 0.533333 ) text = "Time" percent_visible = 1.0 @@ -146,16 +146,16 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 41.0 -margin_right = 59.0 -margin_bottom = 54.0 +margin_top = 47.0 +margin_right = 68.0 +margin_bottom = 62.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 = SubResource( 1 ) +custom_fonts/font = SubResource( 2 ) custom_colors/font_color = Color( 0.443137, 0.709804, 0.819608, 0.533333 ) text = "Level:" percent_visible = 1.0 @@ -168,16 +168,16 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 54.0 -margin_right = 59.0 -margin_bottom = 67.0 +margin_top = 62.0 +margin_right = 68.0 +margin_bottom = 77.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 = SubResource( 1 ) +custom_fonts/font = SubResource( 2 ) custom_colors/font_color = Color( 0.443137, 0.709804, 0.819608, 0.533333 ) text = "Goal:" percent_visible = 1.0 @@ -190,9 +190,9 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 67.0 -margin_right = 103.0 -margin_bottom = 67.0 +margin_left = 76.0 +margin_right = 117.0 +margin_bottom = 77.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 1 @@ -209,15 +209,15 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_right = 36.0 -margin_bottom = 15.0 +margin_right = 41.0 +margin_bottom = 17.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 = SubResource( 2 ) +custom_fonts/font = SubResource( 1 ) custom_colors/font_color = Color( 0.443137, 0.709804, 0.819608, 0.533333 ) text = "0" percent_visible = 1.0 @@ -231,16 +231,16 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 15.0 -margin_right = 36.0 -margin_bottom = 28.0 +margin_top = 17.0 +margin_right = 41.0 +margin_bottom = 32.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 = SubResource( 1 ) +custom_fonts/font = SubResource( 2 ) custom_colors/font_color = Color( 0.443137, 0.709804, 0.819608, 0.533333 ) text = "0" percent_visible = 1.0 @@ -253,16 +253,16 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 28.0 -margin_right = 36.0 -margin_bottom = 41.0 +margin_top = 32.0 +margin_right = 41.0 +margin_bottom = 47.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 = SubResource( 1 ) +custom_fonts/font = SubResource( 2 ) custom_colors/font_color = Color( 0.443137, 0.709804, 0.819608, 0.533333 ) text = "0:00:00" percent_visible = 1.0 @@ -275,16 +275,16 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 41.0 -margin_right = 36.0 -margin_bottom = 54.0 +margin_top = 47.0 +margin_right = 41.0 +margin_bottom = 62.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 = SubResource( 1 ) +custom_fonts/font = SubResource( 2 ) custom_colors/font_color = Color( 0.443137, 0.709804, 0.819608, 0.533333 ) text = "0" percent_visible = 1.0 @@ -297,16 +297,16 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 54.0 -margin_right = 36.0 -margin_bottom = 67.0 +margin_top = 62.0 +margin_right = 41.0 +margin_bottom = 77.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 = SubResource( 1 ) +custom_fonts/font = SubResource( 2 ) custom_colors/font_color = Color( 0.443137, 0.709804, 0.819608, 0.533333 ) text = "0" percent_visible = 1.0