Skip to content

Commit bf97441

Browse files
author
gerblesh
committed
Merge branch 'main' of https://github.com/gerblesh/sextris
2 parents 61fda75 + 01cf699 commit bf97441

File tree

6 files changed

+66
-56
lines changed

6 files changed

+66
-56
lines changed

MAIN.tscn

+33-30
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
[ext_resource type="Script" path="res://blocks.gd" id="2_7cxfx"]
44
[ext_resource type="Script" path="res://Models/trigger/trigger_manager.gd" id="6_gro3x"]
55

6-
[sub_resource type="Environment" id="Environment_mv7jf"]
7-
background_mode = 2
8-
ambient_light_source = 2
9-
ambient_light_color = Color(0.611765, 0.611765, 0.611765, 1)
10-
tonemap_mode = 2
11-
glow_enabled = true
12-
136
[sub_resource type="BoxShape3D" id="BoxShape3D_dseq0"]
147
size = Vector3(4, 1, 42)
158

@@ -26,36 +19,28 @@ margin = 0.05
2619
data = PackedVector3Array(1.15, 40, 20.1, -1.15, 40, 20.1, -1.15, -40, 20.1, 1.15, -40, 20.1, 1.15, 40, 20.1, -1.15, -40, 20.1, -1.15, 40, -20.1, 1.15, 40, -20.1, 1.15, -40, -20.1, -1.15, -40, -20.1, -1.15, 40, -20.1, 1.15, -40, -20.1, 1.15, 40, -20.1, 1.15, 40, 20.1, 1.15, -40, 20.1, 1.15, -40, -20.1, 1.15, 40, -20.1, 1.15, -40, 20.1, -1.15, 40, 20.1, -1.15, 40, -20.1, -1.15, -40, -20.1, -1.15, -40, 20.1, -1.15, 40, 20.1, -1.15, -40, -20.1, -1.15, 40, 20.1, 1.15, 40, 20.1, 1.15, 40, -20.1, -1.15, 40, -20.1, -1.15, 40, 20.1, 1.15, 40, -20.1, 1.15, -40, 20.1, -1.15, -40, 20.1, -1.15, -40, -20.1, 1.15, -40, -20.1, 1.15, -40, 20.1, -1.15, -40, -20.1)
2720
backface_collision = true
2821

29-
[node name="MAIN" type="Node3D"]
30-
31-
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
32-
transform = Transform3D(-0.866025, -0.433013, 0.25, 0, 0.5, 0.866025, -0.5, 0.75, -0.433013, 0, 0, 0)
33-
shadow_enabled = true
34-
directional_shadow_max_distance = 250.0
35-
36-
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
37-
environment = SubResource( "Environment_mv7jf" )
22+
[sub_resource type="Environment" id="Environment_mv7jf"]
23+
background_mode = 2
24+
ambient_light_source = 2
25+
ambient_light_color = Color(0.611765, 0.611765, 0.611765, 1)
26+
tonemap_mode = 2
27+
glow_enabled = true
3828

39-
[node name="Timer" type="Timer" parent="."]
40-
process_callback = 0
41-
wait_time = 0.2
42-
autostart = true
29+
[node name="MAIN" type="Node3D"]
4330

44-
[node name="Camera3D" type="Camera3D" parent="."]
45-
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 15, 14.4, 0)
46-
fov = 100.0
31+
[node name="Node3D" type="Node3D" parent="."]
4732

48-
[node name="trigger_manager" type="Node3D" parent="Camera3D"]
49-
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 12, -15)
33+
[node name="trigger_manager" type="Node3D" parent="Node3D"]
34+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 73.3997, 6.55671e-07)
5035
script = ExtResource( "6_gro3x" )
5136

52-
[node name="trigger" type="Area3D" parent="Camera3D/trigger_manager"]
37+
[node name="trigger" type="Area3D" parent="Node3D/trigger_manager"]
5338

54-
[node name="CollisionShape3D" type="CollisionShape3D" parent="Camera3D/trigger_manager/trigger"]
39+
[node name="CollisionShape3D" type="CollisionShape3D" parent="Node3D/trigger_manager/trigger"]
5540
shape = SubResource( "BoxShape3D_dseq0" )
5641

57-
[node name="blocks" type="Node3D" parent="Camera3D"]
58-
transform = Transform3D(0, 0, 1, 0, 1, 0, -1, 0, 0, 0, 10, -15)
42+
[node name="blocks" type="Node3D" parent="Node3D"]
43+
transform = Transform3D(-1, 0, -4.37114e-08, 0, 1, 0, 4.37114e-08, 0, -1, 0, 72.7373, 6.55671e-07)
5944
script = ExtResource( "2_7cxfx" )
6045

6146
[node name="box" type="MeshInstance3D" parent="."]
@@ -70,4 +55,22 @@ collision_mask = 0
7055
[node name="@@33914" type="CollisionShape3D" parent="box/StaticBody3D"]
7156
shape = SubResource( "ConcavePolygonShape3D_fuwlr" )
7257

73-
[connection signal="timeout" from="Timer" to="Camera3D/trigger_manager" method="_on_timer_timeout"]
58+
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
59+
transform = Transform3D(-0.866025, -0.433013, 0.25, 0, 0.5, 0.866025, -0.5, 0.75, -0.433013, 0, 0, 0)
60+
shadow_enabled = true
61+
directional_shadow_max_distance = 250.0
62+
63+
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
64+
environment = SubResource( "Environment_mv7jf" )
65+
66+
[node name="Timer" type="Timer" parent="."]
67+
process_callback = 0
68+
wait_time = 0.2
69+
autostart = true
70+
71+
[node name="Camera3D" type="Camera3D" parent="."]
72+
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 37.2755, 35.5798, -15.583)
73+
fov = 100.0
74+
far = 4000.46
75+
76+
[connection signal="timeout" from="Timer" to="Node3D/trigger_manager" method="_on_timer_timeout"]

Models/trigger/trigger_manager.gd

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ extends Node3D
99
func _on_timer_timeout():
1010
var bodies = $trigger.get_overlapping_bodies()
1111
if bodies.size() > 1:
12-
get_tree().reload_current_scene()
13-
12+
get_tree().reload_current_scene() #TODO: game over and stuff

Pieces/L.tscn

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[gd_scene load_steps=7 format=3 uid="uid://liglphqd6meu"]
22

33
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_l4ig4"]
4-
bounce = 0.1
5-
absorbent = true
4+
friction = 0.05
5+
bounce = 0.39
66

77
[sub_resource type="BoxShape3D" id="BoxShape3D_1xygi"]
88
size = Vector3(2, 2, 4)
@@ -42,7 +42,7 @@ shadow_mesh = SubResource( "ArrayMesh_mbmd4" )
4242

4343
[node name="L" type="RigidDynamicBody3D"]
4444
collision_mask = 3
45-
mass = 0.5
45+
mass = 0.23
4646
physics_material_override = SubResource( "PhysicsMaterial_l4ig4" )
4747

4848
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]

Pieces/line.tscn

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[gd_scene load_steps=6 format=3 uid="uid://cveqmvb6a070w"]
22

33
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_l4ig4"]
4-
bounce = 0.1
5-
absorbent = true
4+
friction = 0.05
5+
bounce = 0.39
66

77
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_vl86y"]
88
resource_name = "Material"

blocks.gd

+21-10
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,44 @@
11
extends Node3D
22

3-
var block_array = [preload("res://Pieces/line.tscn"),preload("res://Pieces/L.tscn"),
4-
preload("res://Pieces/S.tscn"),preload("res://Pieces/square.tscn"),
5-
preload("res://Pieces/wither.tscn")]
3+
var block_array = [
4+
preload("res://Pieces/line.tscn"),
5+
preload("res://Pieces/L.tscn"),
6+
preload("res://Pieces/S.tscn"),
7+
preload("res://Pieces/square.tscn"),
8+
preload("res://Pieces/wither.tscn")
9+
]
10+
611
var current = 0
712
var next = 0
8-
var current_piece
13+
var current_piece: RigidDynamicBody3D
14+
var move_speed = 30
915

1016
func _ready():
1117
_next()
1218

1319
func _next():
1420
current = next
1521
randomize()
16-
next = randi()% 5
22+
next = randi() % 5
1723
current_piece = block_array[current].instantiate()
1824
current_piece.position = position
19-
current_piece.rotation.y = deg2rad(90)
25+
current_piece.mass = 0.2
26+
current_piece.contact_monitor = true
27+
current_piece.set_max_contacts_reported(1)
2028
await get_tree().process_frame
2129
get_parent().add_child(current_piece)
30+
2231
func _physics_process(delta):
23-
32+
if Input.is_action_just_pressed("release") or current_piece.get_colliding_bodies().size() > 0:
33+
return await release_piece()
34+
2435
var linear_axis = Input.get_action_strength("left") - Input.get_action_strength("right")
2536
var rotation_axis = Input.get_action_strength("rotate_right") - Input.get_action_strength("rotate_left")
2637
current_piece.linear_velocity.y = -7
27-
current_piece.linear_velocity.z = linear_axis * 10
38+
current_piece.linear_velocity.z = linear_axis * move_speed
2839
current_piece.angular_velocity.x = rotation_axis * -10
29-
if Input.is_action_just_pressed("release") or current_piece.position.y < -11:
30-
release_piece()
40+
41+
3142
func release_piece():
3243
set_physics_process(false)
3344
current_piece = null

project.godot

+6-9
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,10 @@ config_version=5
1111
[application]
1212

1313
config/name="shit_tetris"
14+
run/main_scene="res://MAIN.tscn"
1415
config/icon="res://icon.png"
1516
config/features=PackedStringArray("4.0", "Vulkan Clustered")
1617

17-
[display]
18-
19-
window/size/viewport_width=1920
20-
window/size/viewport_height=1080
21-
window/size/fullscreen=true
22-
window/stretch/mode="viewport"
23-
window/stretch/shrink=2.0
24-
2518
[input]
2619

2720
left={
@@ -54,4 +47,8 @@ release={
5447

5548
common/physics_ticks_per_second=240
5649
3d/physics_engine="GodotPhysics3D"
57-
3d/default_gravity=14.0
50+
3d/default_gravity=35.0
51+
52+
[rendering]
53+
54+
anti_aliasing/quality/msaa=1

0 commit comments

Comments
 (0)