mirror of
https://github.com/RYGhub/the-cold-night.git
synced 2024-11-22 12:44:20 +00:00
🔧 Give bullets an owner
This commit is contained in:
parent
42c1f4d293
commit
60d3078825
3 changed files with 9 additions and 2 deletions
|
@ -1,7 +1,8 @@
|
||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/mechanics/White.png" type="Texture" id=1]
|
[ext_resource path="res://src/mechanics/White.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://src/entities/behaviours/BulletMovement.gd" type="Script" id=2]
|
[ext_resource path="res://src/entities/behaviours/BulletMovement.gd" type="Script" id=2]
|
||||||
|
[ext_resource path="res://src/entities/behaviours/Ownership.tscn" type="PackedScene" id=3]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=1]
|
[sub_resource type="RectangleShape2D" id=1]
|
||||||
extents = Vector2( 16, 8 )
|
extents = Vector2( 16, 8 )
|
||||||
|
@ -19,3 +20,5 @@ texture = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="BulletMovement" type="Node" parent="."]
|
[node name="BulletMovement" type="Node" parent="."]
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="Ownership" parent="." instance=ExtResource( 3 )]
|
||||||
|
|
|
@ -18,3 +18,4 @@ func shoot():
|
||||||
bullet_container_node.add_child(new_bullet)
|
bullet_container_node.add_child(new_bullet)
|
||||||
var rotation = new_bullet.get_angle_to(source.get_global_mouse_position())
|
var rotation = new_bullet.get_angle_to(source.get_global_mouse_position())
|
||||||
new_bullet.set_rotation(rotation)
|
new_bullet.set_rotation(rotation)
|
||||||
|
new_bullet.get_node("Ownership").entity_owner = source
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
[gd_scene format=2]
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/entities/behaviours/Ownership.gd" type="Script" id=1]
|
||||||
|
|
||||||
[node name="Ownership" type="Node"]
|
[node name="Ownership" type="Node"]
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
|
Loading…
Reference in a new issue