1
Fork 0
mirror of https://github.com/RYGhub/the-cold-night.git synced 2024-11-21 20:24:20 +00:00

🔧 Give bullets an owner

This commit is contained in:
Steffo 2022-04-03 08:26:54 +02:00
parent 42c1f4d293
commit 60d3078825
Signed by: steffo
GPG key ID: 6965406171929D01
3 changed files with 9 additions and 2 deletions

View file

@ -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/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]
extents = Vector2( 16, 8 )
@ -19,3 +20,5 @@ texture = ExtResource( 1 )
[node name="BulletMovement" type="Node" parent="."]
script = ExtResource( 2 )
[node name="Ownership" parent="." instance=ExtResource( 3 )]

View file

@ -18,3 +18,4 @@ func shoot():
bullet_container_node.add_child(new_bullet)
var rotation = new_bullet.get_angle_to(source.get_global_mouse_position())
new_bullet.set_rotation(rotation)
new_bullet.get_node("Ownership").entity_owner = source

View file

@ -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"]
script = ExtResource( 1 )