Updated projectile collision shapes

This commit is contained in:
2025-12-22 21:10:48 +03:00
parent 309112a1f2
commit b637474913
6 changed files with 5 additions and 28 deletions
@@ -18,23 +18,17 @@ var weapon : AbstractWeapon
var _velocity: Vector2
@onready var collision : CollisionShape2D = $CollisionShape2D
@onready var out_of_screen_timer : Timer = $OutOfScreenTimer
func _ready() -> void:
_velocity = direction.normalized() * speed + ship_velocity
_update_collision_rotation(_velocity)
func _physics_process(delta: float) -> void:
position += _velocity * delta
func _update_collision_rotation(velocity: Vector2) -> void:
collision.rotation = velocity.angle() - 0.5 * PI
func _on_screen_entered() -> void:
out_of_screen_timer.stop()
@@ -3,6 +3,7 @@
[ext_resource type="Script" uid="uid://ctmjb3nkxrepu" path="res://game/entities/weapons/abstract_projectile.gd" id="1_4b2nh"]
[sub_resource type="CircleShape2D" id="CircleShape2D_4b2nh"]
radius = 1.0
[node name="AbstrastProjectile" type="Area2D" groups=["projectiles"]]
z_index = 1
@@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=3 uid="uid://yfvluap3uy1r"]
[gd_scene load_steps=7 format=3 uid="uid://yfvluap3uy1r"]
[ext_resource type="PackedScene" uid="uid://cdv5n4t47hr8i" path="res://game/entities/weapons/abstract_direct_hit_projectile.tscn" id="1_3tgt7"]
[ext_resource type="Script" uid="uid://rtsf1n0djorp" path="res://game/entities/weapons/gatling/abstract_gatling_projectile.gd" id="2_hbgoq"]
@@ -14,9 +14,6 @@ metadata/_custom_type_script = "uid://bhqvk5cnjg5mv"
atlas = ExtResource("4_ndegg")
region = Rect2(0, 0, 16, 16)
[sub_resource type="CircleShape2D" id="CircleShape2D_2tbeq"]
radius = 1.0
[node name="AbstractGatlingProjectile" instance=ExtResource("1_3tgt7")]
collision_layer = 0
collision_mask = 0
@@ -26,6 +23,3 @@ speed = 600
[node name="Sprite2D" type="Sprite2D" parent="." index="0"]
texture = SubResource("AtlasTexture_11x32")
[node name="CollisionShape2D" parent="." index="1"]
shape = SubResource("CircleShape2D_2tbeq")
@@ -1,4 +1,4 @@
[gd_scene load_steps=20 format=3 uid="uid://dukgbg13ujkv2"]
[gd_scene load_steps=19 format=3 uid="uid://dukgbg13ujkv2"]
[ext_resource type="PackedScene" uid="uid://betr5ry5tc75e" path="res://game/entities/weapons/abstract_blast_projectile.tscn" id="1_0mcat"]
[ext_resource type="Script" uid="uid://dkvur5bdwg3sr" path="res://game/entities/weapons/launcher/abstract_launcher_projectile.gd" id="2_6hdsf"]
@@ -49,10 +49,6 @@ region = Rect2(32, 48, 16, 16)
atlas = ExtResource("4_kxgpk")
region = Rect2(48, 48, 16, 16)
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_6hdsf"]
radius = 1.0
height = 6.0
[sub_resource type="Resource" id="Resource_kos01"]
script = ExtResource("3_ycnsk")
value = 24
@@ -112,9 +108,6 @@ texture = SubResource("AtlasTexture_4wwm4")
[node name="NE" type="Sprite2D" parent="Sprites" index="7"]
texture = SubResource("AtlasTexture_dl8vu")
[node name="CollisionShape2D" parent="." index="2"]
shape = SubResource("CapsuleShape2D_6hdsf")
[node name="Blast" parent="." index="4"]
collision_layer = 0
collision_mask = 0
@@ -44,4 +44,5 @@ lifetime = 0.4
process_material = SubResource("ParticleProcessMaterial_yedu2")
[node name="CollisionShape2D" parent="." index="1"]
rotation = 1.5707964
shape = SubResource("CapsuleShape2D_u82jm")
@@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=3 uid="uid://bsx23u3a2obbj"]
[gd_scene load_steps=7 format=3 uid="uid://bsx23u3a2obbj"]
[ext_resource type="PackedScene" uid="uid://cdv5n4t47hr8i" path="res://game/entities/weapons/abstract_direct_hit_projectile.tscn" id="1_yu2c6"]
[ext_resource type="Script" uid="uid://ctnje7pjanaws" path="res://game/entities/weapons/shrapnel/abstract_shrapnel_projectile.gd" id="2_2jiy6"]
@@ -14,9 +14,6 @@ metadata/_custom_type_script = "uid://bhqvk5cnjg5mv"
atlas = ExtResource("4_klguu")
region = Rect2(48, 0, 16, 16)
[sub_resource type="CircleShape2D" id="CircleShape2D_2jiy6"]
radius = 1.0
[node name="AbstractShrapnelProjectile" instance=ExtResource("1_yu2c6")]
collision_layer = 0
collision_mask = 0
@@ -27,6 +24,3 @@ speed = 500
[node name="Sprite2D" type="Sprite2D" parent="." index="0"]
texture = SubResource("AtlasTexture_s852w")
[node name="CollisionShape2D" parent="." index="1"]
shape = SubResource("CircleShape2D_2jiy6")