Reworked other weapons

This commit is contained in:
2025-11-26 21:29:57 +03:00
parent c3c199a9f9
commit 79d942b803
20 changed files with 74 additions and 76 deletions
+8 -2
View File
@@ -32,17 +32,23 @@ signal destroyed
@export_range(0, 1000) var mass : int = 0
@export_range(0, 360) var weapon_rotation : int = 0
@export var weapon_positions: Array[Vector2]
var weapon_positions: Array[Vector2]
var _weapons : Array[AbstractWeapon]
func _ready() -> void:
for slot in $WeaponSlots.get_children():
if slot is Node2D:
weapon_positions.append(slot.global_position - global_position)
for pos in weapon_positions:
var weapon : AbstractWeapon = WEAPONS.pick_random().instantiate()
weapon.position = pos
weapon.rotation = deg_to_rad(weapon_rotation)
weapon.rotation_degrees = weapon_rotation
add_child(weapon)
_weapons.append(weapon)
+2
View File
@@ -22,4 +22,6 @@ shape = SubResource("CircleShape2D_xxtvk")
[node name="HeathBar" parent="." node_paths=PackedStringArray("health") instance=ExtResource("3_l62e5")]
health = NodePath("../Health")
[node name="WeaponSlots" type="Node2D" parent="."]
[connection signal="depleted" from="Health" to="." method="_on_health_depleted"]
@@ -16,7 +16,6 @@ acceleration = 30
deceleration = 18
max_speed = 60
mass = 600
weapon_positions = Array[Vector2]([Vector2(0, 16), Vector2(0, 0), Vector2(0, -16)])
[node name="Sprite2D" parent="." index="0"]
texture = SubResource("PlaceholderTexture2D_cuapu")
@@ -34,3 +33,11 @@ offset_bottom = 30.0
[node name="VisibleOnScreenNotifier2D" parent="." index="5"]
rect = Rect2(-29, -21, 58, 42)
[node name="First" type="Node2D" parent="WeaponSlots" index="0"]
position = Vector2(0, -13)
[node name="Second" type="Node2D" parent="WeaponSlots" index="1"]
[node name="Third" type="Node2D" parent="WeaponSlots" index="2"]
position = Vector2(0, 13)
@@ -16,7 +16,6 @@ acceleration = 92
deceleration = 46
max_speed = 92
mass = 250
weapon_positions = Array[Vector2]([Vector2(0, 10), Vector2(0, -10)])
[node name="Sprite2D" parent="." index="0"]
texture = SubResource("PlaceholderTexture2D_4jmkv")
@@ -33,3 +32,9 @@ offset_bottom = 30.0
[node name="VisibleOnScreenNotifier2D" parent="." index="5"]
rect = Rect2(-13, -21, 26, 42)
[node name="First" type="Node2D" parent="WeaponSlots" index="0"]
position = Vector2(0, -10)
[node name="Second" type="Node2D" parent="WeaponSlots" index="1"]
position = Vector2(0, 10)
@@ -15,7 +15,6 @@ acceleration = 180
deceleration = 80
max_speed = 120
mass = 100
weapon_positions = Array[Vector2]([Vector2(0, 0)])
[node name="Sprite2D" parent="." index="0"]
texture = SubResource("PlaceholderTexture2D_bw04d")
@@ -33,3 +32,6 @@ offset_bottom = 14.0
[node name="VisibleOnScreenNotifier2D" parent="." index="5"]
rect = Rect2(-13, -5, 26, 10)
[node name="First" type="Node2D" parent="WeaponSlots" index="0"]
position = Vector2(6, 0)
+7 -1
View File
@@ -17,7 +17,7 @@ acceleration = 92
deceleration = 46
max_speed = 92
mass = 250
weapon_positions = Array[Vector2]([Vector2(-2, 18), Vector2(-2, -18)])
weapon_rotation = null
[node name="Sprite2D" parent="." index="0"]
texture = ExtResource("3_uf2n1")
@@ -35,5 +35,11 @@ offset_bottom = 22.0
[node name="PlayerController" parent="." index="4" instance=ExtResource("3_4mjo1")]
[node name="First" type="Node2D" parent="WeaponSlots" index="0"]
position = Vector2(-2, 8)
[node name="Second" type="Node2D" parent="WeaponSlots" index="1"]
position = Vector2(-2, -8)
[connection signal="accelerate" from="PlayerController" to="." method="accelerate"]
[connection signal="shoot" from="PlayerController" to="." method="_on_player_controller_shoot"]