From 4f2ba4f642315211374c938e435e6158728149c8 Mon Sep 17 00:00:00 2001 From: ncusimano Date: Sat, 19 Aug 2023 23:07:52 -0600 Subject: [PATCH] Hello --- godot/Level/Island.tscn | 2 +- .../grape_animations/upper_body_holding.res | Bin 692 -> 693 bytes .../grape_animations/upper_body_idle.res.res | Bin 470 -> 471 bytes godot/Models/grape_man.tscn | 12 ++- godot/Villager.gd | 23 +---- godot/cul5E74.tmp | 52 +++++++++++ godot/cul99AE.tmp | 78 ++++++++++++++++ godot/cultist.tscn | 41 ++++++++- godot/player.tscn | 10 +- godot/slime_shared.gd | 86 ++++++++++++++++++ godot/slime_shared.tscn | 3 +- godot/tests/test_pickup_slimes.tscn | 4 +- godot/villager.tscn | 2 +- 13 files changed, 271 insertions(+), 42 deletions(-) create mode 100644 godot/cul5E74.tmp create mode 100644 godot/cul99AE.tmp diff --git a/godot/Level/Island.tscn b/godot/Level/Island.tscn index d467220..08dd817 100644 --- a/godot/Level/Island.tscn +++ b/godot/Level/Island.tscn @@ -4,7 +4,7 @@ [ext_resource type="PackedScene" uid="uid://b35w4hlh4n1jt" path="res://Level/World/world_environment.tscn" id="2_lerrn"] [ext_resource type="PackedScene" uid="uid://d3ccrfjpg4hbv" path="res://Models/palm_curved.tscn" id="3_bth2b"] [ext_resource type="PackedScene" uid="uid://c1n2lfcn4rkx7" path="res://Models/palm_default.tscn" id="4_2cnue"] -[ext_resource type="PackedScene" uid="uid://ctbyl0qbks4k6" path="res://Models/ocean.tscn" id="4_dey2i"] +[ext_resource type="PackedScene" path="res://Models/ocean.tscn" id="4_dey2i"] [ext_resource type="PackedScene" uid="uid://difi2tur2j4dg" path="res://Models/island.tscn" id="4_lq6cy"] [ext_resource type="PackedScene" uid="uid://hg1yr5rnxd47" path="res://Models/palm_young.tscn" id="5_prlw2"] [ext_resource type="PackedScene" uid="uid://ce7jbp7f55cro" path="res://Models/buildings/building_1.tscn" id="8_6qbns"] diff --git a/godot/Models/grape_animations/upper_body_holding.res b/godot/Models/grape_animations/upper_body_holding.res index 4fc0701c946aa31e183c828d65016567f72f1498..fe46d2a45d11555ef22c8f08bfcc9632bf723554 100644 GIT binary patch delta 471 zcmV;|0Vw{o1+@i#Qd2`i0ssI201yBG7zh9WodN&=D77#BU>FCT6aeO%YDn;~HXW3K z%67QotjR>|EHVW$xHWgOaVQ6h_9I`u{(ghK`+aPQOPf___#`<-*5hQ^WcjU^J!Gus zxo01$BbmPR|68^d9aBsIO#oW}-Z;NHdi`Bh#clGYRmQ4+P@f0_oP9Ex`c@GhuGF30 zZEIEkN8UlwntN;%&3}=H;vGH2nPGF{MXB^3 z(=<)XvMkH846hnB?+669w=+HPQ=S&=v1ZaHIoSDDn-W29yUN%LhEd=Va)|6*! z9Zxx=J^l}W@J>xy;7$9(Ud;g}3Q9r=I+mH879p4z8CW<%QVyFM9SH#cPe2|e20o;h z>j;6E5}-P>0;^020smb>a*q36Ar--~p1c)UYcM>$w)2J<9viG5Ff4}4R=gkPIF92u zZriqP+X5U+G$stB9TW|nik4Oi3(*RXh})!=iMZNMm+nRf4ICFBJ5)p~AEc6u8|-qq z&|-n5yDk(utxJS7xFCL6aeO1YDn;~HXW3K z%67Qo+~P1fXjY9+z~{l|hiBl5McI?n-}l_R-&dcAuw4%fjU=~v%d^MO%adOA;O73m z|8qEbvS(%Wzhzs|F$GKjO#oW}ok%?^cI{!59oytxt;|J#nY=K>N4rEKHMS%^$P=a= z?t4-HN8Vvpn_FxX&3}=DAs&5%4h!%G3(5Z=uQtr|6xI#@2mJT^_xK<32icr+&N(p* z!!QiHuIsw4YfQC?ViO2{ap!vArA+VFVhycL@~<a6UGcU=2Ufmb%nuYpjuWeJKX5QS8rxu&fv@-w=DFrfHg{ zX<3$KSr!~fG$ah$4vGfOMawGXh3Lj3(z1zN;b`wo3umK)MvE9AJ5)p~ADf36HkNd` z&|-mwlTt;_N{Vcw8zkIEm13oW%70G^3WW(=2u26T#)*Uo5FR*az)87cTggw(=mv=U Ms8kFV1e41F>ajJ}#Q*>R diff --git a/godot/Models/grape_animations/upper_body_idle.res.res b/godot/Models/grape_animations/upper_body_idle.res.res index fd30d7a6e7756bbe986aa84a3158f015341292de..d855dc3e3c1b8dfff2d13b4bd71ea1bf20f95c84 100644 GIT binary patch delta 334 zcmV-U0kQtp1J?t8Qd2`i0ssI201yBGq5}W`zX1RMD77#BV4?!84FCp|NIgJ@DjmZZ z;qsuLRoQOUen`idGz>sdinedKMb?JThE`TwB1#X7**trO^M#M_ZkL_*GGW<8y#PgZ~Ggyj29|Y2`a90UDqXNWz0zsXCIBrgK6ixI{o$t_sC-@c~(YS*a9AQkl*Pg}_7L g|0(`IOdPCBO!Utwwx*BqM?4fPfGL{|i2QyO7&v z#s7u>2mi1C27fnQNFz%UoP2rYTbptl=1jYbbufF= dir_accuracy: + # Rotate towards destination at specified percentage rate. + rotate_y(direction_xz.angle_to(target_direction_xz) * dir_correction_rate) + + if location_xz.distance_to(target_location_xz) <= (Vector2(direction_xz.x, direction_xz.z) * walk_speed).length(): + target_direction_xz = direction_xz + target_location_xz = location_xz + task = "idle" + +func spin(): + # Continue to correct direction to within a margin of dir_accuracy degrees. + if direction_xz.angle_to(target_direction_xz) >= dir_accuracy: + # Rotate towards destination at specified percentage rate. + rotate_y(direction_xz.angle_to(target_direction_xz) * dir_correction_rate) + else: + task = "idle" func idle(): $slime.idle() + task = rng.randf_range(0, 100) + + # 3% chance to walk somewhere. + if task <= walk_chance: + task = "walk" + target_location_xz = transform.origin * Vector3(1, 0, 1) + (direction_xz * 4) + # 6% chance to rotate. + elif task > walk_chance and task <= (walk_chance + spin_chance): + task = "spin" + var rotation_angle = rng.randf_range(-2*PI, 2*PI) + var rotation_vector = Vector3(cos(rotation_angle), 0, sin(rotation_angle)) + target_direction_xz = direction_xz + rotation_vector + # 90% chance to idle. + elif task > (spin_chance + walk_chance): + task = "idle" + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(_delta): + location_xz = transform.origin * Vector3(1, 0, 1) + direction_xz = (transform.basis * Vector3(1, 0, 1)).normalized() + + match task: + "idle": + idle() + "walk": + walk() + "spin": + spin() + + +func _physics_process(delta): + # Add the gravity. + if not is_on_floor(): + velocity.y -= gravity * delta + + # Walk to target location. + if (location_xz.distance_to(target_location_xz) > walk_speed) and task == "walk": + velocity.x = direction_xz.x * walk_speed + velocity.z = direction_xz.z * walk_speed + else: + velocity.x = 0 + velocity.z = 0 + + move_and_slide() diff --git a/godot/slime_shared.tscn b/godot/slime_shared.tscn index 2142db4..c23ffdb 100644 --- a/godot/slime_shared.tscn +++ b/godot/slime_shared.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=4 format=3 uid="uid://dmtmign72vtlm"] +[gd_scene load_steps=4 format=3 uid="uid://b24gutwqacwyr"] [ext_resource type="Script" path="res://slime_shared.gd" id="1_gmj2r"] [ext_resource type="PackedScene" uid="uid://c3q6fva1c1baa" path="res://Models/slime.tscn" id="2_6u4ex"] @@ -10,6 +10,7 @@ radius = 0.05 script = ExtResource("1_gmj2r") [node name="slime" parent="." instance=ExtResource("2_6u4ex")] +colors = Array[Color]([]) [node name="slime_collision" type="CollisionShape3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0408143, 0) diff --git a/godot/tests/test_pickup_slimes.tscn b/godot/tests/test_pickup_slimes.tscn index ce1bba2..8c88307 100644 --- a/godot/tests/test_pickup_slimes.tscn +++ b/godot/tests/test_pickup_slimes.tscn @@ -1,7 +1,7 @@ -[gd_scene load_steps=5 format=3 uid="uid://bax01mdng0pbb"] +[gd_scene load_steps=5 format=3 uid="uid://cl42bns6d4401"] [ext_resource type="PackedScene" uid="uid://7utef1nnena8" path="res://player.tscn" id="2_fy870"] -[ext_resource type="PackedScene" uid="uid://c4s6y758n77lw" path="res://villager_shared.tscn" id="2_oxniy"] +[ext_resource type="PackedScene" path="res://villager_shared.tscn" id="2_oxniy"] [sub_resource type="QuadMesh" id="QuadMesh_lasv3"] diff --git a/godot/villager.tscn b/godot/villager.tscn index 054206d..118e359 100644 --- a/godot/villager.tscn +++ b/godot/villager.tscn @@ -6,7 +6,7 @@ [sub_resource type="CapsuleMesh" id="CapsuleMesh_b3srs"] -[node name="CharacterBody3D" type="CharacterBody3D"] +[node name="Villager" type="CharacterBody3D"] script = ExtResource("1_ardgw") [node name="CollisionShape3D" type="CollisionShape3D" parent="."]