From bffce873c3fde469051508384d9f163c84b594d8 Mon Sep 17 00:00:00 2001 From: adrienmalin <41926238+adrienmalin@users.noreply.github.com> Date: Tue, 1 Jan 2019 16:57:23 +0100 Subject: [PATCH] Delete GridMap external scene, fix held piece trail --- GridMap/GridMap.gd => GridMap.gd | 0 GridMap/BackMaterial.tres | 55 --------------- GridMap/GridBack.tscn | 31 --------- GridMap/GridMap.tscn | 109 ----------------------------- Main.gd | 10 +-- Tetrominos/Tetromino.gd | 5 +- WorldEnvironment.tscn | 113 ++++++++++++++++++++++--------- 7 files changed, 91 insertions(+), 232 deletions(-) rename GridMap/GridMap.gd => GridMap.gd (100%) delete mode 100644 GridMap/BackMaterial.tres delete mode 100644 GridMap/GridBack.tscn delete mode 100644 GridMap/GridMap.tscn diff --git a/GridMap/GridMap.gd b/GridMap.gd similarity index 100% rename from GridMap/GridMap.gd rename to GridMap.gd diff --git a/GridMap/BackMaterial.tres b/GridMap/BackMaterial.tres deleted file mode 100644 index 5294d29..0000000 --- a/GridMap/BackMaterial.tres +++ /dev/null @@ -1,55 +0,0 @@ -[gd_resource type="SpatialMaterial" format=2] - -[resource] - -render_priority = 0 -flags_transparent = true -flags_unshaded = false -flags_vertex_lighting = false -flags_no_depth_test = false -flags_use_point_size = false -flags_world_triplanar = false -flags_fixed_size = false -flags_albedo_tex_force_srgb = false -vertex_color_use_as_albedo = false -vertex_color_is_srgb = false -params_diffuse_mode = 0 -params_specular_mode = 0 -params_blend_mode = 1 -params_cull_mode = 0 -params_depth_draw_mode = 0 -params_line_width = 1.0 -params_point_size = 1.0 -params_billboard_mode = 0 -params_grow = false -params_use_alpha_scissor = false -albedo_color = Color( 0.601563, 0.775878, 1, 0.0338039 ) -metallic = 0.0 -metallic_specular = 0.0 -metallic_texture_channel = 0 -roughness = 0.46 -roughness_texture_channel = 0 -emission_enabled = false -normal_enabled = false -rim_enabled = false -clearcoat_enabled = false -anisotropy_enabled = false -ao_enabled = false -depth_enabled = false -subsurf_scatter_enabled = false -transmission_enabled = false -refraction_enabled = false -detail_enabled = false -uv1_scale = Vector3( 1, 1, 1 ) -uv1_offset = Vector3( 0, 0, 0 ) -uv1_triplanar = false -uv1_triplanar_sharpness = 1.0 -uv2_scale = Vector3( 1, 1, 1 ) -uv2_offset = Vector3( 0, 0, 0 ) -uv2_triplanar = false -uv2_triplanar_sharpness = 1.0 -proximity_fade_enable = true -proximity_fade_distance = 1.0 -distance_fade_enable = false -_sections_unfolded = [ "Albedo", "Emission", "Metallic", "NormalMap", "Proximity Fade" ] - diff --git a/GridMap/GridBack.tscn b/GridMap/GridBack.tscn deleted file mode 100644 index 62b3f91..0000000 --- a/GridMap/GridBack.tscn +++ /dev/null @@ -1,31 +0,0 @@ -[gd_scene load_steps=3 format=2] - -[ext_resource path="res://GridMap/BackMaterial.tres" type="Material" id=1] - -[sub_resource type="CubeMesh" id=1] - -material = ExtResource( 1 ) -custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) -size = Vector3( 11, 22, 0.1 ) -subdivide_width = 0 -subdivide_height = 0 -subdivide_depth = 0 - -[node name="GridBack" type="MeshInstance"] - -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 4.5, 9.5, -1 ) -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( 1 ) -skeleton = NodePath("..") -material/0 = null -_sections_unfolded = [ "Transform" ] - - diff --git a/GridMap/GridMap.tscn b/GridMap/GridMap.tscn deleted file mode 100644 index 88a869e..0000000 --- a/GridMap/GridMap.tscn +++ /dev/null @@ -1,109 +0,0 @@ -[gd_scene load_steps=7 format=2] - -[ext_resource path="res://Tetrominos/Mino/MinoLibrary.tres" type="MeshLibrary" id=1] -[ext_resource path="res://GridMap/GridMap.gd" type="Script" id=2] -[ext_resource path="res://GridMap/GridBack.tscn" type="PackedScene" id=3] -[ext_resource path="res://GridMap/BackMaterial.tres" type="Material" id=4] -[ext_resource path="res://midi/MidiPlayer.tscn" type="PackedScene" id=5] - -[sub_resource type="CubeMesh" id=3] - -material = ExtResource( 4 ) -custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) -size = Vector3( 1, 1, 1 ) -subdivide_width = 0 -subdivide_height = 0 -subdivide_depth = 0 - -[node name="GridMap" type="GridMap"] - -theme = ExtResource( 1 ) -cell_size = Vector3( 1, 1, 1 ) -cell_octant_size = 8 -cell_center_x = false -cell_center_y = false -cell_center_z = false -cell_scale = 1.0 -collision_layer = 1 -collision_mask = 1 -data = { -"cells": PoolIntArray( ) -} -script = ExtResource( 2 ) -_sections_unfolded = [ "Cell", "Transform" ] -__meta__ = { -"_editor_clip_": 1, -"_editor_floor_": Vector3( 0, -1, 0 ) -} -NB_LINES = 20 -NB_COLLUMNS = 10 - -[node name="DropTimer" type="Timer" parent="." index="0"] - -process_mode = 1 -wait_time = 1.0 -one_shot = false -autostart = false - -[node name="LockDelay" type="Timer" parent="." index="1"] - -process_mode = 1 -wait_time = 0.5 -one_shot = true -autostart = false - -[node name="AutoShiftDelay" type="Timer" parent="." index="2"] - -process_mode = 1 -wait_time = 0.17 -one_shot = true -autostart = false - -[node name="AutoShiftTimer" type="Timer" parent="." index="3"] - -process_mode = 1 -wait_time = 0.03 -one_shot = false -autostart = true - -[node name="GridBack" parent="." index="4" instance=ExtResource( 3 )] - -transform = Transform( 10, 0, 0, 0, 20, 0, 0, 0, 0.1, 4.5, 9.5, -1 ) -mesh = SubResource( 3 ) - -[node name="HoldBack" parent="." index="5" instance=ExtResource( 3 )] - -transform = Transform( 7, 0, 0, 0, 7, 0, 0, 0, 0.1, -5, 16, -1 ) -mesh = SubResource( 3 ) - -[node name="NextBack" parent="." index="6" instance=ExtResource( 3 )] - -transform = Transform( 7, 0, 0, 0, 7, 0, 0, 0, 0.1, 14, 16, -1 ) -mesh = SubResource( 3 ) - -[node name="MidiPlayer" parent="." index="7" instance=ExtResource( 5 )] - -file = "res://midi/Tetris - Song A.mid" -volume_db = -24 -loop = true -loop_start = 1.81 -soundfont = "res://midi/FluidR3 GM.sf2" - -[node name="LineCLearTimer" type="Timer" parent="MidiPlayer" index="1"] - -process_mode = 1 -wait_time = 1.41 -one_shot = true -autostart = false - -[connection signal="timeout" from="DropTimer" to="." method="_on_DropTimer_timeout"] - -[connection signal="timeout" from="LockDelay" to="." method="_on_LockDelay_timeout"] - -[connection signal="timeout" from="AutoShiftDelay" to="." method="_on_AutoShiftDelay_timeout"] - -[connection signal="timeout" from="AutoShiftTimer" to="." method="_on_AutoShiftTimer_timeout"] - -[connection signal="timeout" from="MidiPlayer/LineCLearTimer" to="." method="_on_LineCLearTimer_timeout"] - - diff --git a/Main.gd b/Main.gd index 643f5dc..b1fbb6b 100644 --- a/Main.gd +++ b/Main.gd @@ -161,20 +161,20 @@ func lock(): if lines_cleared == Tetromino.NB_MINOES: for channel in LINE_CLEAR_MIDI_CHANNELS: $MidiPlayer.channel_status[channel].vomume = 127 - $MidiPlayer/LineCLearTimer.wait_time = 0.86 + $LineCLearTimer.wait_time = 0.86 else: for channel in LINE_CLEAR_MIDI_CHANNELS: $MidiPlayer.channel_status[channel].vomume = 100 - $MidiPlayer/LineCLearTimer.wait_time = 0.43 + $LineCLearTimer.wait_time = 0.43 $MidiPlayer.unmute_channels(LINE_CLEAR_MIDI_CHANNELS) - $MidiPlayer/LineCLearTimer.start() + $LineCLearTimer.start() if goal <= 0: new_level() new_piece() func hold(): if not current_piece_held: - current_piece.emit_trail(false) + current_piece_held = true if held_piece: var tmp = held_piece held_piece = current_piece @@ -184,8 +184,8 @@ func hold(): else: held_piece = current_piece new_piece() + held_piece.emit_trail(false) held_piece.translation = HOLD_POSITION - current_piece_held = true func resume(): playing = true diff --git a/Tetrominos/Tetromino.gd b/Tetrominos/Tetromino.gd index 5f95770..be9ae4c 100644 --- a/Tetrominos/Tetromino.gd +++ b/Tetrominos/Tetromino.gd @@ -123,5 +123,8 @@ func rotate(direction): return false func emit_trail(emit): + var trail for mino in minoes: - mino.get_node("Trail").emitting = emit \ No newline at end of file + trail = mino.get_node("Trail") + trail.emitting = emit + trail.restart() \ No newline at end of file diff --git a/WorldEnvironment.tscn b/WorldEnvironment.tscn index 84149e1..614e176 100644 --- a/WorldEnvironment.tscn +++ b/WorldEnvironment.tscn @@ -1,13 +1,10 @@ -[gd_scene load_steps=12 format=2] +[gd_scene load_steps=11 format=2] [ext_resource path="res://starmap_g8k.jpg" type="Texture" id=1] [ext_resource path="res://Main.gd" type="Script" id=2] [ext_resource path="res://Tetrominos/Mino/MinoLibrary.tres" type="MeshLibrary" id=3] -[ext_resource path="res://GridMap/GridMap.gd" type="Script" id=4] -[ext_resource path="res://GridMap/GridBack.tscn" type="PackedScene" id=5] -[ext_resource path="res://GridMap/BackMaterial.tres" type="Material" id=6] -[ext_resource path="res://midi/MidiPlayer.tscn" type="PackedScene" id=7] -[ext_resource path="res://midi/MidiPlayer.gd" type="Script" id=8] +[ext_resource path="res://GridMap.gd" type="Script" id=4] +[ext_resource path="res://midi/MidiPlayer.tscn" type="PackedScene" id=5] [sub_resource type="PanoramaSky" id=1] @@ -95,16 +92,78 @@ adjustment_contrast = 1.0 adjustment_saturation = 0.34 _sections_unfolded = [ "Adjustments", "Ambient Light", "Background", "Fog", "Resource" ] -[sub_resource type="CubeMesh" id=3] +[sub_resource type="SpatialMaterial" id=4] -material = ExtResource( 6 ) +render_priority = 0 +flags_transparent = true +flags_unshaded = false +flags_vertex_lighting = false +flags_no_depth_test = false +flags_use_point_size = false +flags_world_triplanar = false +flags_fixed_size = false +flags_albedo_tex_force_srgb = false +vertex_color_use_as_albedo = false +vertex_color_is_srgb = false +params_diffuse_mode = 0 +params_specular_mode = 0 +params_blend_mode = 1 +params_cull_mode = 0 +params_depth_draw_mode = 0 +params_line_width = 1.0 +params_point_size = 1.0 +params_billboard_mode = 0 +params_grow = false +params_use_alpha_scissor = false +albedo_color = Color( 0.601563, 0.775878, 1, 0.0338039 ) +metallic = 0.0 +metallic_specular = 0.0 +metallic_texture_channel = 0 +roughness = 0.46 +roughness_texture_channel = 0 +emission_enabled = false +normal_enabled = false +rim_enabled = false +clearcoat_enabled = false +anisotropy_enabled = false +ao_enabled = false +depth_enabled = false +subsurf_scatter_enabled = false +transmission_enabled = false +refraction_enabled = false +detail_enabled = false +uv1_scale = Vector3( 1, 1, 1 ) +uv1_offset = Vector3( 0, 0, 0 ) +uv1_triplanar = false +uv1_triplanar_sharpness = 1.0 +uv2_scale = Vector3( 1, 1, 1 ) +uv2_offset = Vector3( 0, 0, 0 ) +uv2_triplanar = false +uv2_triplanar_sharpness = 1.0 +proximity_fade_enable = true +proximity_fade_distance = 1.0 +distance_fade_enable = false +_sections_unfolded = [ "Albedo", "Emission", "Metallic", "NormalMap", "Proximity Fade" ] + +[sub_resource type="CubeMesh" id=5] + +material = SubResource( 4 ) custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) size = Vector3( 1, 1, 1 ) subdivide_width = 0 subdivide_height = 0 subdivide_depth = 0 -[node name="Main" type="WorldEnvironment"] +[sub_resource type="CubeMesh" id=3] + +material = SubResource( 4 ) +custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) +size = Vector3( 1, 1, 1 ) +subdivide_width = 0 +subdivide_height = 0 +subdivide_depth = 0 + +[node name="Main" type="WorldEnvironment" index="0"] environment = SubResource( 2 ) script = ExtResource( 2 ) @@ -192,7 +251,7 @@ __meta__ = { NB_LINES = 20 NB_COLLUMNS = 10 -[node name="GridBack" type="MeshInstance" parent="." index="4" instance=ExtResource( 5 )] +[node name="GridBack" type="MeshInstance" parent="." index="4"] transform = Transform( 10, 0, 0, 0, 20, 0, 0, 0, 0.1, 4.5, 9.5, -1 ) layers = 1 @@ -204,12 +263,12 @@ lod_min_distance = 0.0 lod_min_hysteresis = 0.0 lod_max_distance = 0.0 lod_max_hysteresis = 0.0 -mesh = SubResource( 3 ) +mesh = SubResource( 5 ) skeleton = NodePath("..") material/0 = null _sections_unfolded = [ "Transform" ] -[node name="HoldBack" type="MeshInstance" parent="." index="5" instance=ExtResource( 5 )] +[node name="HoldBack" type="MeshInstance" parent="." index="5"] transform = Transform( 7, 0, 0, 0, 7, 0, 0, 0, 0.1, -5, 16, -1 ) layers = 1 @@ -226,7 +285,7 @@ skeleton = NodePath("..") material/0 = null _sections_unfolded = [ "Transform" ] -[node name="NextBack" type="MeshInstance" parent="." index="6" instance=ExtResource( 5 )] +[node name="NextBack" type="MeshInstance" parent="." index="6"] transform = Transform( 7, 0, 0, 0, 7, 0, 0, 0, 0.1, 14, 16, -1 ) layers = 1 @@ -271,29 +330,21 @@ wait_time = 0.03 one_shot = false autostart = false -[node name="MidiPlayer" type="Node" parent="." index="11" instance=ExtResource( 7 )] - -script = ExtResource( 8 ) -max_polyphony = 64 -file = "res://midi/Tetris - Song A.mid" -playing = false -channel_mute = [ false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false ] -play_speed = 1.0 -volume_db = -24 -key_shift = 0 -loop = true -loop_start = 1.81 -soundfont = "res://midi/FluidR3 GM.sf2" -mix_target = 0 -bus = "Master" - -[node name="LineCLearTimer" type="Timer" parent="MidiPlayer" index="1"] +[node name="LineCLearTimer" type="Timer" parent="." index="11"] process_mode = 1 wait_time = 1.41 one_shot = true autostart = false +[node name="MidiPlayer" parent="." index="12" instance=ExtResource( 5 )] + +file = "res://midi/Tetris - Song A.mid" +volume_db = -24 +loop = true +loop_start = 1.81 +soundfont = "res://midi/TimGM6mb.sf2" + [connection signal="timeout" from="DropTimer" to="." method="_on_DropTimer_timeout"] [connection signal="timeout" from="LockDelay" to="." method="_on_LockDelay_timeout"] @@ -302,6 +353,6 @@ autostart = false [connection signal="timeout" from="AutoShiftTimer" to="." method="_on_AutoShiftTimer_timeout"] -[connection signal="timeout" from="MidiPlayer/LineCLearTimer" to="." method="_on_LineCLearTimer_timeout"] +[connection signal="timeout" from="LineCLearTimer" to="." method="_on_LineCLearTimer_timeout"]