From 2c5d588bc593929a96f0e58d7d1ab52f269add55 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Wed, 1 Jun 2022 03:27:11 -0600 Subject: make working basic snake, refactor code and made gif recorder its separate thing --- src/entities/actors/snake/scenes/Body.tscn | 13 +++++++++++-- src/entities/actors/snake/scenes/Head.tscn | 12 ++++++++++-- src/entities/actors/snake/scenes/Tail.tscn | 12 ++++++++++-- 3 files changed, 31 insertions(+), 6 deletions(-) (limited to 'src/entities/actors/snake/scenes') diff --git a/src/entities/actors/snake/scenes/Body.tscn b/src/entities/actors/snake/scenes/Body.tscn index 93020b2..8e4a8a4 100644 --- a/src/entities/actors/snake/scenes/Body.tscn +++ b/src/entities/actors/snake/scenes/Body.tscn @@ -1,14 +1,23 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 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] +[sub_resource type="CapsuleShape2D" id=1] +radius = 5.99999 +height = 4.00002 + [node name="BodyPathFollow" type="PathFollow2D"] loop = false script = ExtResource( 2 ) -[node name="Body" type="Node2D" parent="."] +[node name="Body" type="Area2D" parent="."] rotation = 1.5708 +collision_layer = 2 +collision_mask = 0 [node name="Sprite" type="Sprite" parent="Body"] texture = ExtResource( 1 ) + +[node name="Collision" type="CollisionShape2D" parent="Body"] +shape = SubResource( 1 ) diff --git a/src/entities/actors/snake/scenes/Head.tscn b/src/entities/actors/snake/scenes/Head.tscn index 2dc1666..22aa7e6 100644 --- a/src/entities/actors/snake/scenes/Head.tscn +++ b/src/entities/actors/snake/scenes/Head.tscn @@ -1,10 +1,18 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 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"] +[sub_resource type="CircleShape2D" id=1] +radius = 5.0 + +[node name="Head" type="KinematicBody2D"] +position = Vector2( -1, 0 ) +collision_mask = 0 script = ExtResource( 2 ) [node name="Sprite" type="Sprite" parent="."] texture = ExtResource( 1 ) + +[node name="Collision" type="CollisionShape2D" parent="."] +shape = SubResource( 1 ) diff --git a/src/entities/actors/snake/scenes/Tail.tscn b/src/entities/actors/snake/scenes/Tail.tscn index bb30c42..17e8ec5 100644 --- a/src/entities/actors/snake/scenes/Tail.tscn +++ b/src/entities/actors/snake/scenes/Tail.tscn @@ -1,15 +1,23 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 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] +[sub_resource type="CircleShape2D" id=1] +radius = 4.12311 + [node name="TailPathFollow" type="PathFollow2D"] loop = false script = ExtResource( 2 ) TYPE = "tail" -[node name="Tail" type="Node2D" parent="."] +[node name="Tail" type="Area2D" parent="."] rotation = 1.5708 +collision_layer = 4 +collision_mask = 0 [node name="Sprite" type="Sprite" parent="Tail"] texture = ExtResource( 1 ) + +[node name="Collision" type="CollisionShape2D" parent="Tail"] +shape = SubResource( 1 ) -- cgit v1.2.3-70-g09d2