a game about throwing hammers made for the github game off
-rw-r--r--.github/1.pngbin0 -> 7873 bytes
-rw-r--r--.github/2.pngbin0 -> 8549 bytes
-rw-r--r--hammers/hammer.gd14
-rw-r--r--hammers/hammer_01.tscn4
-rw-r--r--hammers/hammer_02.tscn4
-rw-r--r--hammers/hammer_03.tscn12
-rw-r--r--icon.pngbin1470 -> 1169 bytes
-rw-r--r--project.godot5
-rw-r--r--ui/start.tscn5
9 files changed, 22 insertions, 22 deletions
diff --git a/.github/1.png b/.github/1.png
new file mode 100644
index 0000000..adf3602
--- /dev/null
+++ b/.github/1.png
Binary files differ
diff --git a/.github/2.png b/.github/2.png
new file mode 100644
index 0000000..cd2c2cb
--- /dev/null
+++ b/.github/2.png
Binary files differ
diff --git a/hammers/hammer.gd b/hammers/hammer.gd
index 3ad0fa8..2e80ddf 100644
--- a/hammers/hammer.gd
+++ b/hammers/hammer.gd
@@ -136,6 +136,16 @@ func throw(p_direction: Vector2) -> void:
set_physics_process(true)
-func _on_target_finder_node_entered(n: Node2D) -> void:
- target = n
+func _on_target_finder_node_entered(_n: Node2D) -> void:
+ var bods: Array[Node2D] = target_finder.get_overlapping_bodies() + target_finder.get_overlapping_areas()
+ var space = get_world_2d().direct_space_state
+ var current := {closest = null, dist = 0}
+ for bod in bods:
+ var res := space.intersect_ray(PhysicsRayQueryParameters2D.create(global_position, bod.global_position.move_toward(global_position, .1), pow(2, 1-1)))
+ if res.is_empty():
+ var dist := global_position.distance_to(bod.global_position)
+ if current.dist < dist:
+ current.dist = dist
+ current.closest = bod
+ target = current.closest
target_finder.set_deferred(&"monitoring", false)
diff --git a/hammers/hammer_01.tscn b/hammers/hammer_01.tscn
index b57f4bb..030a6d5 100644
--- a/hammers/hammer_01.tscn
+++ b/hammers/hammer_01.tscn
@@ -4,7 +4,7 @@
[ext_resource type="Shader" path="res://hammers/hammer_outline.gdshader" id="2_le3ds"]
[ext_resource type="Texture2D" uid="uid://dcf5es758pw1n" path="res://assets/hammers/hammer01.png" id="2_sdlv5"]
-[sub_resource type="ShaderMaterial" id="ShaderMaterial_ovq2e"]
+[sub_resource type="ShaderMaterial" id="ShaderMaterial_470c3"]
resource_local_to_scene = true
shader = ExtResource("2_le3ds")
shader_parameter/light_offset = 1.0
@@ -14,7 +14,7 @@ shader_parameter/sin_frequency = 0.25
[node name="Hammer01" instance=ExtResource("1_350hj")]
[node name="Sprite" parent="." index="1"]
-material = SubResource("ShaderMaterial_ovq2e")
+material = SubResource("ShaderMaterial_470c3")
texture = ExtResource("2_sdlv5")
[editable path="Hitbox"]
diff --git a/hammers/hammer_02.tscn b/hammers/hammer_02.tscn
index 282b757..318e408 100644
--- a/hammers/hammer_02.tscn
+++ b/hammers/hammer_02.tscn
@@ -4,7 +4,7 @@
[ext_resource type="Texture2D" uid="uid://bcpy0wbrlmqsq" path="res://assets/hammers/hammer02.png" id="2_dmvhv"]
[ext_resource type="Shader" path="res://hammers/hammer_outline.gdshader" id="2_rf70p"]
-[sub_resource type="ShaderMaterial" id="ShaderMaterial_xuktl"]
+[sub_resource type="ShaderMaterial" id="ShaderMaterial_spgi1"]
resource_local_to_scene = true
shader = ExtResource("2_rf70p")
shader_parameter/light_offset = 1.0
@@ -14,7 +14,7 @@ shader_parameter/sin_frequency = 0.25
[node name="Hammer02" instance=ExtResource("1_vy2k1")]
[node name="Sprite" parent="." index="1"]
-material = SubResource("ShaderMaterial_xuktl")
+material = SubResource("ShaderMaterial_spgi1")
texture = ExtResource("2_dmvhv")
[node name="Hitbox" parent="." index="3"]
diff --git a/hammers/hammer_03.tscn b/hammers/hammer_03.tscn
index aa80f11..f5c4062 100644
--- a/hammers/hammer_03.tscn
+++ b/hammers/hammer_03.tscn
@@ -4,32 +4,32 @@
[ext_resource type="Texture2D" uid="uid://blx67dnlqysnc" path="res://assets/hammers/hammer03.png" id="2_0uj7a"]
[ext_resource type="Shader" path="res://hammers/hammer_outline.gdshader" id="2_huryw"]
-[sub_resource type="ShaderMaterial" id="ShaderMaterial_xjagk"]
+[sub_resource type="ShaderMaterial" id="ShaderMaterial_noekn"]
resource_local_to_scene = true
shader = ExtResource("2_huryw")
shader_parameter/light_offset = 1.0
shader_parameter/line_width = 0.0
shader_parameter/sin_frequency = 0.25
-[sub_resource type="RectangleShape2D" id="RectangleShape2D_fvd8k"]
+[sub_resource type="RectangleShape2D" id="RectangleShape2D_kqtry"]
size = Vector2(8, 12)
-[sub_resource type="RectangleShape2D" id="RectangleShape2D_f12fv"]
+[sub_resource type="RectangleShape2D" id="RectangleShape2D_j6whl"]
size = Vector2(8, 12)
[node name="Hammer03" instance=ExtResource("1_wc0io")]
[node name="Sprite" parent="." index="1"]
-material = SubResource("ShaderMaterial_xjagk")
+material = SubResource("ShaderMaterial_noekn")
texture = ExtResource("2_0uj7a")
[node name="Collision" parent="." index="2"]
-shape = SubResource("RectangleShape2D_fvd8k")
+shape = SubResource("RectangleShape2D_kqtry")
[node name="Hitbox" parent="." index="3"]
damage = 3
[node name="Collision" parent="Hitbox" index="0"]
-shape = SubResource("RectangleShape2D_f12fv")
+shape = SubResource("RectangleShape2D_j6whl")
[editable path="Hitbox"]
diff --git a/icon.png b/icon.png
index a92ae4e..5154171 100644
--- a/icon.png
+++ b/icon.png
Binary files differ
diff --git a/project.godot b/project.godot
index 0e06d3f..2f30172 100644
--- a/project.godot
+++ b/project.godot
@@ -134,11 +134,6 @@ Events="*res://autoloads/Events.gd"
SoundManager="*res://autoloads/sound_manager.tscn"
MusicPlayer="*res://autoloads/MusicPlayer.gd"
-[debug]
-
-gdscript/warnings/return_value_discarded=false
-gdscript/warnings/integer_division=0
-
[display]
window/size/viewport_width=320
diff --git a/ui/start.tscn b/ui/start.tscn
index ea29da1..2a1bac4 100644
--- a/ui/start.tscn
+++ b/ui/start.tscn
@@ -34,7 +34,6 @@ focus = NodePath("VBox/StartButton")
metadata/_edit_vertical_guides_ = []
[node name="VBox" type="VBoxContainer" parent="."]
-layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
@@ -48,21 +47,18 @@ grow_horizontal = 2
grow_vertical = 2
[node name="StartButton" type="Button" parent="VBox" groups=["button"]]
-layout_mode = 2
offset_right = 172.0
offset_bottom = 43.0
text = "start"
script = SubResource("GDScript_52jbq")
[node name="CfgButtton" type="Button" parent="VBox" groups=["button"]]
-layout_mode = 2
offset_top = 47.0
offset_right = 172.0
offset_bottom = 90.0
text = "configure"
[node name="ExitButton" type="Button" parent="VBox" groups=["button"]]
-layout_mode = 2
offset_top = 94.0
offset_right = 172.0
offset_bottom = 137.0
@@ -72,7 +68,6 @@ script = SubResource("GDScript_vtoxm")
[node name="cfg" parent="." instance=ExtResource("2_sqamp")]
unique_name_in_owner = true
visible = false
-layout_mode = 1
[connection signal="pressed" from="VBox/CfgButtton" to="cfg" method="open"]
[connection signal="close" from="cfg" to="." method="open"]