From 4970753b91103a2fbab233e9d44474fc1c51be5d Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 2 Apr 2022 23:25:44 +0200 Subject: [PATCH] :wrench: Move behaviours to their own scenes --- src/entities/Enemy.tscn | 10 ++++------ src/entities/behaviours/AttractedTo.tscn | 6 ++++++ src/entities/behaviours/ErraticMovement.tscn | 6 ++++++ 3 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 src/entities/behaviours/AttractedTo.tscn create mode 100644 src/entities/behaviours/ErraticMovement.tscn diff --git a/src/entities/Enemy.tscn b/src/entities/Enemy.tscn index 73de18a..e8cfd88 100644 --- a/src/entities/Enemy.tscn +++ b/src/entities/Enemy.tscn @@ -1,19 +1,17 @@ [gd_scene load_steps=5 format=2] [ext_resource path="res://src/mechanics/Black.png" type="Texture" id=1] -[ext_resource path="res://src/entities/behaviours/AttractedTo.gd" type="Script" id=2] -[ext_resource path="res://src/entities/behaviours/ErraticMovement.gd" type="Script" id=3] +[ext_resource path="res://src/entities/behaviours/ErraticMovement.tscn" type="PackedScene" id=2] +[ext_resource path="res://src/entities/behaviours/AttractedTo.tscn" type="PackedScene" id=3] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 16, 16 ) [node name="Enemy" type="KinematicBody2D"] -[node name="AttractedTo" type="Node" parent="."] -script = ExtResource( 2 ) +[node name="AttractedTo" parent="." instance=ExtResource( 3 )] -[node name="ErraticMovement" type="Node" parent="."] -script = ExtResource( 3 ) +[node name="ErraticMovement" parent="." instance=ExtResource( 2 )] [node name="Sprite" type="Sprite" parent="."] texture = ExtResource( 1 ) diff --git a/src/entities/behaviours/AttractedTo.tscn b/src/entities/behaviours/AttractedTo.tscn new file mode 100644 index 0000000..9642854 --- /dev/null +++ b/src/entities/behaviours/AttractedTo.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://src/entities/behaviours/AttractedTo.gd" type="Script" id=1] + +[node name="AttractedTo" type="Node"] +script = ExtResource( 1 ) diff --git a/src/entities/behaviours/ErraticMovement.tscn b/src/entities/behaviours/ErraticMovement.tscn new file mode 100644 index 0000000..e685476 --- /dev/null +++ b/src/entities/behaviours/ErraticMovement.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://src/entities/behaviours/ErraticMovement.gd" type="Script" id=1] + +[node name="ErraticMovement" type="Node"] +script = ExtResource( 1 )