WIP duck pushing behaviour
This commit is contained in:
+17
-1
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=18 format=3 uid="uid://muuxxgvx33fp"]
|
||||
[gd_scene load_steps=20 format=3 uid="uid://muuxxgvx33fp"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://hvchk6t0xe7j" path="res://art/animals/Ente.png" id="1_cgxhx"]
|
||||
[ext_resource type="Script" uid="uid://c4qxtuym7syjc" path="res://scripts/CSharp/Common/Animation/Duck.cs" id="2_nm4n7"]
|
||||
@@ -35,11 +35,22 @@ stream_4/stream = ExtResource("12_dx1yn")
|
||||
stream_5/stream = ExtResource("13_yuxo7")
|
||||
stream_6/stream = ExtResource("14_xhefb")
|
||||
|
||||
[sub_resource type="Animation" id="Animation_kjie1"]
|
||||
resource_name = "new_animation"
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_54k4r"]
|
||||
_data = {
|
||||
&"new_animation": SubResource("Animation_kjie1")
|
||||
}
|
||||
|
||||
[node name="Duck" type="Node2D" node_paths=PackedStringArray("_characterBody", "_nakNakAudio", "_wingFlapAudio")]
|
||||
script = ExtResource("2_nm4n7")
|
||||
_characterBody = NodePath("CharacterBody2D")
|
||||
_nakNakAudio = NodePath("Audio/NakNak")
|
||||
_wingFlapAudio = NodePath("Audio/WingFlutter")
|
||||
_runningSpeed = 3000.0
|
||||
_slowSpeed = 500.0
|
||||
_minDistanceToVesna = 1500.0
|
||||
|
||||
[node name="CharacterBody2D" type="CharacterBody2D" parent="."]
|
||||
collision_mask = 7
|
||||
@@ -200,3 +211,8 @@ script = ExtResource("3_rdn2q")
|
||||
[node name="WingFlutter" type="AudioStreamPlayer2D" parent="Audio"]
|
||||
stream = SubResource("AudioStreamRandomizer_hyel8")
|
||||
script = ExtResource("3_rdn2q")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_54k4r")
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=96 format=3 uid="uid://gigb28qk8t12"]
|
||||
[gd_scene load_steps=98 format=3 uid="uid://gigb28qk8t12"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Player2D.tscn" id="1_7wfwe"]
|
||||
[ext_resource type="Texture2D" uid="uid://8sr11ex30n0m" path="res://art/mockups/Kenney_Backgrounds/Samples/uncolored_hills.png" id="2_7b2ri"]
|
||||
@@ -62,6 +62,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://lvhbicmwqab5" path="res://art/farm/tilable grounds/böden/fruchtbarer wilder trockender boden.png" id="47_loeum"]
|
||||
[ext_resource type="AudioStream" uid="uid://c43a6x43jkikl" path="res://audio/sfx/Farming/SFX_GettingWater_Well_01_Reverb.wav" id="49_d77e7"]
|
||||
[ext_resource type="PackedScene" uid="uid://muuxxgvx33fp" path="res://prefabs/farm/duck.tscn" id="62_i36hd"]
|
||||
[ext_resource type="Script" uid="uid://fvo04di6k7we" path="res://scripts/CSharp/Common/Animation/PenCollider.cs" id="63_uxa2m"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_wtdui"]
|
||||
shader = ExtResource("13_7p0hq")
|
||||
@@ -223,6 +224,9 @@ stream_0/stream = ExtResource("39_di1ed")
|
||||
stream_1/stream = ExtResource("40_ceriq")
|
||||
stream_2/stream = ExtResource("49_d77e7")
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_lwk6t"]
|
||||
size = Vector2(1407.56, 1310.2)
|
||||
|
||||
[node name="BabushkaSceneFarmOutside2d" type="Node2D"]
|
||||
script = ExtResource("34_e5b7x")
|
||||
_sceneToLoad = ExtResource("2_taxvr")
|
||||
@@ -2122,6 +2126,9 @@ offset_top = 0.228533
|
||||
offset_right = -456.339
|
||||
offset_bottom = 30.2285
|
||||
|
||||
[node name="Control" parent="CanvasLayer" index="3"]
|
||||
visible = false
|
||||
|
||||
[node name="Audio" type="Node" parent="."]
|
||||
|
||||
[node name="Background Music Ramp up" type="AudioStreamPlayer2D" parent="Audio"]
|
||||
@@ -2163,6 +2170,50 @@ max_distance = 2e+07
|
||||
playback_type = 2
|
||||
script = ExtResource("40_w3jkj")
|
||||
|
||||
[node name="Duck3" parent="." node_paths=PackedStringArray("_vesna") instance=ExtResource("62_i36hd")]
|
||||
position = Vector2(1875, 2155)
|
||||
_vesna = NodePath("../YSorted/Vesna/CharacterBody2D")
|
||||
|
||||
[node name="Duck4" parent="." node_paths=PackedStringArray("_vesna") instance=ExtResource("62_i36hd")]
|
||||
position = Vector2(1496, 2816)
|
||||
_vesna = NodePath("../YSorted/Vesna/CharacterBody2D")
|
||||
|
||||
[node name="Duck5" parent="." node_paths=PackedStringArray("_vesna") instance=ExtResource("62_i36hd")]
|
||||
position = Vector2(4616, 2187)
|
||||
_vesna = NodePath("../YSorted/Vesna/CharacterBody2D")
|
||||
|
||||
[node name="Duck6" parent="." node_paths=PackedStringArray("_vesna") instance=ExtResource("62_i36hd")]
|
||||
position = Vector2(867, 2144)
|
||||
_vesna = NodePath("../YSorted/Vesna/CharacterBody2D")
|
||||
|
||||
[node name="Duck7" parent="." node_paths=PackedStringArray("_vesna") instance=ExtResource("62_i36hd")]
|
||||
position = Vector2(488, 2718)
|
||||
_vesna = NodePath("../YSorted/Vesna/CharacterBody2D")
|
||||
|
||||
[node name="Duck10" parent="." node_paths=PackedStringArray("_vesna") instance=ExtResource("62_i36hd")]
|
||||
position = Vector2(5201, 2708)
|
||||
_vesna = NodePath("../YSorted/Vesna/CharacterBody2D")
|
||||
|
||||
[node name="Duck11" parent="." node_paths=PackedStringArray("_vesna") instance=ExtResource("62_i36hd")]
|
||||
position = Vector2(1235, 2458)
|
||||
_vesna = NodePath("../YSorted/Vesna/CharacterBody2D")
|
||||
|
||||
[node name="Duck12" parent="." node_paths=PackedStringArray("_vesna") instance=ExtResource("62_i36hd")]
|
||||
position = Vector2(2146, 2794)
|
||||
_vesna = NodePath("../YSorted/Vesna/CharacterBody2D")
|
||||
|
||||
[node name="Duck13" parent="." node_paths=PackedStringArray("_vesna") instance=ExtResource("62_i36hd")]
|
||||
position = Vector2(3587, 3119)
|
||||
_vesna = NodePath("../YSorted/Vesna/CharacterBody2D")
|
||||
|
||||
[node name="Duck14" parent="." node_paths=PackedStringArray("_vesna") instance=ExtResource("62_i36hd")]
|
||||
position = Vector2(4757, 2686)
|
||||
_vesna = NodePath("../YSorted/Vesna/CharacterBody2D")
|
||||
|
||||
[node name="Duck15" parent="." node_paths=PackedStringArray("_vesna") instance=ExtResource("62_i36hd")]
|
||||
position = Vector2(4908, 3206)
|
||||
_vesna = NodePath("../YSorted/Vesna/CharacterBody2D")
|
||||
|
||||
[node name="Duck" parent="." node_paths=PackedStringArray("_vesna") instance=ExtResource("62_i36hd")]
|
||||
position = Vector2(2517, 2417)
|
||||
_vesna = NodePath("../YSorted/Vesna/CharacterBody2D")
|
||||
@@ -2171,6 +2222,13 @@ _vesna = NodePath("../YSorted/Vesna/CharacterBody2D")
|
||||
position = Vector2(3540, 2518)
|
||||
_vesna = NodePath("../YSorted/Vesna/CharacterBody2D")
|
||||
|
||||
[node name="PenCollider" type="Area2D" parent="."]
|
||||
script = ExtResource("63_uxa2m")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="PenCollider"]
|
||||
position = Vector2(-4983.78, 2662.9)
|
||||
shape = SubResource("RectangleShape2D_lwk6t")
|
||||
|
||||
[connection signal="FilledWateringCan" from="YSorted/Vesna" to="Audio/SFX/FillWater SFX2" method="PlayOneShot"]
|
||||
[connection signal="WateringField" from="YSorted/Vesna/FarmingControls" to="Audio/SFX/Watering SFX" method="PlayOneShot"]
|
||||
[connection signal="InteractedTool" from="YSorted/Brünnen/InteractionArea" to="YSorted/Vesna" method="TryFillWateringCan"]
|
||||
|
||||
@@ -10,13 +10,13 @@ public partial class Duck : Node2D
|
||||
[Export] private AudioPlayer _wingFlapAudio;
|
||||
[Export] private Node2D _vesna;
|
||||
[Export] private float _runningSpeed = 5f;
|
||||
[Export] private float _slowSpeed = 0.5f;
|
||||
[Export] private float _slowSpeed = 1f;
|
||||
[Export] private float _minDistanceToVesna = 1000f;
|
||||
|
||||
private bool _vesnaInReach = false;
|
||||
private bool _penEntered = false;
|
||||
private Vector2 _lastDirection = Vector2.Up;
|
||||
private int _numberOfFramesPerDirection = 100;
|
||||
private int _numberOfFramesPerDirection = 1000;
|
||||
private int _currentFramesThisDirection = 0;
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ public partial class Duck : Node2D
|
||||
{
|
||||
_characterBody.Velocity = Vector2.Zero;
|
||||
_characterBody.MoveAndSlide();
|
||||
GD.Print("Pen entered.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -40,9 +41,10 @@ public partial class Duck : Node2D
|
||||
if (currentDistance < _minDistanceToVesna)
|
||||
{
|
||||
_characterBody.Velocity = new Vector2( _characterBody.GlobalPosition.X - _vesna.GlobalPosition.X,
|
||||
_characterBody.GlobalPosition.Y - _vesna.GlobalPosition.Y);
|
||||
_characterBody.GlobalPosition.Y - _vesna.GlobalPosition.Y).Normalized();
|
||||
_characterBody.Velocity *= _runningSpeed;
|
||||
_characterBody.MoveAndSlide();
|
||||
// todo: Add noise!
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -58,6 +60,13 @@ public partial class Duck : Node2D
|
||||
_characterBody.MoveAndSlide();
|
||||
}
|
||||
|
||||
/*
|
||||
if (_characterBody.Velocity.X < 0 && _characterBody.Scale.X > 0)
|
||||
{
|
||||
_characterBody.Scale = new Vector2(_characterBody.Scale.X * (-1), _characterBody.Scale.Y);
|
||||
}
|
||||
*/
|
||||
|
||||
base._Process(delta);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Godot;
|
||||
|
||||
namespace Babushka.scripts.CSharp.Common.Animation;
|
||||
|
||||
public partial class PenCollider : Area2D
|
||||
{
|
||||
// bisons vorschlag:
|
||||
|
||||
// duck entered pen -> pen detects collision,
|
||||
// collision reffences somehow to the duck -> pen "catches" duck object -> sets duck "i am your pen now"
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://fvo04di6k7we
|
||||
Reference in New Issue
Block a user