Exploding minoes instead of lines
This commit is contained in:
		| @ -1,12 +1,12 @@ | |||||||
| extends GridMap | extends GridMap | ||||||
|  |  | ||||||
| const Tetromino = preload("res://Tetrominos/Tetromino.gd") | const Tetromino = preload("res://Tetrominos/Tetromino.gd") | ||||||
| const ExplodingLine = preload("res://ExplodingLine.tscn") | const ExplodingMino = preload("res://Tetrominos/Mino/ExplodingMino.tscn") | ||||||
|  |  | ||||||
| const EMPTY_CELL = -1 | const EMPTY_CELL = -1 | ||||||
| const MINO = 0 | const MINO = 0 | ||||||
|  |  | ||||||
| var exploding_lines = [] | var exploding_minoes = [] | ||||||
| var nb_collumns | var nb_collumns | ||||||
| var nb_lines | var nb_lines | ||||||
|  |  | ||||||
| @ -14,9 +14,11 @@ func _ready(): | |||||||
| 	nb_collumns = int(get_parent().scale.x) | 	nb_collumns = int(get_parent().scale.x) | ||||||
| 	nb_lines = int(get_parent().scale.y) | 	nb_lines = int(get_parent().scale.y) | ||||||
| 	for y in range(nb_lines): | 	for y in range(nb_lines): | ||||||
| 		exploding_lines.append(ExplodingLine.instance()) | 		exploding_minoes.append([]) | ||||||
| 		add_child(exploding_lines[y]) | 		for x in range(nb_collumns): | ||||||
| 		exploding_lines[y].translation = Vector3(nb_collumns/2, y, 1) | 			exploding_minoes[y].append(ExplodingMino.instance()) | ||||||
|  | 			add_child(exploding_minoes[y][x]) | ||||||
|  | 			exploding_minoes[y][x].translation = Vector3(x, y, 0) | ||||||
|  |  | ||||||
| func clear(): | func clear(): | ||||||
| 	for used_cell in get_used_cells(): | 	for used_cell in get_used_cells(): | ||||||
| @ -65,6 +67,7 @@ func clear_lines(): | |||||||
| 					var above_cell = get_cell_item(x, y2+1, 0) | 					var above_cell = get_cell_item(x, y2+1, 0) | ||||||
| 					set_cell_item(x, y2, 0, above_cell) | 					set_cell_item(x, y2, 0, above_cell) | ||||||
| 			lines_cleared += 1 | 			lines_cleared += 1 | ||||||
| 			exploding_lines[y].emitting = true | 			for x in range(nb_collumns): | ||||||
| 			exploding_lines[y].restart() | 				exploding_minoes[y][x].emitting = true | ||||||
|  | 				exploding_minoes[y][x].restart() | ||||||
| 	return lines_cleared | 	return lines_cleared | ||||||
| @ -145,7 +145,7 @@ extra_spacing_bottom = 5 | |||||||
| font_data = ExtResource( 13 ) | font_data = ExtResource( 13 ) | ||||||
| _sections_unfolded = [ "Extra Spacing", "Font", "Settings" ] | _sections_unfolded = [ "Extra Spacing", "Font", "Settings" ] | ||||||
|  |  | ||||||
| [node name="Main" type="WorldEnvironment" index="0"] | [node name="Main" type="WorldEnvironment"] | ||||||
|  |  | ||||||
| environment = ExtResource( 1 ) | environment = ExtResource( 1 ) | ||||||
| script = ExtResource( 2 ) | script = ExtResource( 2 ) | ||||||
|  | |||||||
| @ -30,16 +30,16 @@ render_priority = 0 | |||||||
| trail_divisor = 2 | trail_divisor = 2 | ||||||
| trail_color_modifier = SubResource( 4 ) | trail_color_modifier = SubResource( 4 ) | ||||||
| emission_shape = 2 | emission_shape = 2 | ||||||
| emission_box_extents = Vector3( 10, 1, 1 ) | emission_box_extents = Vector3( 1, 1, 1 ) | ||||||
| flag_align_y = false | flag_align_y = false | ||||||
| flag_rotate_y = true | flag_rotate_y = true | ||||||
| flag_disable_z = false | flag_disable_z = false | ||||||
| spread = 0.0 | spread = 0.0 | ||||||
| flatness = 0.0 | flatness = 0.0 | ||||||
| gravity = Vector3( 0, -10, 30 ) | gravity = Vector3( 0, -5, 20 ) | ||||||
| initial_velocity = 20.0 | initial_velocity = 100.0 | ||||||
| initial_velocity_random = 1.0 | initial_velocity_random = 1.0 | ||||||
| angular_velocity = 97.14 | angular_velocity = 210.0 | ||||||
| angular_velocity_random = 1.0 | angular_velocity_random = 1.0 | ||||||
| linear_accel = 100.0 | linear_accel = 100.0 | ||||||
| linear_accel_random = 1.0 | linear_accel_random = 1.0 | ||||||
| @ -61,9 +61,9 @@ anim_speed_random = 0.0 | |||||||
| anim_offset = 0.0 | anim_offset = 0.0 | ||||||
| anim_offset_random = 0.0 | anim_offset_random = 0.0 | ||||||
| anim_loop = false | anim_loop = false | ||||||
| _sections_unfolded = [ "Angular Velocity", "Color", "Gravity", "Initial Velocity", "Linear Accel", "Scale", "Spread" ] | _sections_unfolded = [ "Angular Velocity", "Color", "Emission Shape", "Gravity", "Initial Velocity", "Linear Accel", "Scale", "Spread" ] | ||||||
| 
 | 
 | ||||||
| [node name="ExplodingLine" type="Particles" index="0"] | [node name="ExplodingMino" type="Particles" index="0"] | ||||||
| 
 | 
 | ||||||
| layers = 1 | layers = 1 | ||||||
| material_override = null | material_override = null | ||||||
| @ -75,7 +75,7 @@ lod_min_hysteresis = 0.0 | |||||||
| lod_max_distance = 0.0 | lod_max_distance = 0.0 | ||||||
| lod_max_hysteresis = 0.0 | lod_max_hysteresis = 0.0 | ||||||
| emitting = false | emitting = false | ||||||
| amount = 40 | amount = 1 | ||||||
| lifetime = 2.0 | lifetime = 2.0 | ||||||
| one_shot = true | one_shot = true | ||||||
| preprocess = 0.0 | preprocess = 0.0 | ||||||
| @ -84,7 +84,7 @@ explosiveness = 1.0 | |||||||
| randomness = 0.0 | randomness = 0.0 | ||||||
| fixed_fps = 0 | fixed_fps = 0 | ||||||
| fract_delta = true | fract_delta = true | ||||||
| visibility_aabb = AABB( -5, -0.5, -1, 10, 1, 2 ) | visibility_aabb = AABB( -0.5, -0.5, -0.5, 1, 1, 1 ) | ||||||
| local_coords = false | local_coords = false | ||||||
| draw_order = 0 | draw_order = 0 | ||||||
| process_material = SubResource( 5 ) | process_material = SubResource( 5 ) | ||||||
| @ -162,7 +162,7 @@ subdivide_width = 0 | |||||||
| subdivide_height = 0 | subdivide_height = 0 | ||||||
| subdivide_depth = 0 | subdivide_depth = 0 | ||||||
|  |  | ||||||
| [node name="Mino" type="Spatial"] | [node name="Mino" type="Spatial" index="0"] | ||||||
|  |  | ||||||
| transform = Transform( 0.997027, 0, 0, 0, 0.997027, 0, 0, 0, 0.997027, 0, 0, 0 ) | transform = Transform( 0.997027, 0, 0, 0, 0.997027, 0, 0, 0, 0.997027, 0, 0, 0 ) | ||||||
| _sections_unfolded = [ "Pause", "Transform", "Visibility" ] | _sections_unfolded = [ "Pause", "Transform", "Visibility" ] | ||||||
| @ -204,7 +204,7 @@ _sections_unfolded = [ "Draw Passes", "Drawing", "Geometry", "LOD", "Process Mat | |||||||
|  |  | ||||||
| [node name="SpotLight" type="SpotLight" parent="." index="2"] | [node name="SpotLight" type="SpotLight" parent="." index="2"] | ||||||
|  |  | ||||||
| transform = Transform( 1, 0, 0, 0, -4.37114e-008, 1, 0, -1, -4.37114e-008, 0, 0, 0.5 ) | transform = Transform( 1, 0, 0, 0, -4.37114e-008, 1, 0, -1, -4.37114e-008, 0, -0.5, 0.5 ) | ||||||
| layers = 1 | layers = 1 | ||||||
| light_color = Color( 1, 1, 1, 1 ) | light_color = Color( 1, 1, 1, 1 ) | ||||||
| light_energy = 16.0 | light_energy = 16.0 | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user