diff options
author | David Luevano Alvarado <david@luevano.xyz> | 2022-05-31 03:49:28 -0600 |
---|---|---|
committer | David Luevano Alvarado <david@luevano.xyz> | 2022-05-31 03:49:28 -0600 |
commit | bd197168c39551c3456099ed2a39375a8442483f (patch) | |
tree | adeafb80b75e3566918f35141c2392af590897c3 /src/entities/actors/snake/scenes | |
parent | 2838046928db956b7712d24dfb63ee45fbc4d050 (diff) |
working snake generation and path following, minor refactor
Diffstat (limited to 'src/entities/actors/snake/scenes')
-rw-r--r-- | src/entities/actors/snake/scenes/Body.tscn | 14 | ||||
-rw-r--r-- | src/entities/actors/snake/scenes/Head.tscn | 10 | ||||
-rw-r--r-- | src/entities/actors/snake/scenes/Snake.tscn | 21 | ||||
-rw-r--r-- | src/entities/actors/snake/scenes/Tail.tscn | 15 |
4 files changed, 60 insertions, 0 deletions
diff --git a/src/entities/actors/snake/scenes/Body.tscn b/src/entities/actors/snake/scenes/Body.tscn new file mode 100644 index 0000000..93020b2 --- /dev/null +++ b/src/entities/actors/snake/scenes/Body.tscn @@ -0,0 +1,14 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://entities/actors/snake/sprites/body.png" type="Texture" id=1] +[ext_resource path="res://entities/actors/snake/scripts/generic_segment.gd" type="Script" id=2] + +[node name="BodyPathFollow" type="PathFollow2D"] +loop = false +script = ExtResource( 2 ) + +[node name="Body" type="Node2D" parent="."] +rotation = 1.5708 + +[node name="Sprite" type="Sprite" parent="Body"] +texture = ExtResource( 1 ) diff --git a/src/entities/actors/snake/scenes/Head.tscn b/src/entities/actors/snake/scenes/Head.tscn new file mode 100644 index 0000000..2dc1666 --- /dev/null +++ b/src/entities/actors/snake/scenes/Head.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://entities/actors/snake/sprites/head.png" type="Texture" id=1] +[ext_resource path="res://entities/actors/snake/scripts/head.gd" type="Script" id=2] + +[node name="HeadPoint" type="Node2D"] +script = ExtResource( 2 ) + +[node name="Sprite" type="Sprite" parent="."] +texture = ExtResource( 1 ) diff --git a/src/entities/actors/snake/scenes/Snake.tscn b/src/entities/actors/snake/scenes/Snake.tscn new file mode 100644 index 0000000..cb1eb2a --- /dev/null +++ b/src/entities/actors/snake/scenes/Snake.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://entities/actors/snake/scenes/Head.tscn" type="PackedScene" id=1] +[ext_resource path="res://entities/actors/snake/scenes/Body.tscn" type="PackedScene" id=2] +[ext_resource path="res://entities/actors/snake/scripts/snake.gd" type="Script" id=3] +[ext_resource path="res://entities/actors/snake/scenes/Tail.tscn" type="PackedScene" id=4] + +[sub_resource type="Curve2D" id=1] +_data = { +"points": PoolVector2Array( ) +} + +[node name="Snake" type="Node2D"] +script = ExtResource( 3 ) +BODY_SEGMENT_NP = ExtResource( 2 ) +TAIL_SEGMENT_NP = ExtResource( 4 ) + +[node name="Path" type="Path2D" parent="."] +curve = SubResource( 1 ) + +[node name="Head" parent="." instance=ExtResource( 1 )] diff --git a/src/entities/actors/snake/scenes/Tail.tscn b/src/entities/actors/snake/scenes/Tail.tscn new file mode 100644 index 0000000..bb30c42 --- /dev/null +++ b/src/entities/actors/snake/scenes/Tail.tscn @@ -0,0 +1,15 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://entities/actors/snake/sprites/tail.png" type="Texture" id=1] +[ext_resource path="res://entities/actors/snake/scripts/generic_segment.gd" type="Script" id=2] + +[node name="TailPathFollow" type="PathFollow2D"] +loop = false +script = ExtResource( 2 ) +TYPE = "tail" + +[node name="Tail" type="Node2D" parent="."] +rotation = 1.5708 + +[node name="Sprite" type="Sprite" parent="Tail"] +texture = ExtResource( 1 ) |