Updated projectile collision shapes
This commit is contained in:
@@ -18,23 +18,17 @@ var weapon : AbstractWeapon
|
|||||||
var _velocity: Vector2
|
var _velocity: Vector2
|
||||||
|
|
||||||
|
|
||||||
@onready var collision : CollisionShape2D = $CollisionShape2D
|
|
||||||
@onready var out_of_screen_timer : Timer = $OutOfScreenTimer
|
@onready var out_of_screen_timer : Timer = $OutOfScreenTimer
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
_velocity = direction.normalized() * speed + ship_velocity
|
_velocity = direction.normalized() * speed + ship_velocity
|
||||||
_update_collision_rotation(_velocity)
|
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
position += _velocity * delta
|
position += _velocity * delta
|
||||||
|
|
||||||
|
|
||||||
func _update_collision_rotation(velocity: Vector2) -> void:
|
|
||||||
collision.rotation = velocity.angle() - 0.5 * PI
|
|
||||||
|
|
||||||
|
|
||||||
func _on_screen_entered() -> void:
|
func _on_screen_entered() -> void:
|
||||||
out_of_screen_timer.stop()
|
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"]
|
[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"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_4b2nh"]
|
||||||
|
radius = 1.0
|
||||||
|
|
||||||
[node name="AbstrastProjectile" type="Area2D" groups=["projectiles"]]
|
[node name="AbstrastProjectile" type="Area2D" groups=["projectiles"]]
|
||||||
z_index = 1
|
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="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"]
|
[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")
|
atlas = ExtResource("4_ndegg")
|
||||||
region = Rect2(0, 0, 16, 16)
|
region = Rect2(0, 0, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_2tbeq"]
|
|
||||||
radius = 1.0
|
|
||||||
|
|
||||||
[node name="AbstractGatlingProjectile" instance=ExtResource("1_3tgt7")]
|
[node name="AbstractGatlingProjectile" instance=ExtResource("1_3tgt7")]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 0
|
collision_mask = 0
|
||||||
@@ -26,6 +23,3 @@ speed = 600
|
|||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="." index="0"]
|
[node name="Sprite2D" type="Sprite2D" parent="." index="0"]
|
||||||
texture = SubResource("AtlasTexture_11x32")
|
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="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"]
|
[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")
|
atlas = ExtResource("4_kxgpk")
|
||||||
region = Rect2(48, 48, 16, 16)
|
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"]
|
[sub_resource type="Resource" id="Resource_kos01"]
|
||||||
script = ExtResource("3_ycnsk")
|
script = ExtResource("3_ycnsk")
|
||||||
value = 24
|
value = 24
|
||||||
@@ -112,9 +108,6 @@ texture = SubResource("AtlasTexture_4wwm4")
|
|||||||
[node name="NE" type="Sprite2D" parent="Sprites" index="7"]
|
[node name="NE" type="Sprite2D" parent="Sprites" index="7"]
|
||||||
texture = SubResource("AtlasTexture_dl8vu")
|
texture = SubResource("AtlasTexture_dl8vu")
|
||||||
|
|
||||||
[node name="CollisionShape2D" parent="." index="2"]
|
|
||||||
shape = SubResource("CapsuleShape2D_6hdsf")
|
|
||||||
|
|
||||||
[node name="Blast" parent="." index="4"]
|
[node name="Blast" parent="." index="4"]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 0
|
collision_mask = 0
|
||||||
|
|||||||
@@ -44,4 +44,5 @@ lifetime = 0.4
|
|||||||
process_material = SubResource("ParticleProcessMaterial_yedu2")
|
process_material = SubResource("ParticleProcessMaterial_yedu2")
|
||||||
|
|
||||||
[node name="CollisionShape2D" parent="." index="1"]
|
[node name="CollisionShape2D" parent="." index="1"]
|
||||||
|
rotation = 1.5707964
|
||||||
shape = SubResource("CapsuleShape2D_u82jm")
|
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="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"]
|
[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")
|
atlas = ExtResource("4_klguu")
|
||||||
region = Rect2(48, 0, 16, 16)
|
region = Rect2(48, 0, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_2jiy6"]
|
|
||||||
radius = 1.0
|
|
||||||
|
|
||||||
[node name="AbstractShrapnelProjectile" instance=ExtResource("1_yu2c6")]
|
[node name="AbstractShrapnelProjectile" instance=ExtResource("1_yu2c6")]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 0
|
collision_mask = 0
|
||||||
@@ -27,6 +24,3 @@ speed = 500
|
|||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="." index="0"]
|
[node name="Sprite2D" type="Sprite2D" parent="." index="0"]
|
||||||
texture = SubResource("AtlasTexture_s852w")
|
texture = SubResource("AtlasTexture_s852w")
|
||||||
|
|
||||||
[node name="CollisionShape2D" parent="." index="1"]
|
|
||||||
shape = SubResource("CircleShape2D_2jiy6")
|
|
||||||
|
|||||||
Reference in New Issue
Block a user