This commit is contained in:
adrienmalin 2019-01-06 02:14:39 +01:00
parent 6b8a92003e
commit ea0b840f35
15 changed files with 51 additions and 125 deletions

View File

@ -45,14 +45,15 @@ func lock(piece):
set_cell_item(position.x, position.y, 0, MINO)
func clear_lines():
var nb_minoes
var line_cleared
var lines_cleared = 0
for y in range(NB_LINES-1, -1, -1):
nb_minoes = 0
line_cleared = true
for x in range(NB_COLLUMNS):
if get_cell_item(x, y, 0) == MINO:
nb_minoes += 1
if nb_minoes == NB_COLLUMNS:
if not get_cell_item(x, y, 0) == MINO:
line_cleared = false
break
if line_cleared:
for y2 in range(y, NB_LINES+2):
for x in range(NB_COLLUMNS):
set_cell_item(x, y2, 0, get_cell_item(x, y2+1, 0))

18
Main.gd
View File

@ -18,7 +18,7 @@ const HOLD_POSITION = Vector3(-5, 16, 0)
const movements = {
"move_right": Vector3(1, 0, 0),
"move_left": Vector3(-1, 0, 0),
"soft_drop": Vector3(0, -1, 0)
"drop": Vector3(0, -1, 0)
}
var random_bag = []
@ -26,7 +26,7 @@ var random_bag = []
var next_piece
var current_piece
var held_piece
var current_piece_held = false
var current_piece_held
var autoshift_action = ""
@ -53,6 +53,7 @@ func _on_Start_start(level):
if held_piece:
remove_child(held_piece)
held_piece = null
current_piece_held = false
next_piece = random_piece()
new_piece()
$MidiPlayer.position = 0
@ -69,11 +70,12 @@ func new_piece():
autoshift_action = ""
next_piece = random_piece()
next_piece.translation = NEXT_POSITION
if move(movements["soft_drop"]):
if move(movements["drop"]):
$DropTimer.start()
$LockDelay.start()
current_piece_held = false
else:
current_piece.translate(movements["drop"])
game_over()
func random_piece():
@ -100,6 +102,8 @@ func _process(delta):
$controls_ui.visible = true
elif $controls_ui.enable_resume:
resume()
if Input.is_action_just_pressed("toggle_fullscreen"):
OS.window_fullscreen = !OS.window_fullscreen
if playing:
for action in movements:
if action == autoshift_action:
@ -136,13 +140,13 @@ func _on_AutoShiftTimer_timeout():
func process_autoshift_action():
if move(movements[autoshift_action]):
$MidiPlayer.move()
if autoshift_action == "soft_drop":
if autoshift_action == "drop":
emit_signal("piece_dropped", 1)
func hard_drop():
$MidiPlayer.move()
var score = 0
while move(movements["soft_drop"]):
while move(movements["drop"]):
score += 2
emit_signal("piece_dropped", score)
lock()
@ -162,10 +166,10 @@ func rotate(direction):
return false
func _on_DropTimer_timeout():
move(movements["soft_drop"])
move(movements["drop"])
func _on_LockDelay_timeout():
if not move(movements["soft_drop"]):
if not move(movements["drop"]):
lock()
func lock():

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=21 format=2]
[ext_resource path="res://starmap_g8k.jpg" type="Texture" id=1]
[ext_resource path="res://starmap_g4k_print.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.gd" type="Script" id=4]
@ -15,7 +15,7 @@
[sub_resource type="PanoramaSky" id=1]
radiance_size = 4
radiance_size = 0
panorama = ExtResource( 1 )
[sub_resource type="Environment" id=2]
@ -24,12 +24,12 @@ resource_local_to_scene = true
background_mode = 2
background_sky = SubResource( 1 )
background_sky_custom_fov = 0.0
background_color = Color( 0, 0, 0, 1 )
background_energy = 3.0
background_color = Color( 0.409546, 0.764489, 0.859375, 1 )
background_energy = 1.0
background_canvas_max_layer = 0
ambient_light_color = Color( 0.469971, 0.542197, 0.6875, 1 )
ambient_light_energy = 0.0
ambient_light_sky_contribution = 1.0
ambient_light_color = Color( 0.794922, 0.978371, 1, 1 )
ambient_light_energy = 16.0
ambient_light_sky_contribution = 0.92
fog_enabled = false
fog_color = Color( 0.5, 0.6, 0.7, 1 )
fog_sun_color = Color( 1, 0.9, 0.7, 1 )
@ -43,13 +43,13 @@ fog_height_enabled = false
fog_height_min = 0.0
fog_height_max = 100.0
fog_height_curve = 1.0
tonemap_mode = 0
tonemap_mode = 3
tonemap_exposure = 1.0
tonemap_white = 1.0
auto_exposure_enabled = false
auto_exposure_scale = 0.4
auto_exposure_min_luma = 0.05
auto_exposure_max_luma = 8.0
auto_exposure_max_luma = 0.26
auto_exposure_speed = 0.5
ss_reflections_enabled = false
ss_reflections_max_steps = 64
@ -86,7 +86,7 @@ glow_levels/4 = false
glow_levels/5 = true
glow_levels/6 = false
glow_levels/7 = false
glow_intensity = 2.26
glow_intensity = 6.17
glow_strength = 1.0
glow_bloom = 0.0
glow_blend_mode = 2
@ -94,10 +94,10 @@ glow_hdr_threshold = 1.0
glow_hdr_scale = 2.0
glow_bicubic_upscale = false
adjustment_enabled = false
adjustment_brightness = 0.35
adjustment_brightness = 0.27
adjustment_contrast = 1.0
adjustment_saturation = 0.34
_sections_unfolded = [ "Adjustments", "Ambient Light", "Background", "Fog", "Resource" ]
_sections_unfolded = [ "Adjustments", "Ambient Light", "Background", "Resource" ]
[sub_resource type="SpatialMaterial" id=3]
@ -230,7 +230,7 @@ extra_spacing_bottom = 5
font_data = ExtResource( 11 )
_sections_unfolded = [ "Extra Spacing", "Font", "Settings" ]
[node name="Main" type="WorldEnvironment" index="0"]
[node name="Main" type="WorldEnvironment"]
environment = SubResource( 2 )
script = ExtResource( 2 )
@ -245,7 +245,7 @@ h_offset = 0.0
v_offset = 0.0
doppler_tracking = 0
projection = 0
current = false
current = true
fov = 100.0
size = 1.0
near = 0.05
@ -254,7 +254,7 @@ _sections_unfolded = [ "Transform" ]
[node name="DirectionalLight" type="DirectionalLight" parent="." index="1"]
transform = Transform( 0.376951, 0.677372, -0.631724, -0.295744, 0.734355, 0.610949, 0.877749, -0.0434695, 0.477145, -20, 30, 0 )
transform = Transform( 0.332668, 0.771982, -0.541642, 0.579657, 0.285656, 0.763151, 0.743861, -0.567843, -0.352456, 2.01163, 29.4451, 0 )
layers = 1
light_color = Color( 1, 1, 1, 1 )
light_energy = 3.0
@ -305,7 +305,6 @@ NB_COLLUMNS = 10
[node name="Backs" type="Spatial" parent="." index="3"]
editor/display_folded = true
visible = false
[node name="GridBack" type="MeshInstance" parent="Backs" index="0"]
@ -420,6 +419,7 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
script = ExtResource( 7 )
_sections_unfolded = [ "Material", "Size Flags", "Theme" ]
[node name="Label" type="Label" parent="FlashText" index="0"]
@ -497,10 +497,10 @@ _sections_unfolded = [ "Margin", "custom_colors", "custom_fonts" ]
[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"]

View File

@ -17,7 +17,7 @@ _sections_unfolded = [ "Extra Spacing", "Font", "Font/fallback", "Settings" ]
default_font = SubResource( 1 )
[node name="Start" type="Control"]
[node name="Start" type="Control" index="0"]
anchor_left = 0.5
anchor_top = 0.5
@ -68,9 +68,9 @@ anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -78.0
margin_left = -83.0
margin_top = -20.0
margin_right = 118.0
margin_right = 113.0
margin_bottom = 17.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
@ -97,9 +97,9 @@ anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -80.0
margin_left = -85.0
margin_top = 29.0
margin_right = 90.0
margin_right = 85.0
margin_bottom = 69.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false

View File

@ -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.18
metallic_specular = 1.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" ]

View File

@ -123,7 +123,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.0196078 )
albedo_color = Color( 0.601563, 0.775878, 1, 0.0045098 )
metallic = 0.68
metallic_specular = 1.0
metallic_texture_channel = 0
@ -162,7 +162,7 @@ subdivide_width = 0
subdivide_height = 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 )
_sections_unfolded = [ "Pause", "Transform", "Visibility" ]

View File

@ -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.162157 )
albedo_color = Color( 0.601563, 0.775878, 1, 0.486471 )
metallic = 1.0
metallic_specular = 1.0
metallic_texture_channel = 4
@ -31,7 +31,7 @@ roughness = 0.46
roughness_texture_channel = 0
emission_enabled = true
emission = Color( 0.755859, 1, 0.914169, 1 )
emission_energy = 1.0
emission_energy = 0.2
emission_operator = 0
emission_on_uv2 = false
normal_enabled = false

View File

@ -19,8 +19,10 @@ config/icon="res://icons/48.png"
window/size/width=500
window/size/height=500
window/vsync/use_vsync=false
window/stretch/mode="2d"
window/stretch/aspect="expand"
window/stretch/shrink="1"
[gui]
@ -44,7 +46,10 @@ rotate_clockwise=[ Object(InputEventKey,"resource_local_to_scene":false,"resourc
]
rotate_counterclockwise=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777238,"unicode":0,"echo":false,"script":null)
]
toggle_fullscreen=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":true,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"unicode":0,"echo":false,"script":null)
]
[rendering]
threads/thread_model=2
environment/default_clear_color=Color( 0, 0, 0, 1 )

BIN
starmap_g4k_print.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 MiB

View File

@ -1,29 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/starmap_g8k.jpg-617060714ab9f6908ea55c401bab327a.stex"
[deps]
source_file="res://starmap_g8k.jpg"
dest_files=[ "res://.import/starmap_g8k.jpg-617060714ab9f6908ea55c401bab327a.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

View File

@ -230,7 +230,7 @@
(function() {
const BASENAME = 'TETRIS3000';
const DEBUG_ENABLED = true;
const DEBUG_ENABLED = false;
const INDETERMINATE_STATUS_STEP_MS = 100;
var container = document.getElementById('container');

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.