diff --git a/Audio/Song A pizzicato solo.ogg b/Audio/Song A pizzicato solo.ogg new file mode 100644 index 0000000..cab2dfe Binary files /dev/null and b/Audio/Song A pizzicato solo.ogg differ diff --git a/Audio/Song A pizzicato solo.ogg.import b/Audio/Song A pizzicato solo.ogg.import new file mode 100644 index 0000000..474a907 --- /dev/null +++ b/Audio/Song A pizzicato solo.ogg.import @@ -0,0 +1,15 @@ +[remap] + +importer="ogg_vorbis" +type="AudioStreamOGGVorbis" +path="res://.import/Song A pizzicato solo.ogg-bb0592fa96a1944827b2c377836a7301.oggstr" + +[deps] + +source_file="res://Audio/Song A pizzicato solo.ogg" +dest_files=[ "res://.import/Song A pizzicato solo.ogg-bb0592fa96a1944827b2c377836a7301.oggstr" ] + +[params] + +loop=true +loop_offset=0 diff --git a/Audio/Song A without pizzicato.ogg b/Audio/Song A without pizzicato.ogg new file mode 100644 index 0000000..77fedcc Binary files /dev/null and b/Audio/Song A without pizzicato.ogg differ diff --git a/Audio/Song A without pizzicato.ogg.import b/Audio/Song A without pizzicato.ogg.import new file mode 100644 index 0000000..42e1986 --- /dev/null +++ b/Audio/Song A without pizzicato.ogg.import @@ -0,0 +1,15 @@ +[remap] + +importer="ogg_vorbis" +type="AudioStreamOGGVorbis" +path="res://.import/Song A without pizzicato.ogg-0762944017b6daf2dd37510d2a86a592.oggstr" + +[deps] + +source_file="res://Audio/Song A without pizzicato.ogg" +dest_files=[ "res://.import/Song A without pizzicato.ogg-0762944017b6daf2dd37510d2a86a592.oggstr" ] + +[params] + +loop=true +loop_offset=0 diff --git a/Audio/Tetris - Song A.mid b/Audio/Tetris - Song A.mid new file mode 100644 index 0000000..3034c1a Binary files /dev/null and b/Audio/Tetris - Song A.mid differ diff --git a/Audio/line_clear.wav b/Audio/line_clear.wav new file mode 100644 index 0000000..e6507cd Binary files /dev/null and b/Audio/line_clear.wav differ diff --git a/Audio/line_clear.wav.import b/Audio/line_clear.wav.import new file mode 100644 index 0000000..cf8e030 --- /dev/null +++ b/Audio/line_clear.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/line_clear.wav-7797a050b9c9acfadee761ccba5d496d.sample" + +[deps] + +source_file="res://Audio/line_clear.wav" +dest_files=[ "res://.import/line_clear.wav-7797a050b9c9acfadee761ccba5d496d.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=true +edit/loop=false +compress/mode=0 diff --git a/Audio/tetris.wav b/Audio/tetris.wav new file mode 100644 index 0000000..f6cc51d Binary files /dev/null and b/Audio/tetris.wav differ diff --git a/Audio/tetris.wav.import b/Audio/tetris.wav.import new file mode 100644 index 0000000..1da9ad9 --- /dev/null +++ b/Audio/tetris.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/tetris.wav-72e7c256c9dbf193e3a65319af7e85d5.sample" + +[deps] + +source_file="res://Audio/tetris.wav" +dest_files=[ "res://.import/tetris.wav-72e7c256c9dbf193e3a65319af7e85d5.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=true +edit/loop=false +compress/mode=0 diff --git a/ExplodingLine/Breakage1.tres b/ExplodingLine/Breakage1.tres new file mode 100644 index 0000000..4914763 --- /dev/null +++ b/ExplodingLine/Breakage1.tres @@ -0,0 +1,14 @@ +[gd_resource type="PrismMesh" load_steps=2 format=2] + +[ext_resource path="res://Mino/MinoMaterial.tres" type="Material" id=1] + +[resource] + +material = ExtResource( 1 ) +custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) +left_to_right = 2.98023e-008 +size = Vector3( 0.2, 0.2, 0.2 ) +subdivide_width = 2 +subdivide_height = 0 +subdivide_depth = 0 + diff --git a/ExplodingLine/Breakage2.tres b/ExplodingLine/Breakage2.tres new file mode 100644 index 0000000..e87944a --- /dev/null +++ b/ExplodingLine/Breakage2.tres @@ -0,0 +1,14 @@ +[gd_resource type="PrismMesh" load_steps=2 format=2] + +[ext_resource path="res://Mino/MinoMaterial.tres" type="Material" id=1] + +[resource] + +material = ExtResource( 1 ) +custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) +left_to_right = 0.5 +size = Vector3( 0.2, 0.2, 0.2 ) +subdivide_width = 2 +subdivide_height = 0 +subdivide_depth = 0 + diff --git a/ExplodingLine/ExplodingLine.tscn b/ExplodingLine/ExplodingLine.tscn new file mode 100644 index 0000000..4282cd9 --- /dev/null +++ b/ExplodingLine/ExplodingLine.tscn @@ -0,0 +1,111 @@ +[gd_scene load_steps=10 format=2] + +[ext_resource path="res://ExplodingLine/Breakage1.tres" type="PrismMesh" id=1] +[ext_resource path="res://ExplodingLine/Breakage2.tres" type="PrismMesh" id=2] +[ext_resource path="res://GridMap/BackMaterial.tres" type="Material" id=3] + + + + +[sub_resource type="Gradient" id=1] + +offsets = PoolRealArray( 0, 1 ) +colors = PoolColorArray( 0, 0, 0, 1, 1, 1, 1, 1 ) + +[sub_resource type="GradientTexture" id=2] + +flags = 4 +gradient = SubResource( 1 ) +width = 2048 + +[sub_resource type="Gradient" id=3] + +offsets = PoolRealArray( 0, 1 ) +colors = PoolColorArray( 0.802765, 1, 0.451172, 1, 1, 1, 1, 0 ) + +[sub_resource type="GradientTexture" id=4] + +flags = 4 +gradient = SubResource( 3 ) +width = 2048 + +[sub_resource type="ParticlesMaterial" id=5] + +render_priority = 0 +trail_divisor = 2 +trail_color_modifier = SubResource( 4 ) +emission_shape = 2 +emission_box_extents = Vector3( 8, 0.5, 0.5 ) +flag_align_y = false +flag_rotate_y = true +flag_disable_z = false +spread = 10.0 +flatness = 0.0 +gravity = Vector3( 0, -20, 0 ) +initial_velocity = 10.0 +initial_velocity_random = 0.8 +angular_velocity = 197.74 +angular_velocity_random = 1.0 +linear_accel = 100.0 +linear_accel_random = 0.84 +radial_accel = 8.48 +radial_accel_random = 0.85 +tangential_accel = 0.0 +tangential_accel_random = 0.0 +damping = 0.0 +damping_random = 0.0 +angle = 402.7 +angle_random = 0.78 +scale = 0.5 +scale_random = 1.0 +color_ramp = SubResource( 2 ) +hue_variation = 0.0 +hue_variation_random = 0.0 +anim_speed = 0.0 +anim_speed_random = 0.0 +anim_offset = 0.0 +anim_offset_random = 0.0 +anim_loop = false +_sections_unfolded = [ "Color", "Emission Shape", "Gravity", "Scale", "Spread" ] + +[sub_resource type="CubeMesh" id=6] + +material = ExtResource( 3 ) +custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) +size = Vector3( 0.2, 0.2, 0.2 ) +subdivide_width = 0 +subdivide_height = 0 +subdivide_depth = 0 + +[node name="ExplodingLine" type="Particles" index="0"] + +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 +emitting = false +amount = 1000 +lifetime = 2.0 +one_shot = true +preprocess = 0.0 +speed_scale = 2.18 +explosiveness = 0.9 +randomness = 0.69 +fixed_fps = 0 +fract_delta = true +visibility_aabb = AABB( -5, -0.5, -1, 10, 1, 2 ) +local_coords = false +draw_order = 0 +process_material = SubResource( 5 ) +draw_passes = 3 +draw_pass_1 = ExtResource( 1 ) +draw_pass_2 = ExtResource( 2 ) +draw_pass_3 = SubResource( 6 ) +_sections_unfolded = [ "Draw Passes", "Drawing", "Process Material", "Time", "Transform" ] + + diff --git a/ExplodingLine/SparkSpatialmaterial.tres b/ExplodingLine/SparkSpatialmaterial.tres new file mode 100644 index 0000000..85047a5 --- /dev/null +++ b/ExplodingLine/SparkSpatialmaterial.tres @@ -0,0 +1,59 @@ +[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.67451, 1, 0.988235, 0.108118 ) +metallic = 0.22 +metallic_specular = 1.0 +metallic_texture_channel = 0 +roughness = 0.49 +roughness_texture_channel = 0 +emission_enabled = true +emission = Color( 0.700471, 1, 0.98947, 1 ) +emission_energy = 0.2 +emission_operator = 0 +emission_on_uv2 = 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", "Parameters" ] + diff --git a/GridMap/BackMaterial.tres b/GridMap/BackMaterial.tres new file mode 100644 index 0000000..5294d29 --- /dev/null +++ b/GridMap/BackMaterial.tres @@ -0,0 +1,55 @@ +[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 new file mode 100644 index 0000000..62b3f91 --- /dev/null +++ b/GridMap/GridBack.tscn @@ -0,0 +1,31 @@ +[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.gd b/GridMap/GridMap.gd new file mode 100644 index 0000000..3ce1b6e --- /dev/null +++ b/GridMap/GridMap.gd @@ -0,0 +1,296 @@ +extends GridMap + +const ExplodingLine = preload("res://ExplodingLine/ExplodingLine.tscn") +const Tetromino = preload("res://Tetrominos/Tetromino.gd") +const TetroI = preload("res://Tetrominos/TetroI.tscn") +const TetroJ = preload("res://Tetrominos/TetroJ.tscn") +const TetroL = preload("res://Tetrominos/TetroL.tscn") +const TetroO = preload("res://Tetrominos/TetroO.tscn") +const TetroS = preload("res://Tetrominos/TetroS.tscn") +const TetroT = preload("res://Tetrominos/TetroT.tscn") +const TetroZ = preload("res://Tetrominos/TetroZ.tscn") + +const EMPTY_CELL = -1 +const NB_MINOES = 4 +const NEXT_POSITION = Vector3(13, 16, 0) +const START_POSITION = Vector3(5, 20, 0) +const HOLD_POSITION = Vector3(-5, 16, 0) +const SOUND_POSITION = Vector3(5, 10, 6) +const SCORES = [ + [0, 4, 1], + [1, 8, 2], + [3, 12], + [5, 16], + [8] +] +const LINES_CLEARED_NAMES = ["", "SINGLE", "DOUBLE", "TRIPLE", "TETRIS"] +const T_SPIN_NAMES = ["", "MINI T-SPIN", "T-SPIN"] +const NB_LINES = 20 +const NB_COLLUMNS = 10 + +var next_piece = random_piece() +var current_piece +var held_piece +var current_piece_held = false +var locked = false +var autoshift_action = "" +var movements = { + "move_right": Vector3(1, 0, 0), + "move_left": Vector3(-1, 0, 0), + "soft_drop": Vector3(0, -1, 0) +} +var exploding_lines = [] +var lines_to_clear = [] +var random_bag = [] +var playing = true +var level = 0 +var goal = 0 +var score = 0 + +func _ready(): + randomize() + print(NB_LINES) + for y in range(NB_LINES): + exploding_lines.append(ExplodingLine.instance()) + add_child(exploding_lines[y]) + exploding_lines[y].translation = Vector3(NB_COLLUMNS/2, y, 1) + resume() + new_level() + +func new_level(): + level += 1 + goal += 5 * level + $DropTimer.wait_time = pow(0.8 - ((level - 1) * 0.007), level - 1) + if level > 15: + $LockDelay.wait_time = 0.5 * pow(0.9, level-15) + print("LEVEL ", level, " Goal ", goal) + new_piece() + +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(): + current_piece = next_piece + current_piece.translation = START_POSITION + current_piece.emit_trail(true) + autoshift_action = "" + update_ghost_piece() + $Music2.translation = SOUND_POSITION + next_piece = random_piece() + next_piece.translation = NEXT_POSITION + if move(movements["soft_drop"]): + $DropTimer.start() + $LockDelay.start() + current_piece_held = false + else: + game_over() + +func _process(delta): + if autoshift_action: + if not Input.is_action_pressed(autoshift_action): + $AutoShiftDelay.stop() + $AutoShiftTimer.stop() + autoshift_action = "" + if Input.is_action_just_pressed("pause"): + if playing: + pause() + else: + resume() + if playing: + process_actions() + +func process_actions(): + for action in movements: + if action != autoshift_action: + if Input.is_action_pressed(action): + if move(movements[action]): + move_music() + autoshift_action = action + $AutoShiftTimer.stop() + $AutoShiftDelay.start() + if Input.is_action_just_pressed("hard_drop"): + move_music() + while move(movements["soft_drop"]): + pass + lock_piece() + if Input.is_action_just_pressed("rotate_clockwise"): + rotate(Tetromino.CLOCKWISE) + move_music() + if Input.is_action_just_pressed("rotate_counterclockwise"): + rotate(Tetromino.COUNTERCLOCKWISE) + move_music() + if Input.is_action_just_pressed("hold"): + hold() + +func _on_AutoShiftDelay_timeout(): + if playing and autoshift_action: + move(movements[autoshift_action]) + $AutoShiftTimer.start() + +func _on_AutoShiftTimer_timeout(): + if playing and autoshift_action: + move(movements[autoshift_action]) + +func is_free_cell(position): + return ( + 0 <= position.x and position.x < NB_COLLUMNS + and position.y >= 0 + and get_cell_item(position.x, position.y, 0) == GridMap.INVALID_CELL_ITEM + ) + +func possible_positions(initial_positions, movement): + var position + var test_positions = [] + for i in range(4): + position = initial_positions[i] + movement + if is_free_cell(position): + test_positions.append(position) + if test_positions.size() == NB_MINOES: + return test_positions + else: + return [] + +func move(movement): + if current_piece.move(movement): + $LockDelay.start() + if movement.x: + update_ghost_piece() + $Music2.translate(movement) + return true + else: + return false + +func rotate(direction): + if current_piece.rotate(direction): + update_ghost_piece() + $LockDelay.start() + return true + else: + return false + +func move_music(): + AudioServer.set_bus_mute(AudioServer.get_bus_index("Music2"), false) + $MusicDelay.start() + +func update_ghost_piece(): + var new_positions = current_piece.positions() + var positions + while(new_positions): + positions = new_positions + new_positions = possible_positions(positions, movements["soft_drop"]) + $GhostPiece.apply_positions(positions) + +func _on_DropTimer_timeout(): + move(movements["soft_drop"]) + +func _on_LockDelay_timeout(): + if not move(movements["soft_drop"]): + lock_piece() + +func lock_piece(): + for mino in current_piece.minoes: + set_cell_item(current_piece.to_global(mino.translation).x, current_piece.to_global(mino.translation).y, 0, 0) + remove_child(current_piece) + line_clear() + +func line_clear(): + var NB_MINOES + lines_to_clear = [] + for y in range(NB_LINES-1, -1, -1): + NB_MINOES = 0 + for x in range(NB_COLLUMNS): + if get_cell_item(x, y, 0) == 0: + NB_MINOES += 1 + if NB_MINOES == NB_COLLUMNS: + for x in range(NB_COLLUMNS): + set_cell_item(x, y, 0, EMPTY_CELL) + lines_to_clear.append(y) + exploding_lines[y].restart() + if lines_to_clear: + $ExplosionDelay.start() + update_score() + +func update_score(): + if lines_to_clear or current_piece.t_spin: + var s = SCORES[lines_to_clear.size()][current_piece.t_spin] + score += 100 * s + goal -= s + print(T_SPIN_NAMES[current_piece.t_spin], ' ', LINES_CLEARED_NAMES[lines_to_clear.size()], " Score ", score) + if lines_to_clear.size() == Tetromino.NB_MINOES: + $TetrisSFX.play() + else: + $LineCLearSFX.play() + if goal <= 0: + new_level() + else: + new_piece() + +func _on_ExplosionDelay_timeout(): + for cleared_line in lines_to_clear: + for y in range(cleared_line, NB_LINES+2): + for x in range(NB_COLLUMNS): + set_cell_item(x, y, 0, get_cell_item(x, y+1, 0)) + update_ghost_piece() + +func hold(): + if not current_piece_held: + if held_piece: + var tmp = held_piece + held_piece = current_piece + current_piece = tmp + current_piece.translation = START_POSITION + current_piece.emit_trail(true) + update_ghost_piece() + $Music2.translation = SOUND_POSITION + else: + held_piece = current_piece + new_piece() + held_piece.translation = HOLD_POSITION + held_piece.emit_trail(false) + current_piece_held = true + +func resume(): + playing = true + $DropTimer.start() + $LockDelay.start() + start_musics() + print("RESUME") + +func pause(): + playing = false + $DropTimer.stop() + $LockDelay.stop() + $Music.stop() + $Music2.stop() + print("PAUSE") + +func game_over(): + playing = false + $DropTimer.stop() + $AutoShiftDelay.stop() + $AutoShiftTimer.stop() + print("GAME OVER") + +func _notification(what): + if what == MainLoop.NOTIFICATION_WM_FOCUS_OUT: + pause() + +func _on_MusicDelay_timeout(): + AudioServer.set_bus_mute(AudioServer.get_bus_index("Music2"), true) + +func _on_Music_finished(): + start_musics() + +func start_musics(): + $Music.play() + $Music2.play() + AudioServer.set_bus_mute(AudioServer.get_bus_index("Music2"), true) \ No newline at end of file diff --git a/GridMap/GridMap.tscn b/GridMap/GridMap.tscn new file mode 100644 index 0000000..4bc2e85 --- /dev/null +++ b/GridMap/GridMap.tscn @@ -0,0 +1,180 @@ +[gd_scene load_steps=11 format=2] + +[ext_resource path="res://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://Tetrominos/GhostPiece.tscn" type="PackedScene" id=5] +[ext_resource path="res://Audio/Song A without pizzicato.ogg" type="AudioStream" id=6] +[ext_resource path="res://Audio/Song A pizzicato solo.ogg" type="AudioStream" id=7] +[ext_resource path="res://Audio/line_clear.wav" type="AudioStream" id=8] +[ext_resource path="res://Audio/tetris.wav" type="AudioStream" id=9] + +[sub_resource type="CubeMesh" id=1] + +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" index="0"] + +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( 13, 0, 0, 65543, 0, 0 ) +} +script = ExtResource( 2 ) +_sections_unfolded = [ "Cell", "Transform" ] +__meta__ = { +"_editor_clip_": 0, +"_editor_floor_": Vector3( 0, 3, 0 ) +} + +[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.02 +one_shot = false +autostart = true + +[node name="ExplosionDelay" type="Timer" parent="." index="4"] + +process_mode = 1 +wait_time = 0.1 +one_shot = true +autostart = false + +[node name="GridBack" parent="." index="5" instance=ExtResource( 3 )] + +transform = Transform( 10, 0, 0, 0, 20, 0, 0, 0, 0.1, 4.5, 9.5, -1 ) +mesh = SubResource( 1 ) + +[node name="HoldBack" parent="." index="6" instance=ExtResource( 3 )] + +transform = Transform( 7, 0, 0, 0, 7, 0, 0, 0, 0.1, -5, 16, -1 ) +mesh = SubResource( 1 ) + +[node name="NextBack" parent="." index="7" instance=ExtResource( 3 )] + +transform = Transform( 7, 0, 0, 0, 7, 0, 0, 0, 0.1, 14, 16, -1 ) +mesh = SubResource( 1 ) + +[node name="GhostPiece" parent="." index="8" instance=ExtResource( 5 )] + +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, 0 ) +_sections_unfolded = [ "Transform" ] + +[node name="Music" type="AudioStreamPlayer" parent="." index="9"] + +stream = ExtResource( 6 ) +volume_db = 0.0 +pitch_scale = 1.0 +autoplay = false +mix_target = 0 +bus = "Music" +_sections_unfolded = [ "Attenuation Filter", "Doppler", "Pause" ] + +[node name="Music2" type="AudioStreamPlayer3D" parent="." index="10"] + +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, 0 ) +stream = ExtResource( 7 ) +attenuation_model = 0 +unit_db = 0.0 +unit_size = 1.0 +max_db = 6.0 +pitch_scale = 1.0 +autoplay = false +max_distance = 0.0 +out_of_range_mode = 0 +bus = "Music2" +area_mask = 1 +emission_angle_enabled = false +emission_angle_degrees = 45.0 +emission_angle_filter_attenuation_db = -12.0 +attenuation_filter_cutoff_hz = 5000.0 +attenuation_filter_db = -24.0 +doppler_tracking = 0 +_sections_unfolded = [ "Attenuation Filter", "Doppler" ] + +[node name="MusicDelay" type="Timer" parent="." index="11"] + +process_mode = 1 +wait_time = 0.2 +one_shot = true +autostart = false + +[node name="LineCLearSFX" type="AudioStreamPlayer" parent="." index="12"] + +stream = ExtResource( 8 ) +volume_db = 0.0 +pitch_scale = 1.0 +autoplay = false +mix_target = 0 +bus = "SFX" + +[node name="TetrisSFX" type="AudioStreamPlayer3D" parent="." index="13"] + +stream = ExtResource( 9 ) +attenuation_model = 0 +unit_db = 0.0 +unit_size = 1.0 +max_db = 3.0 +pitch_scale = 1.0 +autoplay = false +max_distance = 0.0 +out_of_range_mode = 0 +bus = "SFX" +area_mask = 1 +emission_angle_enabled = false +emission_angle_degrees = 45.0 +emission_angle_filter_attenuation_db = -12.0 +attenuation_filter_cutoff_hz = 5000.0 +attenuation_filter_db = -24.0 +doppler_tracking = 0 + +[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="ExplosionDelay" to="." method="_on_ExplosionDelay_timeout"] + +[connection signal="finished" from="Music" to="." method="_on_Music_finished"] + +[connection signal="timeout" from="MusicDelay" to="." method="_on_MusicDelay_timeout"] + + diff --git a/Mino/Mino.tscn b/Mino/Mino.tscn index 2e71900..c3216d8 100644 --- a/Mino/Mino.tscn +++ b/Mino/Mino.tscn @@ -131,7 +131,7 @@ lod_min_distance = 0.0 lod_min_hysteresis = 0.0 lod_max_distance = 0.0 lod_max_hysteresis = 0.0 -emitting = true +emitting = false amount = 20 lifetime = 0.1 one_shot = false diff --git a/Mino/MinoMaterial.tres b/Mino/MinoMaterial.tres index 813e569..41bde27 100644 --- a/Mino/MinoMaterial.tres +++ b/Mino/MinoMaterial.tres @@ -23,7 +23,7 @@ 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.25 ) +albedo_color = Color( 0.601563, 0.775878, 1, 0.162157 ) metallic = 0.4 metallic_specular = 1.0 metallic_texture_channel = 0 diff --git a/Mino/Mino_Library.tscn b/Mino/Mino_Library.tscn new file mode 100644 index 0000000..c5c5447 --- /dev/null +++ b/Mino/Mino_Library.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Mino/MinoMesh.tscn" type="PackedScene" id=1] + + +[node name="Mino_Library" type="Spatial" index="0"] + +[node name="Mino" parent="." index="0" instance=ExtResource( 1 )] + + diff --git a/Tetrominos/GhostPiece.tscn b/Tetrominos/GhostPiece.tscn index 390b0b3..efd9b45 100644 --- a/Tetrominos/GhostPiece.tscn +++ b/Tetrominos/GhostPiece.tscn @@ -25,7 +25,7 @@ params_point_size = 1.0 params_billboard_mode = 0 params_grow = false params_use_alpha_scissor = false -albedo_color = Color( 0.201977, 0.22403, 0.310547, 1 ) +albedo_color = Color( 0.409756, 0.451493, 0.615234, 1 ) metallic = 0.66 metallic_specular = 0.5 metallic_texture_channel = 0 @@ -53,7 +53,7 @@ uv2_triplanar_sharpness = 1.0 proximity_fade_enable = true proximity_fade_distance = 1.0 distance_fade_enable = false -_sections_unfolded = [ "Albedo", "Proximity Fade" ] +_sections_unfolded = [ "Albedo", "Emission", "Metallic", "Proximity Fade" ] [sub_resource type="CubeMesh" id=2] @@ -83,6 +83,28 @@ mesh = SubResource( 2 ) skeleton = NodePath("..") material/0 = null +[node name="OmniLight" type="OmniLight" parent="Mino0" index="0"] + +layers = 1 +light_color = Color( 0.871094, 0.978851, 1, 1 ) +light_energy = 10.0 +light_indirect_energy = 1.0 +light_negative = false +light_specular = 0.5 +light_bake_mode = 1 +light_cull_mask = -1 +shadow_enabled = false +shadow_color = Color( 0, 0, 0, 1 ) +shadow_bias = 0.15 +shadow_contact = 0.0 +shadow_reverse_cull_face = false +editor_only = false +omni_range = 5.0 +omni_attenuation = 1.0 +omni_shadow_mode = 1 +omni_shadow_detail = 1 +_sections_unfolded = [ "Light", "Omni" ] + [node name="Mino1" type="MeshInstance" parent="." index="1"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 3, 0 ) diff --git a/Tetrominos/TetroI.gd b/Tetrominos/TetroI.gd new file mode 100644 index 0000000..6f67498 --- /dev/null +++ b/Tetrominos/TetroI.gd @@ -0,0 +1,70 @@ +extends "Tetromino.gd" + +const CLOCKWISE = -1 +const COUNTERCLOCKWISE = 1 +const SUPER_ROTATION_SYSTEM = [ + { + COUNTERCLOCKWISE: [ + Vector3(0, -1, 0), + Vector3(-1, -1, 0), + Vector3(2, -1, 0), + Vector3(-1, 1, 0), + Vector3(2, -2, 0) + ], + CLOCKWISE: [ + Vector3(1, 0, 0), + Vector3(-1, 0, 0), + Vector3(2, 0, 0), + Vector3(-1, -1, 0), + Vector3(2, 2, 0) + ], + }, + { + COUNTERCLOCKWISE: [ + Vector3(-1, 0, 0), + Vector3(1, 0, 0), + Vector3(-2, 0, 0), + Vector3(1, 1, 0), + Vector3(-2, -2, 0) + ], + CLOCKWISE: [ + Vector3(0, -1, 0), + Vector3(-1, -1, 0), + Vector3(2, -1, 0), + Vector3(-1, 1, 0), + Vector3(2, -2, 0) + ], + }, + { + COUNTERCLOCKWISE: [ + Vector3(0, 1, 0), + Vector3(1, 1, 0), + Vector3(-2, 1, 0), + Vector3(1, -1, 0), + Vector3(-2, 2, 0) + ], + CLOCKWISE: [ + Vector3(-1, 0, 0), + Vector3(1, 0, 0), + Vector3(-2, 0, 0), + Vector3(1, 1, 0), + Vector3(-2, -2, 0) + ], + }, + { + COUNTERCLOCKWISE: [ + Vector3(1, 0, 0), + Vector3(-1, 0, 0), + Vector3(2, 0, 0), + Vector3(-1, -1, 0), + Vector3(2, 2, 0) + ], + CLOCKWISE: [ + Vector3(0, 1, 0), + Vector3(1, 1, 0), + Vector3(-2, 1, 0), + Vector3(1, -1, 0), + Vector3(-2, 2, 0) + ], + }, +] \ No newline at end of file diff --git a/Tetrominos/TetroI.tscn b/Tetrominos/TetroI.tscn index 89df03d..cb9f948 100644 --- a/Tetrominos/TetroI.tscn +++ b/Tetrominos/TetroI.tscn @@ -1,9 +1,10 @@ [gd_scene load_steps=3 format=2] -[ext_resource path="res://TetroI.gd" type="Script" id=1] +[ext_resource path="res://Tetrominos/TetroI.gd" type="Script" id=1] [ext_resource path="res://Mino/Mino.tscn" type="PackedScene" id=2] + [node name="TetroI" type="Spatial" index="0"] script = ExtResource( 1 ) diff --git a/Tetrominos/Tetromino.gd b/Tetrominos/Tetromino.gd index b15560f..5016530 100644 --- a/Tetrominos/Tetromino.gd +++ b/Tetrominos/Tetromino.gd @@ -96,11 +96,8 @@ func rotated_positions(direction): translations.append(v) return translations -func rotation_movement_liberty(direction): - return SUPER_ROTATION_SYSTEM[orientation][direction] - func apply_positions(positions): - for i in range(4): + for i in range(NB_MINOES): minoes[i].translation = to_local(positions[i]) func move(movement): @@ -113,7 +110,7 @@ func move(movement): func rotate(direction): var rotated_positions = rotated_positions(direction) - var movements = rotation_movement_liberty(direction) + var movements = SUPER_ROTATION_SYSTEM[orientation][direction] var test_position for movement in movements: test_position = get_parent().possible_positions(rotated_positions, movement) @@ -123,4 +120,8 @@ func rotate(direction): apply_positions(rotated_positions) translate(movement) return true - return false \ No newline at end of file + return false + +func emit_trail(emit): + for mino in minoes: + mino.get_node("Trail").emitting = emit \ No newline at end of file diff --git a/WorldEnvironment.tscn b/WorldEnvironment.tscn index 6acecc9..5977bf4 100644 --- a/WorldEnvironment.tscn +++ b/WorldEnvironment.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=5 format=2] [ext_resource path="res://starmap_g8k.jpg" type="Texture" id=1] -[ext_resource path="res://GridMap.tscn" type="PackedScene" id=2] +[ext_resource path="res://GridMap/GridMap.tscn" type="PackedScene" id=2] [sub_resource type="PanoramaSky" id=1] @@ -18,7 +18,7 @@ background_color = Color( 0, 0, 0, 1 ) background_energy = 2.0 background_canvas_max_layer = 0 ambient_light_color = Color( 0.469971, 0.542197, 0.6875, 1 ) -ambient_light_energy = 3.0 +ambient_light_energy = 0.0 ambient_light_sky_contribution = 1.0 fog_enabled = false fog_color = Color( 0.5, 0.6, 0.7, 1 ) @@ -76,7 +76,7 @@ glow_levels/4 = false glow_levels/5 = true glow_levels/6 = false glow_levels/7 = false -glow_intensity = 0.8 +glow_intensity = 2.26 glow_strength = 1.0 glow_bloom = 0.0 glow_blend_mode = 2 @@ -84,10 +84,10 @@ glow_hdr_threshold = 1.0 glow_hdr_scale = 2.0 glow_bicubic_upscale = false adjustment_enabled = false -adjustment_brightness = 1.0 +adjustment_brightness = 0.35 adjustment_contrast = 1.0 -adjustment_saturation = 1.0 -_sections_unfolded = [ "Ambient Light", "Background", "Resource" ] +adjustment_saturation = 0.34 +_sections_unfolded = [ "Adjustments", "Ambient Light", "Background", "Fog", "Resource" ] [node name="WorldEnvironment" type="WorldEnvironment"] @@ -112,10 +112,10 @@ _sections_unfolded = [ "Transform" ] [node name="DirectionalLight" type="DirectionalLight" parent="." index="1"] -transform = Transform( 1, 0, 0, 0, 0.999391, -0.0348995, 0, 0.0348995, 0.999391, 5.89099, 23.8982, 41.835 ) +transform = Transform( 1, 0, 0, 0, 0.999391, -0.0348995, 0, 0.0348995, 0.999391, 0, 0, 50 ) layers = 1 light_color = Color( 1, 1, 1, 1 ) -light_energy = 0.3 +light_energy = 0.5 light_indirect_energy = 1.0 light_negative = false light_specular = 0.5 @@ -138,32 +138,8 @@ directional_shadow_depth_range = 0 directional_shadow_max_distance = 200.0 _sections_unfolded = [ "Light", "Transform" ] -[node name="SpotLight" type="SpotLight" parent="." index="2"] +[node name="GridMap" parent="." index="2" instance=ExtResource( 2 )] -transform = Transform( 1, 0, 0, 0, 0.999391, -0.0348995, 0, 0.0348995, 0.999391, 3, 16, 20 ) -layers = 1 -light_color = Color( 1, 1, 1, 1 ) -light_energy = 1.0 -light_indirect_energy = 1.0 -light_negative = false -light_specular = 0.5 -light_bake_mode = 1 -light_cull_mask = -1 -shadow_enabled = false -shadow_color = Color( 0, 0, 0, 1 ) -shadow_bias = 0.15 -shadow_contact = 0.0 -shadow_reverse_cull_face = false -editor_only = false -spot_range = 5.0 -spot_attenuation = 1.0 -spot_angle = 45.0 -spot_angle_attenuation = 1.0 -_sections_unfolded = [ "Light", "Transform" ] - -[node name="GridMap" parent="." index="3" instance=ExtResource( 2 )] - -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) data = { "cells": PoolIntArray( ) } diff --git a/default_bus_layout.tres b/default_bus_layout.tres new file mode 100644 index 0000000..0ba00c1 --- /dev/null +++ b/default_bus_layout.tres @@ -0,0 +1,29 @@ +[gd_resource type="AudioBusLayout" format=2] + +[resource] + +bus/0/name = "Master" +bus/0/solo = false +bus/0/mute = false +bus/0/bypass_fx = false +bus/0/volume_db = 0.0 +bus/0/send = "" +bus/1/name = "Music" +bus/1/solo = false +bus/1/mute = false +bus/1/bypass_fx = false +bus/1/volume_db = -16.8 +bus/1/send = "Master" +bus/2/name = "Music2" +bus/2/solo = false +bus/2/mute = false +bus/2/bypass_fx = false +bus/2/volume_db = 5.5 +bus/2/send = "Master" +bus/3/name = "SFX" +bus/3/solo = false +bus/3/mute = false +bus/3/bypass_fx = false +bus/3/volume_db = -11.3 +bus/3/send = "Master" + diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..df023d1 Binary files /dev/null and b/icon.png differ diff --git a/icon.png.import b/icon.png.import new file mode 100644 index 0000000..0041ef8 --- /dev/null +++ b/icon.png.import @@ -0,0 +1,29 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" + +[deps] + +source_file="res://icon.png" +dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0