Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
4dc5d2a753 | |||
d8faef57f1 | |||
8600318dc7 | |||
549a2c4efd | |||
68929207d8 | |||
4b290ad45b | |||
adbbf97f3c | |||
79ad3143f6 | |||
cb6eab47aa | |||
200e1df265 | |||
0681cc8f98 | |||
2df1cce500 | |||
a8e94191bc | |||
92d81ef547 | |||
2d7a427ba2 | |||
19e64e3948 |
@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
[Downloads](https://github.com/adrienmalin/TETRIS3000/releases)
|
[Downloads](https://github.com/adrienmalin/TETRIS3000/releases)
|
||||||
|
|
||||||
[Play in browser](https://adrienmalin.github.io/TETRIS3000/web/TETRIS3000.html)
|
[Play in browser](https://adrienmalin.github.io/TETRIS3000/web/TETRIS3000.html) (Firefox recommanded)
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ func print(text):
|
|||||||
$AnimationPlayer.play("Flash")
|
$AnimationPlayer.play("Flash")
|
||||||
|
|
||||||
func _on_AnimationPlayer_animation_finished(anim_name):
|
func _on_AnimationPlayer_animation_finished(anim_name):
|
||||||
texts.resize(0)
|
texts = PoolStringArray()
|
||||||
|
|
||||||
func _on_Stats_flash_text(text):
|
func _on_Stats_flash_text(text):
|
||||||
self.print(text)
|
self.print(text)
|
||||||
|
@ -83,20 +83,9 @@ func _unhandled_input(event):
|
|||||||
$AutoShiftDelay.stop()
|
$AutoShiftDelay.stop()
|
||||||
$AutoShiftTimer.stop()
|
$AutoShiftTimer.stop()
|
||||||
autoshift_action = ""
|
autoshift_action = ""
|
||||||
for action in movements:
|
process_new_action(Input)
|
||||||
if Input.is_action_pressed(action):
|
else:
|
||||||
autoshift_action = action
|
process_new_action(event)
|
||||||
process_autoshift()
|
|
||||||
$AutoShiftDelay.start()
|
|
||||||
break
|
|
||||||
for action in movements:
|
|
||||||
if action != autoshift_action:
|
|
||||||
if event.is_action_pressed(action):
|
|
||||||
$AutoShiftTimer.stop()
|
|
||||||
autoshift_action = action
|
|
||||||
process_autoshift()
|
|
||||||
$AutoShiftDelay.start()
|
|
||||||
break
|
|
||||||
if event.is_action_pressed("hard_drop"):
|
if event.is_action_pressed("hard_drop"):
|
||||||
hard_drop()
|
hard_drop()
|
||||||
if event.is_action_pressed("rotate_clockwise"):
|
if event.is_action_pressed("rotate_clockwise"):
|
||||||
@ -105,6 +94,15 @@ func _unhandled_input(event):
|
|||||||
current_piece.turn(Tetromino.COUNTERCLOCKWISE)
|
current_piece.turn(Tetromino.COUNTERCLOCKWISE)
|
||||||
if event.is_action_pressed("hold"):
|
if event.is_action_pressed("hold"):
|
||||||
hold()
|
hold()
|
||||||
|
|
||||||
|
func process_new_action(event):
|
||||||
|
for action in movements:
|
||||||
|
if action != autoshift_action and event.is_action_pressed(action):
|
||||||
|
$AutoShiftTimer.stop()
|
||||||
|
autoshift_action = action
|
||||||
|
process_autoshift()
|
||||||
|
$AutoShiftDelay.start()
|
||||||
|
break
|
||||||
|
|
||||||
func _on_AutoShiftDelay_timeout():
|
func _on_AutoShiftDelay_timeout():
|
||||||
if autoshift_action:
|
if autoshift_action:
|
||||||
@ -125,9 +123,17 @@ func hard_drop():
|
|||||||
while current_piece.move(movements["soft_drop"]):
|
while current_piece.move(movements["soft_drop"]):
|
||||||
score += 2
|
score += 2
|
||||||
$Stats.piece_dropped(score)
|
$Stats.piece_dropped(score)
|
||||||
|
var translations = current_piece.get_translations()
|
||||||
|
for i in range(Tetromino.NB_MINOES):
|
||||||
|
get_node("DropTrail/"+str(i)).translation = translations[i]
|
||||||
|
$DropTrail.visible = true
|
||||||
|
$DropTrail/Delay.start()
|
||||||
$LockDelay.stop()
|
$LockDelay.stop()
|
||||||
lock()
|
lock()
|
||||||
|
|
||||||
|
func _on_DropTrailDelay_timeout():
|
||||||
|
$DropTrail.visible = false
|
||||||
|
|
||||||
func _on_DropTimer_timeout():
|
func _on_DropTimer_timeout():
|
||||||
if not current_piece.move(movements["soft_drop"]):
|
if not current_piece.move(movements["soft_drop"]):
|
||||||
if $LockDelay.is_stopped():
|
if $LockDelay.is_stopped():
|
||||||
|
171
source/Main.tscn
171
source/Main.tscn
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=20 format=2]
|
[gd_scene load_steps=21 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Environment.tres" type="Environment" id=1]
|
[ext_resource path="res://Environment.tres" type="Environment" id=1]
|
||||||
[ext_resource path="res://Main.gd" type="Script" id=2]
|
[ext_resource path="res://Main.gd" type="Script" id=2]
|
||||||
@ -13,6 +13,7 @@
|
|||||||
[ext_resource path="res://controls.tscn" type="PackedScene" id=11]
|
[ext_resource path="res://controls.tscn" type="PackedScene" id=11]
|
||||||
[ext_resource path="res://Start.tscn" type="PackedScene" id=12]
|
[ext_resource path="res://Start.tscn" type="PackedScene" id=12]
|
||||||
[ext_resource path="res://fonts/Gamer.ttf" type="DynamicFontData" id=13]
|
[ext_resource path="res://fonts/Gamer.ttf" type="DynamicFontData" id=13]
|
||||||
|
[ext_resource path="res://Tetrominos/drop_trail.png" type="Texture" id=14]
|
||||||
|
|
||||||
[sub_resource type="SpatialMaterial" id=1]
|
[sub_resource type="SpatialMaterial" id=1]
|
||||||
|
|
||||||
@ -443,10 +444,10 @@ anchor_left = 1.0
|
|||||||
anchor_top = 1.0
|
anchor_top = 1.0
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
margin_left = -215.0
|
margin_left = -170.0
|
||||||
margin_top = -100.0
|
margin_top = -90.0
|
||||||
margin_right = -90.0
|
margin_right = -45.0
|
||||||
margin_bottom = -60.0
|
margin_bottom = -50.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
focus_mode = 2
|
focus_mode = 2
|
||||||
@ -465,6 +466,164 @@ flat = false
|
|||||||
align = 1
|
align = 1
|
||||||
_sections_unfolded = [ "Margin", "custom_colors", "custom_fonts" ]
|
_sections_unfolded = [ "Margin", "custom_colors", "custom_fonts" ]
|
||||||
|
|
||||||
|
[node name="DropTrail" type="Spatial" parent="." index="16"]
|
||||||
|
|
||||||
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
|
[node name="0" type="Spatial" parent="DropTrail" index="0"]
|
||||||
|
|
||||||
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite3D" parent="DropTrail/0" index="0"]
|
||||||
|
|
||||||
|
transform = Transform( 3, 0, 0, 0, 5, 0, 0, 0, 1, 0, 6, 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
|
||||||
|
centered = true
|
||||||
|
offset = Vector2( 0, 0 )
|
||||||
|
flip_h = false
|
||||||
|
flip_v = false
|
||||||
|
modulate = Color( 1, 1, 1, 1 )
|
||||||
|
opacity = 0.3
|
||||||
|
pixel_size = 0.01
|
||||||
|
axis = 2
|
||||||
|
transparent = true
|
||||||
|
shaded = false
|
||||||
|
double_sided = true
|
||||||
|
alpha_cut = 0
|
||||||
|
texture = ExtResource( 14 )
|
||||||
|
vframes = 1
|
||||||
|
hframes = 1
|
||||||
|
frame = 0
|
||||||
|
region_enabled = false
|
||||||
|
region_rect = Rect2( 0, 0, 0, 0 )
|
||||||
|
_sections_unfolded = [ "Flags", "Transform" ]
|
||||||
|
|
||||||
|
[node name="1" type="Spatial" parent="DropTrail" index="1"]
|
||||||
|
|
||||||
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0 )
|
||||||
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite3D" parent="DropTrail/1" index="0"]
|
||||||
|
|
||||||
|
transform = Transform( 3, 0, 0, 0, 5, 0, 0, 0, 1, 0, 6, 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
|
||||||
|
centered = true
|
||||||
|
offset = Vector2( 0, 0 )
|
||||||
|
flip_h = false
|
||||||
|
flip_v = false
|
||||||
|
modulate = Color( 1, 1, 1, 1 )
|
||||||
|
opacity = 0.3
|
||||||
|
pixel_size = 0.01
|
||||||
|
axis = 2
|
||||||
|
transparent = true
|
||||||
|
shaded = false
|
||||||
|
double_sided = true
|
||||||
|
alpha_cut = 0
|
||||||
|
texture = ExtResource( 14 )
|
||||||
|
vframes = 1
|
||||||
|
hframes = 1
|
||||||
|
frame = 0
|
||||||
|
region_enabled = false
|
||||||
|
region_rect = Rect2( 0, 0, 0, 0 )
|
||||||
|
_sections_unfolded = [ "Flags", "Transform" ]
|
||||||
|
|
||||||
|
[node name="2" type="Spatial" parent="DropTrail" index="2"]
|
||||||
|
|
||||||
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0 )
|
||||||
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite3D" parent="DropTrail/2" index="0"]
|
||||||
|
|
||||||
|
transform = Transform( 3, 0, 0, 0, 5, 0, 0, 0, 1, 0, 6, 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
|
||||||
|
centered = true
|
||||||
|
offset = Vector2( 0, 0 )
|
||||||
|
flip_h = false
|
||||||
|
flip_v = false
|
||||||
|
modulate = Color( 1, 1, 1, 1 )
|
||||||
|
opacity = 0.3
|
||||||
|
pixel_size = 0.01
|
||||||
|
axis = 2
|
||||||
|
transparent = true
|
||||||
|
shaded = false
|
||||||
|
double_sided = true
|
||||||
|
alpha_cut = 0
|
||||||
|
texture = ExtResource( 14 )
|
||||||
|
vframes = 1
|
||||||
|
hframes = 1
|
||||||
|
frame = 0
|
||||||
|
region_enabled = false
|
||||||
|
region_rect = Rect2( 0, 0, 0, 0 )
|
||||||
|
_sections_unfolded = [ "Flags", "Transform" ]
|
||||||
|
|
||||||
|
[node name="3" type="Spatial" parent="DropTrail" index="3"]
|
||||||
|
|
||||||
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0 )
|
||||||
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite3D" parent="DropTrail/3" index="0"]
|
||||||
|
|
||||||
|
transform = Transform( 3, 0, 0, 0, 5, 0, 0, 0, 1, 0, 6, 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
|
||||||
|
centered = true
|
||||||
|
offset = Vector2( 0, 0 )
|
||||||
|
flip_h = false
|
||||||
|
flip_v = false
|
||||||
|
modulate = Color( 1, 1, 1, 1 )
|
||||||
|
opacity = 0.3
|
||||||
|
pixel_size = 0.01
|
||||||
|
axis = 2
|
||||||
|
transparent = true
|
||||||
|
shaded = false
|
||||||
|
double_sided = true
|
||||||
|
alpha_cut = 0
|
||||||
|
texture = ExtResource( 14 )
|
||||||
|
vframes = 1
|
||||||
|
hframes = 1
|
||||||
|
frame = 0
|
||||||
|
region_enabled = false
|
||||||
|
region_rect = Rect2( 0, 0, 0, 0 )
|
||||||
|
_sections_unfolded = [ "Flags", "Transform" ]
|
||||||
|
|
||||||
|
[node name="Delay" type="Timer" parent="DropTrail" index="4"]
|
||||||
|
|
||||||
|
process_mode = 1
|
||||||
|
wait_time = 0.06
|
||||||
|
one_shot = true
|
||||||
|
autostart = false
|
||||||
|
|
||||||
[connection signal="timeout" from="DropTimer" to="." method="_on_DropTimer_timeout"]
|
[connection signal="timeout" from="DropTimer" to="." method="_on_DropTimer_timeout"]
|
||||||
|
|
||||||
[connection signal="timeout" from="AutoShiftDelay" to="." method="_on_AutoShiftDelay_timeout"]
|
[connection signal="timeout" from="AutoShiftDelay" to="." method="_on_AutoShiftDelay_timeout"]
|
||||||
@ -483,4 +642,6 @@ _sections_unfolded = [ "Margin", "custom_colors", "custom_fonts" ]
|
|||||||
|
|
||||||
[connection signal="pressed" from="ReplayButton" to="." method="_on_ReplayButton_pressed"]
|
[connection signal="pressed" from="ReplayButton" to="." method="_on_ReplayButton_pressed"]
|
||||||
|
|
||||||
|
[connection signal="timeout" from="DropTrail/Delay" to="." method="_on_DropTrailDelay_timeout"]
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ 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, -30, 5 )
|
gravity = Vector3( 0, -40, 0 )
|
||||||
initial_velocity = 100.0
|
initial_velocity = 100.0
|
||||||
initial_velocity_random = 1.0
|
initial_velocity_random = 1.0
|
||||||
angular_velocity = 210.0
|
angular_velocity = 210.0
|
||||||
|
BIN
source/Tetrominos/drop_trail.png
Normal file
BIN
source/Tetrominos/drop_trail.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 396 KiB |
@ -10,7 +10,7 @@
|
|||||||
border: 0 none;
|
border: 0 none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background-color: #222226;
|
background-color: #000000;
|
||||||
font-family: 'Noto Sans', Arial, sans-serif;
|
font-family: 'Noto Sans', Arial, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
.godot {
|
.godot {
|
||||||
color: #e0e0e0;
|
color: #e0e0e0;
|
||||||
background-color: #3b3943;
|
background-color: #000000;
|
||||||
background-image: linear-gradient(to bottom, #403e48, #35333c);
|
background-image: linear-gradient(to bottom, #403e48, #35333c);
|
||||||
border: 1px solid #45434e;
|
border: 1px solid #45434e;
|
||||||
box-shadow: 0 0 1px 1px #2f2d35;
|
box-shadow: 0 0 1px 1px #2f2d35;
|
||||||
@ -65,6 +65,8 @@
|
|||||||
* ================ */
|
* ================ */
|
||||||
|
|
||||||
#container {
|
#container {
|
||||||
|
background-image: url("TETRIS3000.png");
|
||||||
|
background-size: 100% 100%;
|
||||||
display: inline-block; /* scale with canvas */
|
display: inline-block; /* scale with canvas */
|
||||||
vertical-align: top; /* prevent extra height */
|
vertical-align: top; /* prevent extra height */
|
||||||
position: relative; /* root for absolutely positioned overlay */
|
position: relative; /* root for absolutely positioned overlay */
|
||||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 396 KiB |
Reference in New Issue
Block a user