hand to hand weapon

made a close range weapon that can kill the enemy.
This commit is contained in:
sam committed 2026-10-03 19:51:33 -06:00
1 parent 7b15d90633
commit 569e225436
6 files changed
+106 -15

No files matched your search

+11 -2
View File
@@ -4,6 +4,7 @@ extends CharacterBody2D
var SPEED = Vector2(5, 0)
const JUMP_VELOCITY = -400.0
@onready var projectile: PackedScene = preload("res://scenes/projectile.tscn")
var death_counter = 3
@@ -15,6 +16,12 @@ func _ready() -> void:
func _physics_process(delta: float) -> void:
if death_counter == 2:
$ColorRect4.hide()
if death_counter == 1:
$ColorRect3.hide()
if death_counter == 0:
queue_free()
velocity += get_gravity() * delta
move_and_slide()
patrol()
@@ -30,8 +37,10 @@ func _on_timer_timeout() -> void:
func _on_area_2d_area_entered(area: Area2D) -> void:
queue_free()
if GloblaData.hurtable:
death_counter -= 1
elif GloblaData.weapon == 2:
death_counter -= 1
func _on_area_2d_body_entered(body: Node2D) -> void:
GloblaData.death_counter -= 1
+21
View File
@@ -31,6 +31,27 @@ collision_mask = 11
position = Vector2(84, 79)
shape = SubResource("RectangleShape2D_yg5ta")
[node name="ColorRect2" type="ColorRect" parent="." unique_id=797261471]
offset_left = 4.0
offset_top = -56.0
offset_right = 44.0
offset_bottom = -16.0
color = Color(0, 1, 0, 1)
[node name="ColorRect3" type="ColorRect" parent="." unique_id=76071947]
offset_left = 61.0
offset_top = -57.0
offset_right = 101.0
offset_bottom = -17.0
color = Color(0, 1, 0, 1)
[node name="ColorRect4" type="ColorRect" parent="." unique_id=526458105]
offset_left = 126.0
offset_top = -58.0
offset_right = 166.0
offset_bottom = -18.0
color = Color(0, 1, 0, 1)
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"]
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
+35 -8
View File
@@ -6,6 +6,9 @@
[sub_resource type="RectangleShape2D" id="RectangleShape2D_d2by0"]
size = Vector2(111, 105)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_aqe1g"]
size = Vector2(11.886017, 125.91957)
[node name="player" type="CharacterBody2D" unique_id=1596338883]
position = Vector2(510, 410)
collision_mask = 22
@@ -49,19 +52,43 @@ position = Vector2(112, 38)
position = Vector2(57, 54)
[node name="Label" type="Label" parent="." unique_id=519077191]
offset_left = -314.0
offset_top = -265.0
offset_right = -281.0
offset_bottom = -231.0
offset_left = -722.0
offset_top = -416.0
offset_right = -689.0
offset_bottom = -382.0
theme_override_fonts/font = ExtResource("2_g2els")
theme_override_font_sizes/font_size = 25
text = "0"
[node name="Label2" type="Label" parent="." unique_id=1907510281]
offset_left = -516.0
offset_top = -266.0
offset_right = -264.0
offset_bottom = -232.0
offset_left = -924.0
offset_top = -417.0
offset_right = -672.0
offset_bottom = -383.0
theme_override_fonts/font = ExtResource("2_g2els")
theme_override_font_sizes/font_size = 25
text = "cassets:"
[node name="ColorRect5" type="ColorRect" parent="." unique_id=823301403]
offset_left = 107.0
offset_top = 47.0
offset_right = 119.0
offset_bottom = 177.0
rotation = -2.268928
[node name="Area2D" type="Area2D" parent="ColorRect5" unique_id=1787254827]
[node name="CollisionShape2D" type="CollisionShape2D" parent="ColorRect5/Area2D" unique_id=1167506979]
position = Vector2(5.6205444, 65.769745)
shape = SubResource("RectangleShape2D_aqe1g")
[node name="Timer" type="Timer" parent="." unique_id=331042830]
wait_time = 0.1
[node name="Marker2D2" type="Marker2D" parent="." unique_id=354625466]
position = Vector2(11, 54)
[node name="Marker2D3" type="Marker2D" parent="." unique_id=2052549441]
position = Vector2(107, 48)
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]