Compare commits

..

2 Commits

Author SHA1 Message Date
ncusimano d62d10e7e0 Merge branch 'master' of https://git.sjkillen.ca/sjkillen/ABGJ-23 2023-08-20 12:18:50 -06:00
ncusimano 2c5a328665 Resolve Conflict
Also has Cultist updates
2023-08-20 12:18:04 -06:00
3 changed files with 42 additions and 40 deletions

View File

@ -1,18 +1,24 @@
extends SharedSlime extends SharedSlime
class_name Cultist class_name Cultist
const SPEED = 5.0 var victim
const JUMP_VELOCITY = 4.
func _on_area_3d_body_entered(body): func _process(delta):
var items_in_range = $Area3D.get_overlapping_bodies() super._process(delta)
var villagers = []
for item in items_in_range: if task == "corrupt":
if is_class("Villager"): pass
villagers.append(item)
var rng = RandomNumberGenerator.new()
var victim_num = rng.randi_range(0, villagers.size())
# For corruption detection range.
func _on_target_radius_body_entered(body):
if body.is_class("Villager"):
victim = body
walk_speed = 2 * walk_speed
target_location_xz = victim.location_xz
task = "walk"
# For collision with other slimes.
func _on_collision_detection_body_entered(body):
if body.is_class("Villager"):
task = "corrupt"

View File

@ -1,31 +1,34 @@
[gd_scene load_steps=7 format=3 uid="uid://e0s4phx2jiit"] [gd_scene load_steps=6 format=3 uid="uid://e0s4phx2jiit"]
[ext_resource type="Script" path="res://cultist.gd" id="1_k6djk"] [ext_resource type="Script" path="res://cultist.gd" id="1_k6djk"]
[ext_resource type="Texture2D" uid="uid://df0xror4t3gbc" path="res://Default Purple.png" id="1_x8j7f"] [ext_resource type="PackedScene" uid="uid://c3q6fva1c1baa" path="res://Models/slime.tscn" id="2_004fn"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_y0hcm"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_vxnad"]
albedo_texture = ExtResource("1_x8j7f")
[sub_resource type="CapsuleMesh" id="CapsuleMesh_17ljq"]
material = SubResource("StandardMaterial3D_vxnad")
[sub_resource type="SphereShape3D" id="SphereShape3D_rypky"] [sub_resource type="SphereShape3D" id="SphereShape3D_rypky"]
radius = 20.0 radius = 5.0
[sub_resource type="SphereShape3D" id="SphereShape3D_pa038"]
radius = 3.0
[sub_resource type="SphereShape3D" id="SphereShape3D_bmc5i"]
radius = 0.3
[node name="Cultist" type="CharacterBody3D"] [node name="Cultist" type="CharacterBody3D"]
script = ExtResource("1_k6djk") script = ExtResource("1_k6djk")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."] [node name="TargetRadius" type="Area3D" parent="."]
shape = SubResource("CapsuleShape3D_y0hcm")
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"] [node name="CollisionShape3D" type="CollisionShape3D" parent="TargetRadius"]
mesh = SubResource("CapsuleMesh_17ljq")
[node name="Area3D" type="Area3D" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
shape = SubResource("SphereShape3D_rypky") shape = SubResource("SphereShape3D_rypky")
[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"] [node name="slime" parent="." instance=ExtResource("2_004fn")]
[node name="CollisionDetection" type="Area3D" parent="."]
[node name="collision_ range" type="CollisionShape3D" parent="CollisionDetection"]
shape = SubResource("SphereShape3D_pa038")
[node name="cultist_collision" type="CollisionShape3D" parent="."]
shape = SubResource("SphereShape3D_bmc5i")
[connection signal="body_entered" from="TargetRadius" to="." method="_on_target_radius_body_entered"]
[connection signal="body_entered" from="CollisionDetection" to="." method="_on_collision_detection_body_entered"]

View File

@ -8,10 +8,3 @@ radius = 0.1
[node name="villager" instance=ExtResource("1_qm1jp")] [node name="villager" instance=ExtResource("1_qm1jp")]
script = ExtResource("2_uf6mh") script = ExtResource("2_uf6mh")
[node name="Area3D" type="Area3D" parent="." index="2"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D" index="0"]
shape = SubResource("SphereShape3D_0wi6w")
[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"]